From: Samual Lenks Date: Thu, 30 Aug 2012 19:08:18 +0000 (-0400) Subject: Fix stalemate and flag throwing while dead X-Git-Tag: xonotic-v0.7.0~240^2~72 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2e845dcc037f2a3e1a09b0eb2b32300e90b5dd55;p=xonotic%2Fxonotic-data.pk3dir.git Fix stalemate and flag throwing while dead --- diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index b82e26345..573e7610e 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -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) diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh index a55891651..376be568c 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qh +++ b/qcsrc/server/mutators/gamemode_ctf.qh @@ -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