From 633196876850f9106838d2b9f43e30d04a40abaf Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 3 Aug 2020 20:53:26 +1000 Subject: [PATCH] Set the generator forcefield's size to 20% larger than the generator's hitbox rather than the forcefield model's size, fixes #2480 --- .../gamemode/onslaught/sv_onslaught.qc | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 375edafb4..1c87e9af6 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -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(); -- 2.39.2