From 1df15d453a9f3f4b7e02fd1d79ede49010cfb06c Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 13 Dec 2016 16:44:28 +0100 Subject: [PATCH 1/1] CTF: rename an entity field; remove some redundant code --- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 24 ++++++------------- qcsrc/server/mutators/mutator/gamemode_ctf.qh | 2 +- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 8120e1cb34..b8b375c68a 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -871,9 +871,7 @@ void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage if(ITEM_DAMAGE_NEEDKILL(deathtype)) { if(autocvar_g_ctf_flag_return_damage_delay) - { - this.ctf_flagdamaged = true; - } + this.ctf_flagdamaged_byworld = true; else { this.health = 0; @@ -906,17 +904,7 @@ void ctf_FlagThink(entity this) LOG_TRACE("wtf the flag got squashed?"); tracebox(this.origin, CTF_FLAG.m_mins, CTF_FLAG.m_maxs, this.origin, MOVE_NOMONSTERS, this); if(!trace_startsolid || this.noalign) // can we resize it without getting stuck? - setsize(this, CTF_FLAG.m_mins, CTF_FLAG.m_maxs); } - - switch(this.ctf_status) // reset flag angles in case warpzones adjust it - { - case FLAG_DROPPED: - { - this.angles = '0 0 0'; - break; - } - - default: break; + setsize(this, CTF_FLAG.m_mins, CTF_FLAG.m_maxs); } // main think method @@ -937,6 +925,8 @@ void ctf_FlagThink(entity this) case FLAG_DROPPED: { + this.angles = '0 0 0'; // reset flag angles in case warpzones adjust it + if(autocvar_g_ctf_flag_dropped_floatinwater) { vector midpoint = ((this.absmin + this.absmax) * 0.5); @@ -960,7 +950,7 @@ void ctf_FlagThink(entity this) return; } } - if(this.ctf_flagdamaged) + if(this.ctf_flagdamaged_byworld) { this.health -= ((this.max_flag_health / autocvar_g_ctf_flag_return_damage_delay) * FLAG_THINKRATE); ctf_CheckFlagReturn(this, RETURN_NEEDKILL); @@ -1051,7 +1041,7 @@ METHOD(Flag, giveTo, bool(Flag this, entity flag, entity toucher)) flag.health = 0; ctf_CheckFlagReturn(flag, RETURN_NEEDKILL); } - if(!flag.ctf_flagdamaged) { return; } + if(!flag.ctf_flagdamaged_byworld) { return; } } int num_perteam = 0; @@ -1183,7 +1173,7 @@ void ctf_RespawnFlag(entity flag) flag.ctf_dropper = NULL; flag.ctf_pickuptime = 0; flag.ctf_droptime = 0; - flag.ctf_flagdamaged = 0; + flag.ctf_flagdamaged_byworld = false; ctf_CheckStalemate(); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qh b/qcsrc/server/mutators/mutator/gamemode_ctf.qh index 65f2937fd9..593b0bec34 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qh +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qh @@ -107,7 +107,7 @@ float ctf_captimerecord; // record time for capturing the flag .entity ctf_dropper; // don't allow spam of dropping the flag .int max_flag_health; .float next_take_time; -.bool ctf_flagdamaged; +.bool ctf_flagdamaged_byworld; int ctf_teams; // passing/throwing properties -- 2.39.2