Set the generator forcefield's size to 20% larger than the generator's hitbox rather...
authorMario <mario.mario@y7mail.com>
Mon, 3 Aug 2020 10:53:26 +0000 (20:53 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 3 Aug 2020 10:53:26 +0000 (20:53 +1000)
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc

index 375edaf..1c87e9a 100644 (file)
@@ -89,14 +89,14 @@ void ons_CaptureShield_Reset(entity this)
        this.team = this.enemy.team;
 }
 
-void ons_CaptureShield_Spawn(entity generator, bool is_generator)
+void ons_CaptureShield_Spawn(entity this, Model shield_model)
 {
        entity shield = new(ons_captureshield);
        IL_PUSH(g_onsshields, shield);
 
-       shield.enemy = generator;
-       shield.team = generator.team;
-       shield.colormap = generator.colormap;
+       shield.enemy = this;
+       shield.team = this.team;
+       shield.colormap = this.colormap;
        shield.reset = ons_CaptureShield_Reset;
        settouch(shield, ons_CaptureShield_Touch);
        setcefc(shield, ons_CaptureShield_Customize);
@@ -104,13 +104,12 @@ void ons_CaptureShield_Spawn(entity generator, bool is_generator)
        set_movetype(shield, MOVETYPE_NOCLIP);
        shield.solid = SOLID_TRIGGER;
        shield.avelocity = '7 0 11';
-       shield.scale = 1;
-       shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3");
+       shield.scale = this.scale;
 
-       precache_model(shield.model);
-       setorigin(shield, generator.origin);
-       _setmodel(shield, shield.model);
-       setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs);
+       float shield_extra_size = 1.20; // hitbox is 20% larger than the object itself
+       setorigin(shield, this.origin);
+       setmodel(shield, shield_model);
+       setsize(shield, shield_extra_size * this.mins, shield_extra_size * this.maxs);
 }
 
 
@@ -765,7 +764,7 @@ void ons_DelayedControlPoint_Setup(entity this)
        onslaught_updatelinks();
 
        // captureshield setup
-       ons_CaptureShield_Spawn(this, false);
+       ons_CaptureShield_Spawn(this, MDL_ONS_CP_SHIELD);
 
        CSQCMODEL_AUTOINIT(this);
 }
@@ -1048,7 +1047,7 @@ void ons_DelayedGeneratorSetup(entity this)
        this.bot_basewaypoint = this.nearestwaypoint;
 
        // captureshield setup
-       ons_CaptureShield_Spawn(this, true);
+       ons_CaptureShield_Spawn(this, MDL_ONS_GEN_SHIELD);
 
        onslaught_updatelinks();