]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Resize the flag's hitbox depending on its scale (fixes some stupid floating flags)
authorMario <mario@smbclan.net>
Fri, 3 Mar 2017 17:09:15 +0000 (03:09 +1000)
committerMario <mario@smbclan.net>
Fri, 3 Mar 2017 17:09:15 +0000 (03:09 +1000)
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qh

index 4681b0ef1641c7ba821bcbec28fcbc7737cc084a..068942b0bc05d8a1e1ff3ce5295881d89db220d6 100644 (file)
@@ -925,7 +925,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);
+                       setsize(this, CTF_FLAG.m_mins * this.scale, CTF_FLAG.m_maxs * this.scale);
        }
 
        // main think method
@@ -1317,7 +1317,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
 
        // appearence
        _setmodel(flag, flag.model); // precision set below
-       setsize(flag, CTF_FLAG.m_mins, CTF_FLAG.m_maxs);
+       setsize(flag, CTF_FLAG.m_mins * flag.scale, CTF_FLAG.m_maxs * flag.scale);
        setorigin(flag, (flag.origin + FLAG_SPAWN_OFFSET));
 
        if(autocvar_g_ctf_flag_glowtrails)
index 6dd5110fd3124b0650d03e2f90dc357641a60754..2c67372b4f6232511dcc0c50cd315a61fa1d63b8 100644 (file)
@@ -10,8 +10,8 @@ void ctf_RespawnFlag(entity flag);
 const int ST_CTF_CAPS = 1;
 
 CLASS(Flag, Pickup)
-    ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13');
-    ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13');
+    ATTRIB(Flag, m_mins, vector, (PL_MIN_CONST + '0 0 -13') * 1.4); // scaling be damned
+    ATTRIB(Flag, m_maxs, vector, (PL_MAX_CONST + '0 0 -13') * 1.4);
 ENDCLASS(Flag)
 Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
 void ctf_FlagTouch(entity this, entity toucher) { ITEM_HANDLE(Pickup, CTF_FLAG, this, toucher); }