]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Campaign: fix turrets not firing in the Assault level 1422/head
authorterencehill <piuntn@gmail.com>
Mon, 6 Jan 2025 11:56:01 +0000 (12:56 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 9 Jan 2025 15:21:57 +0000 (16:21 +0100)
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh

index 882be18ea93a1600e636dfaf8dc0a9f2d099c470..4fba504d56f5bb2f49dfd49a71e8dcae7d98f12d 100644 (file)
@@ -149,18 +149,22 @@ void target_assault_roundend_use(entity this, entity actor, entity trigger)
        this.winning = 1; // round has been won by attackers
 }
 
+bool assault_turrets_teamswap_forbidden;
 void assault_roundstart_use(entity this, entity actor, entity trigger)
 {
        SUB_UseTargets(this, this, trigger);
 
-       //(Re)spawn all turrets
+       // (Re)spawn all turrets
        IL_EACH(g_turrets, true,
        {
-               // Swap turret teams
-               if(it.team == NUM_TEAM_1)
-                       it.team = NUM_TEAM_2;
-               else
-                       it.team = NUM_TEAM_1;
+               if (!assault_turrets_teamswap_forbidden)
+               {
+                       // Swap turret teams
+                       if(it.team == NUM_TEAM_1)
+                               it.team = NUM_TEAM_2;
+                       else
+                               it.team = NUM_TEAM_1;
+               }
 
                // Doubles as teamchange
                turret_respawn(it);
@@ -630,10 +634,14 @@ MUTATOR_HOOKFUNCTION(as, OnEntityPreSpawn)
 
 MUTATOR_HOOKFUNCTION(as, ReadyRestart_Deny)
 {
-       // readyrestart not supported
-       // it's allowed only in campaign since the campaign requires readyrestart support
-       // to do so Assault is played in single round mode
+       // Readyrestart is forbidden because Assault is actually played in 2 different games, called
+       // rounds, where the map is completely restarted and the timelimit of the second round is set
+       // to the time the previous attacker team took to destroy the main objective
+       // In campaign it's allowed because Assault is played in a single game / round
        if (autocvar_g_campaign)
+       {
+               assault_turrets_teamswap_forbidden = true;
                return false;
+       }
        return true;
 }
index 3709bdff9386541b042fd1693249e59b521e3ca6..6e30d4d9d5054191e05d1e6a533dd77f7f24f370 100644 (file)
@@ -49,7 +49,7 @@ void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrat
 void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
 
 // assault game mode: Which team is attacking in this round?
-float assault_attacker_team;
+int assault_attacker_team;
 
 // predefined spawnfuncs
 void target_objective_decrease_activate(entity this);