From 7e3389f1cf2b461a0f050da3e32dee0b894e2d4c Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sun, 9 Apr 2023 05:01:08 +1000 Subject: [PATCH] Fix area grid linking/unlinking of triggers and gametype ents in DP master --- qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc | 8 ++++---- qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc | 2 +- qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc | 4 ++-- .../gamemodes/gamemode/onslaught/cl_controlpoint.qc | 5 ++--- qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc | 2 +- qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc | 2 +- qcsrc/lib/warpzone/util_server.qc | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index f8933bcb0..3f55143f6 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -401,6 +401,7 @@ void ctf_Handle_Retrieve(entity flag, entity player) GameRules_scoring_vip(player, true); // reset flag + flag.solid = SOLID_NOT; // before setorigin to prevent area grid linking if(player.vehicle) { setattachment(flag, player.vehicle, ""); @@ -414,7 +415,6 @@ void ctf_Handle_Retrieve(entity flag, entity player) } set_movetype(flag, MOVETYPE_NONE); flag.takedamage = DAMAGE_NO; - flag.solid = SOLID_NOT; flag.angles = '0 0 0'; flag.ctf_status = FLAG_CARRY; @@ -467,11 +467,11 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype) // reset the flag setattachment(flag, NULL, ""); tracebox(player.origin - FLAG_DROP_OFFSET, flag.m_mins, flag.m_maxs, player.origin + FLAG_DROP_OFFSET, MOVE_NOMONSTERS, flag); + flag.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking setorigin(flag, trace_endpos); flag.owner.flagcarried = NULL; GameRules_scoring_vip(flag.owner, false); flag.owner = NULL; - flag.solid = SOLID_TRIGGER; flag.ctf_dropper = player; flag.ctf_droptime = time; flag.ctf_landtime = 0; @@ -689,6 +689,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) flag.owner = player; player.flagcarried = flag; GameRules_scoring_vip(player, true); + flag.solid = SOLID_NOT; // before setorigin to prevent area grid linking if(player.vehicle) { setattachment(flag, player.vehicle, ""); @@ -704,7 +705,6 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) // flag setup set_movetype(flag, MOVETYPE_NONE); flag.takedamage = DAMAGE_NO; - flag.solid = SOLID_NOT; flag.angles = '0 0 0'; flag.ctf_status = FLAG_CARRY; @@ -1192,13 +1192,13 @@ void ctf_RespawnFlag(entity flag) // reset the flag setattachment(flag, NULL, ""); + flag.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking setorigin(flag, flag.ctf_spawnorigin); //set_movetype(flag, ((flag.noalign) ? MOVETYPE_NONE : MOVETYPE_TOSS)); // would be desired, except maps that want floating flags have it set to fall! set_movetype(flag, MOVETYPE_NONE); // match the initial setup handling (flag doesn't move when spawned) flag.takedamage = DAMAGE_NO; SetResourceExplicit(flag, RES_HEALTH, flag.max_health); - flag.solid = SOLID_TRIGGER; flag.velocity = '0 0 0'; flag.angles = flag.mangle; flag.flags = FL_ITEM | FL_NOTARGET; diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 4ad694de8..8b024dbc7 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -247,13 +247,13 @@ void ka_SpawnBall() { entity e = new(keepawayball); setmodel(e, MDL_KA_BALL); + e.solid = SOLID_TRIGGER; // before setsize to ensure area grid linking setsize(e, '-16 -16 -20', '16 16 20'); // 20 20 20 was too big, player is only 16 16 24... gotta cheat with the Z (20) axis so that the particle isn't cut off e.damageforcescale = autocvar_g_keepawayball_damageforcescale; e.takedamage = DAMAGE_YES; e.event_damage = ka_DamageEvent; e.damagedbycontents = true; IL_PUSH(g_damagedbycontents, e); - e.solid = SOLID_TRIGGER; set_movetype(e, MOVETYPE_BOUNCE); e.glow_color = autocvar_g_keepawayball_trail_color; e.glow_trail = true; diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc index 1553bf5b4..8396c1e61 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc @@ -215,6 +215,7 @@ vector kh_AttachedOrigin(entity e) // runs when a team captures the flag, it ca void kh_Key_Attach(entity key) // runs when a player picks up a key and several times when a key is assigned to a player at the start of a round { + key.solid = SOLID_NOT; // before setorigin to prevent area grid linking #ifdef KH_PLAYER_USE_ATTACHMENT entity first = key.owner.kh_next; if(key == first) @@ -248,7 +249,6 @@ void kh_Key_Attach(entity key) // runs when a player picks up a key and several key.flags = 0; if(IL_CONTAINS(g_items, key)) IL_REMOVE(g_items, key); - key.solid = SOLID_NOT; set_movetype(key, MOVETYPE_NONE); key.team = key.owner.team; key.nextthink = time; @@ -260,6 +260,7 @@ void kh_Key_Attach(entity key) // runs when a player picks up a key and several void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs several times times when all the keys are captured { + key.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking #ifdef KH_PLAYER_USE_ATTACHMENT entity first = key.owner.kh_next; if(key == first) @@ -289,7 +290,6 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs key.flags = FL_ITEM; if(!IL_CONTAINS(g_items, key)) IL_PUSH(g_items, key); - key.solid = SOLID_TRIGGER; set_movetype(key, MOVETYPE_TOSS); key.pain_finished = time + autocvar_g_balance_keyhunt_delay_return; key.damageforcescale = autocvar_g_balance_keyhunt_damageforcescale; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc index cce889f89..7694f02fb 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc @@ -108,23 +108,22 @@ void cpicon_construct(entity this, bool isnew) { this.netname = "Control Point Icon"; + this.solid = SOLID_NOT; // before setmodel/setsize to prevent area grid linking setmodel(this, MDL_ONS_CP); setsize(this, CPICON_MIN, CPICON_MAX); if(this.icon_realmodel == NULL) { this.icon_realmodel = new(cpicon_model); + this.icon_realmodel.solid = SOLID_NOT; setmodel(this.icon_realmodel, MDL_Null); setorigin(this.icon_realmodel, this.origin); setsize(this.icon_realmodel, CPICON_MIN, CPICON_MAX); set_movetype(this.icon_realmodel, MOVETYPE_NOCLIP); - this.icon_realmodel.solid = SOLID_NOT; } if(this.iscaptured) { this.icon_realmodel.solid = SOLID_BBOX; } - set_movetype(this, MOVETYPE_NOCLIP); - this.solid = SOLID_NOT; set_movetype(this, MOVETYPE_NOCLIP); this.move_time = time; this.drawmask = MASK_NORMAL; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc index 3a72c8d49..d8d28488a 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc @@ -157,10 +157,10 @@ void generator_construct(entity this, bool isnew) setorigin(this, this.origin); setmodel(this, MDL_ONS_GEN); + this.solid = SOLID_BBOX; // before setsize to ensure area grid linking setsize(this, GENERATOR_MIN, GENERATOR_MAX); set_movetype(this, MOVETYPE_NOCLIP); - this.solid = SOLID_BBOX; set_movetype(this, MOVETYPE_NOCLIP); this.move_time = time; this.drawmask = MASK_NORMAL; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 7f2def318..e48ea3464 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -601,13 +601,13 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) { entity e = new(onslaught_controlpoint_icon); + e.solid = SOLID_NOT; // before setsize/setorigin to prevent area grid linking setsize(e, CPICON_MIN, CPICON_MAX); setorigin(e, cp.origin + CPICON_OFFSET); e.owner = cp; e.max_health = autocvar_g_onslaught_cp_health; SetResourceExplicit(e, RES_HEALTH, autocvar_g_onslaught_cp_buildhealth); - e.solid = SOLID_NOT; e.takedamage = DAMAGE_AIM; e.bot_attack = true; IL_PUSH(g_bot_targets, e); diff --git a/qcsrc/lib/warpzone/util_server.qc b/qcsrc/lib/warpzone/util_server.qc index 658716052..5f1aebf49 100644 --- a/qcsrc/lib/warpzone/util_server.qc +++ b/qcsrc/lib/warpzone/util_server.qc @@ -40,11 +40,11 @@ void WarpZoneLib_ExactTrigger_Init(entity this) } } setorigin(this, this.origin); + this.solid = SOLID_TRIGGER; // before setsize to ensure area grid linking if(this.scale) setsize(this, this.mins * this.scale, this.maxs * this.scale); else setsize(this, this.mins, this.maxs); set_movetype(this, MOVETYPE_NONE); - this.solid = SOLID_TRIGGER; this.model = ""; } -- 2.39.2