From c4ce7ff1a5d3ed6c7f5a98d860270c3519328dc3 Mon Sep 17 00:00:00 2001 From: agrastiOs Date: Thu, 7 Mar 2024 16:40:18 +0200 Subject: [PATCH] Deprecate multiple fixes that vanilla game has fixed --- INTERNALS.md | 24 +----- README.md | 25 ------ scripting/tf2-comp-fixes.sp | 18 ----- .../tf2-comp-fixes/inhibit-extendfreeze.sp | 18 ----- .../tf2-comp-fixes/override-pipe-size.sp | 79 ------------------- updatefile.txt | 3 - 6 files changed, 1 insertion(+), 166 deletions(-) delete mode 100644 scripting/tf2-comp-fixes/inhibit-extendfreeze.sp delete mode 100644 scripting/tf2-comp-fixes/override-pipe-size.sp diff --git a/INTERNALS.md b/INTERNALS.md index 9d38bac..6c8f45e 100644 --- a/INTERNALS.md +++ b/INTERNALS.md @@ -87,7 +87,7 @@ parameter is set to true. Obviously, this applies to all mediguns, the Quick-Fix included. The Quick-Fix still benefits from the speed boost while a demoman is charging. -## Fix Ghost Crossbow Bolts & Projectiles Ignore Teammates +## Fix Projectiles Ignore Teammates The virtual method `bool CBaseProjectile::CanCollideWithTeammates(*this)` returns the field `m_bCanCollideWithTeammates` which is initialized to false and @@ -95,25 +95,3 @@ updated to true during `CollideWithTeammatesThink`. `CBaseProjectile::Spawn()` schedules this `Think` to execute after `gpGlobals->curtime + GetCollideWithTeammatesDelay()`, the latter returning 250ms by default. The file concerned is `game/shared/baseprojectile.cpp`. - -`CTFProjectile_HealingBolt` overrides `GetCollideWithTeammatesDelay` to always -return 0ms, however the projectile obviously doesn't collide with teammates as -soon as it spawns. I believe this behavior to not be expected, the intent seems -to want it collide as soon as possible but it seems that `Think`s are only -precise over a few server ticks. - -One could argue that developers were aware of the effects of both methods as -`CTFProjectile_GrapplingHook`, which is just below and shares its mother class -with `CTFProjectile_HealingBolt`, and simply overrides `CanCollideWithTeammates` -to always return false. I don't believe this to be a fair assessment. Grappling -hooks were added later on, and the only way to implement the logic to ignore -teammates would have been by overriding `CanCollideWithTeammates` (or -`CollideWithTeammatesThink`), possibly creating the need for a virtual method -altogether. In this case, as the behaviors are different and as the Crossbow's -current implementation was probably not known to be an issue, it was overlooked -and was not updated. The file concerned is -`game/server/tf/tf_projectile_arrow.cpp`. - -On entity creation, we can simply hook this virtual method to always return true -when the classname is `tf_projectile_healing_bolt`, or otherwise false if it -starts with `tf_projectile_`. diff --git a/README.md b/README.md index a9a5e4c..47b2b0b 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,11 @@ these servers. It changes cvars in bulk according to the following: | | all | fixes | none | asf | etf2l | ozf | rgl | | ---------------------------------------- | --- | ----- | ---- | --- | ----- | --- | --- | | sm_empty_active_ubercharges_when_dropped | 1 | 1 | 0 | 0 | 1 | 0 | 0 | -| sm_fix_ghost_crossbow_bolts | 1 | 1 | 0 | 0 | 1 | 1 | 1 | | sm_fix_post_pause_state | 1 | 1 | 0 | 0 | 1 | 0 | 0 | | sm_fix_reflect_self_damage | 1 | 1 | 0 | 0 | 0 | 0 | 1 | | sm_fix_slope_bug | 1 | 1 | 0 | 1 | 1 | 1 | 1 | | sm_fix_sticky_delay | 1 | 1 | 0 | 0 | 1 | 1 | 1 | | sm_inhibit_extendfreeze | 1 | 1 | 0 | 0 | 1 | 1 | 1 | -| sm_override_pipe_size | 4.0 | 4.0 | 0 | 0 | 4.0 | 4.0 | 0 | | sm_projectiles_collide_with_cylinders | 1 | 1 | 0 | 0 | 0 | 0 | 0 | | sm_projectiles_ignore_teammates | 1 | 1 | 0 | 1 | 1 | 0 | 0 | | sm_remove_halloween_souls | 1 | 1 | 0 | 0 | 1 | 1 | 1 | @@ -56,11 +54,6 @@ _Presets were updated on 2022-05-16._ This prevents the trick of swapping mediguns while ubercharged to conserve some of the charge. -- **Fix Ghost Crossbow Bolts** - - When enabled with `sm_fix_ghost_crossbow_bolts 1`, crossbow bolts will no - longer pass through teammates when in close range. - - **Revert state after unpausing** When enabled with `sm_fix_post_pause_state 1`, gameplay state that changed @@ -88,24 +81,6 @@ _Presets were updated on 2022-05-16._ When enabled with `sm_fix_sticky_delay 1`, stickies will no longer fail to detonate when swapping weapons. -- **Inhibit `extendfreeze`** - - When enabled with `sm_inhibit_extendfreeze 1`, clients will not be able to use - the `extendfreeze` command. - This prevents some information leak, players can use this command after dying - to spectate their killer in third person. - - [Demonstration of the info leak in this video](https://youtu.be/WHGVAJgHMX8?t=371) - -- **Override Pipe Collider Size** - - When enabled with `sm_override_pipe_size [1 .. ]`, all pipes will have their - collider resized to that value in Hammer Units. - The size of official pipes is 4.0, except for Iron Bomber, which is 8.75 wide - and 7.71424 tall. - - Credits for implementing go to [@bodolaz146] - - **Projectiles Collide With Cylinder Player Hitboxes** When enabled with `sm_projectiles_collide_with_cylinders 1`, projectiles will diff --git a/scripting/tf2-comp-fixes.sp b/scripting/tf2-comp-fixes.sp index 1093505..638f0f4 100644 --- a/scripting/tf2-comp-fixes.sp +++ b/scripting/tf2-comp-fixes.sp @@ -16,7 +16,6 @@ #include "tf2-comp-fixes/concede.sp" #include "tf2-comp-fixes/debug.sp" #include "tf2-comp-fixes/empty-active-ubercharges-when-dropped.sp" -#include "tf2-comp-fixes/fix-ghost-crossbow-bolts.sp" #include "tf2-comp-fixes/fix-post-pause-state.sp" #include "tf2-comp-fixes/fix-reflect-self-damage.sp" #include "tf2-comp-fixes/fix-slope-bug.sp" @@ -24,8 +23,6 @@ #include "tf2-comp-fixes/ghostify-soldier-statue.sp" #include "tf2-comp-fixes/grounded-rj-resistance.sp" #include "tf2-comp-fixes/gunboats-always-apply.sp" -#include "tf2-comp-fixes/inhibit-extendfreeze.sp" -#include "tf2-comp-fixes/override-pipe-size.sp" #include "tf2-comp-fixes/prevent-respawning.sp" #include "tf2-comp-fixes/projectiles-collide-with-cylinders.sp" #include "tf2-comp-fixes/projectiles-ignore-teammates.sp" @@ -83,7 +80,6 @@ void OnPluginStart() { // Here Concede_Setup(); EmptyActiveUberchargesWhenDropped_Setup(game_config); - FixGhostCrossbowBolts_Setup(); FixPostPauseState_Setup(); FixReflectSelfDamage_Setup(game_config); FixSlopeBug_Setup(game_config); @@ -91,8 +87,6 @@ void OnPluginStart() { GhostifySoldierStatue_Setup(); GroundedRjResistance_Setup(game_config); GunboatsAlwaysApply_Setup(game_config); - InhibitExtendfreeze_Setup(); - OverridePipeSize_Setup(game_config); PreventRespawning_Setup(game_config); ProjectilesCollideWithCylinders_Setup(game_config); ProjectilesIgnoreTeammates_Setup(); @@ -152,13 +146,10 @@ Action Command_Cf(int client, int args) { // Here ReplyToCommand(client, "--- Fixes"); ReplyDiffConVar(client, "sm_empty_active_ubercharges_when_dropped"); - ReplyDiffConVar(client, "sm_fix_ghost_crossbow_bolts"); ReplyDiffConVar(client, "sm_fix_post_pause_state"); ReplyDiffConVar(client, "sm_fix_reflect_self_damage"); ReplyDiffConVar(client, "sm_fix_slope_bug"); ReplyDiffConVar(client, "sm_fix_sticky_delay"); - ReplyDiffConVar(client, "sm_inhibit_extendfreeze"); - ReplyDiffConVar(client, "sm_override_pipe_size"); ReplyDiffConVar(client, "sm_projectiles_collide_with_cylinders"); ReplyDiffConVar(client, "sm_projectiles_ignore_teammates"); ReplyDiffConVar(client, "sm_remove_halloween_souls"); @@ -207,9 +198,6 @@ Action Command_Cf(int client, int args) { FindConVar("sm_empty_active_ubercharges_when_dropped") .SetBool(all || fixes || etf2l); - FindConVar("sm_fix_ghost_crossbow_bolts") - .SetBool(all || fixes || etf2l || ozf || rgl); - FindConVar("sm_fix_post_pause_state") .SetBool(all || fixes || etf2l); @@ -222,12 +210,6 @@ Action Command_Cf(int client, int args) { FindConVar("sm_fix_sticky_delay") .SetBool(all || fixes || etf2l || ozf || rgl); - FindConVar("sm_inhibit_extendfreeze") - .SetBool(all || fixes || etf2l || ozf || rgl); - - FindConVar("sm_override_pipe_size") - .SetFloat(all || fixes || etf2l || ozf ? 4.0 : 0.0); - FindConVar("sm_projectiles_collide_with_cylinders") .SetBool(all || fixes); diff --git a/scripting/tf2-comp-fixes/inhibit-extendfreeze.sp b/scripting/tf2-comp-fixes/inhibit-extendfreeze.sp deleted file mode 100644 index 52b1c95..0000000 --- a/scripting/tf2-comp-fixes/inhibit-extendfreeze.sp +++ /dev/null @@ -1,18 +0,0 @@ -void InhibitExtendfreeze_Setup() { CreateBoolConVar("sm_inhibit_extendfreeze", WhenConVarChange); } - -static void WhenConVarChange(ConVar cvar, const char[] before, const char[] after) { - if (cvar.BoolValue == TruthyConVar(before)) { - return; - } - - if (cvar.BoolValue) { - AddCommandListener(WhenExtendfreeze, "extendfreeze"); - } else { - RemoveCommandListener(WhenExtendfreeze, "extendfreeze"); - } -} - -static Action WhenExtendfreeze(int client, const char[] command, int argc) { - LogDebug("Inhibiting `extendfreeze` from %N", client); - return Plugin_Handled; -} diff --git a/scripting/tf2-comp-fixes/override-pipe-size.sp b/scripting/tf2-comp-fixes/override-pipe-size.sp deleted file mode 100644 index ca58a51..0000000 --- a/scripting/tf2-comp-fixes/override-pipe-size.sp +++ /dev/null @@ -1,79 +0,0 @@ -static ConVar g_cvar; - -static Handle g_call_CBaseEntity_SetCollisionBounds; -static Handle g_detour_CTFWeaponBaseGun_FirePipeBomb; - -void OverridePipeSize_Setup(Handle game_config) { - StartPrepSDKCall(SDKCall_Entity); - - if (!PrepSDKCall_SetFromConf(game_config, SDKConf_Signature, - "CBaseEntity::SetCollisionBounds")) { - SetFailState("Failed to finalize SDK call to CBaseEntity::SetCollisionBounds"); - } - - PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef); - PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef); - - g_call_CBaseEntity_SetCollisionBounds = EndPrepSDKCall(); - g_detour_CTFWeaponBaseGun_FirePipeBomb = - CheckedDHookCreateFromConf(game_config, "CTFWeaponBaseGun::FirePipeBomb"); - - g_cvar = CreateConVar("sm_override_pipe_size", "0", _, FCVAR_NOTIFY, true, 0.0, true, 1000.0); - - g_cvar.AddChangeHook(WhenConVarChange); - - CallConVarUpdateHook(g_cvar, WhenConVarChange); -} - -static void WhenConVarChange(ConVar cvar, const char[] before, const char[] after) { - if (cvar.BoolValue == TruthyConVar(before)) { - return; - } - - if (!DHookToggleDetour(g_detour_CTFWeaponBaseGun_FirePipeBomb, HOOK_POST, - Detour_CTFWeaponBaseGun_FirePipeBomb, cvar.BoolValue)) { - SetFailState("Failed to toggle detour on CTFWeaponBaseGun::FirePipeBomb"); - } -} - -static MRESReturn Detour_CTFWeaponBaseGun_FirePipeBomb(Handle hReturn, Handle hParams) { - int entity = DHookGetReturn(hReturn); - - if (entity == -1) { - return MRES_Ignored; - } - - bool cf_debug = FindConVar("sm_cf_debug").BoolValue; - if (cf_debug) { - LogDebug("Pipe collision bounds before"); - LogDebugCollisionBounds(entity); - } - - float mins[3], maxs[3], x = g_cvar.FloatValue / 2.0; - mins[0] = mins[1] = mins[2] = -x; - maxs[0] = maxs[1] = maxs[2] = x; - - SDKCall(g_call_CBaseEntity_SetCollisionBounds, entity, mins, maxs); - - if (cf_debug) { - LogDebug("Pipe collision bounds after"); - LogDebugCollisionBounds(entity); - } - - return MRES_Handled; -} - -static void LogDebugCollisionBounds(int entity) { - float mins[3], maxs[3]; - - GetEntPropVector(entity, Prop_Data, "m_vecMins", mins); - GetEntPropVector(entity, Prop_Data, "m_vecMaxs", maxs); - - // clang-format off - LogDebug( - "{ %.2f, %.2f, %.2f }, { %.2f, %.2f, %.2f }", - mins[0], mins[1], mins[2], - maxs[0], maxs[1], maxs[2] - ); - // clang-format on -} diff --git a/updatefile.txt b/updatefile.txt index df45b6d..b69e28a 100644 --- a/updatefile.txt +++ b/updatefile.txt @@ -16,7 +16,6 @@ "Source" "Path_SM/scripting/tf2-comp-fixes/concede.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/debug.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/empty-active-ubercharges-when-dropped.sp" - "Source" "Path_SM/scripting/tf2-comp-fixes/fix-ghost-crossbow-bolts.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/fix-post-pause-state.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/fix-reflect-self-damage.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/fix-slope-bug.sp" @@ -24,8 +23,6 @@ "Source" "Path_SM/scripting/tf2-comp-fixes/ghostify-soldier-statue.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/grounded-rj-resistance.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/gunboats-always-apply.sp" - "Source" "Path_SM/scripting/tf2-comp-fixes/inhibit-extendfreeze.sp" - "Source" "Path_SM/scripting/tf2-comp-fixes/override-pipe-size.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/prevent-respawning.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/projectiles-collide-with-cylinders.sp" "Source" "Path_SM/scripting/tf2-comp-fixes/projectiles-ignore-teammates.sp"