]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix stalemate and flag throwing while dead
authorSamual Lenks <samual@xonotic.org>
Thu, 30 Aug 2012 19:08:18 +0000 (15:08 -0400)
committerSamual Lenks <samual@xonotic.org>
Thu, 30 Aug 2012 19:08:18 +0000 (15:08 -0400)
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh

index b82e26345063eb9d9369a9b5bbb33bd7a807fde0..573e7610e1da2c441c11baa293dd2ad11929d988 100644 (file)
@@ -537,10 +537,13 @@ void ctf_CheckStalemate(void)
        float stale_red_flags, stale_blue_flags;
        entity tmp_entity;
 
+       entity ctf_staleflaglist; // reset the list, we need to build the list each time this function runs
+
        // build list of stale flags
        for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
        {
                if(autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate)
+               if(tmp_entity.ctf_status != FLAG_BASE)
                if(time >= tmp_entity.ctf_pickuptime + autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate)
                {
                        tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
@@ -553,13 +556,18 @@ void ctf_CheckStalemate(void)
                        }
                }
        }
+
+       if(stale_red_flags && stale_blue_flags)
+               ctf_stalemate = TRUE;
+       else if(!stale_red_flags && !stale_blue_flags)
+               ctf_stalemate = FALSE;
        
        // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
-       if(stale_red_flags && stale_blue_flags)
+       if(ctf_stalemate)
        {
                for(tmp_entity = ctf_staleflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_staleflagnext)
                {
-                       if not(tmp_entity.owner.wps_enemyflagcarrier)   
+                       if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
                                WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
                }
                
@@ -1060,7 +1068,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
 {
        entity player = self;
 
-       if((time > player.throw_antispam) && !player.speedrunning && (!player.vehicle || autocvar_g_ctf_allow_vehicle_touch))
+       if((time > player.throw_antispam) && (player.deadflag == DEAD_NO) && !player.speedrunning && (!player.vehicle || autocvar_g_ctf_allow_vehicle_touch))
        {
                // pass the flag to a team mate
                if(autocvar_g_ctf_pass)
index a558916515e5c32069249bc19e7b169843b400b0..376be568c15de8a0bad5a618c168bdf6f0742e72 100644 (file)
@@ -46,7 +46,6 @@ void spawnfunc_ctf_team();
 // list of flags on the map
 entity ctf_worldflaglist;
 .entity ctf_worldflagnext;
-entity ctf_staleflaglist;
 .entity ctf_staleflagnext;
 
 // waypoint sprites
@@ -84,6 +83,7 @@ float wpforenemy_nextthink;
 
 // flag properties
 #define ctf_spawnorigin dropped_origin
+float ctf_stalemate; // indicates that a stalemate is active
 float ctf_captimerecord; // record time for capturing the flag
 .float ctf_pickuptime;
 .float ctf_droptime;
@@ -102,4 +102,4 @@ float ctf_captimerecord; // record time for capturing the flag
 .float ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
 float ctf_captureshield_min_negscore; // punish at -20 points
 float ctf_captureshield_max_ratio; // punish at most 30% of each team
-float ctf_captureshield_force; // push force of the shield
\ No newline at end of file
+float ctf_captureshield_force; // push force of the shield