From f0a3b2b767e24c95318566d56c3c812c2fafb538 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 14 Nov 2022 20:10:19 +1000 Subject: [PATCH] Start the dropped capture timer when the flag touches the ground rather than when it's thrown, fixes #2135 --- qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc | 7 ++++++- qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index a1e1c5990..91952b2d1 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -356,6 +356,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) flag.angles = '0 0 0'; SetResourceExplicit(flag, RES_HEALTH, flag.max_health); flag.ctf_droptime = time; + flag.ctf_landtime = 0; flag.ctf_dropper = player; flag.ctf_status = FLAG_DROPPED; @@ -473,6 +474,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype) flag.solid = SOLID_TRIGGER; flag.ctf_dropper = player; flag.ctf_droptime = time; + flag.ctf_landtime = 0; flag.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND for MOVETYPE_TOSS @@ -949,7 +951,7 @@ void ctf_FlagThink(entity this) for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext) if(tmp_entity.ctf_status == FLAG_DROPPED) if(vdist(this.origin - tmp_entity.origin, <, autocvar_g_ctf_dropped_capture_radius)) - if(time > tmp_entity.ctf_droptime + autocvar_g_ctf_dropped_capture_delay) + if((this.noalign || tmp_entity.ctf_landtime) && time > ((this.noalign) ? tmp_entity.ctf_droptime : tmp_entity.ctf_landtime) + autocvar_g_ctf_dropped_capture_delay) ctf_Handle_Capture(this, tmp_entity, CAPTURE_DROPPED); } return; @@ -958,6 +960,8 @@ void ctf_FlagThink(entity this) case FLAG_DROPPED: { this.angles = '0 0 0'; // reset flag angles in case warpzones adjust it + if(IS_ONGROUND(this) && !this.ctf_landtime) + this.ctf_landtime = time; // landtime is reset when thrown, and we don't want to restart the timer if the flag is pushed if(autocvar_g_ctf_flag_dropped_floatinwater) { @@ -1210,6 +1214,7 @@ void ctf_RespawnFlag(entity flag) flag.ctf_dropper = NULL; flag.ctf_pickuptime = 0; flag.ctf_droptime = 0; + flag.ctf_landtime = 0; flag.ctf_flagdamaged_byworld = false; navigation_dynamicgoal_unset(flag); diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh index 519cbd064..adb061809 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh @@ -135,6 +135,7 @@ bool ctf_stalemate; // indicates that a stalemate is active float ctf_captimerecord; // record time for capturing the flag .float ctf_pickuptime; .float ctf_droptime; +.float ctf_landtime; .int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally) .entity ctf_dropper; // don't allow spam of dropping the flag .float next_take_time; -- 2.39.2