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 be3ceb9..4fe4655 100644 --- a/README.md +++ b/README.md @@ -19,15 +19,12 @@ these servers. It changes cvars in bulk according to the following: | | all | fixes | none | asf | etf2l | ozf | rgl | | ---------------------------------------- | --- | ----- | ---- | --- | ----- | --- | --- | -| sm_deterministic_fall_damage | 1 | 1 | 0 | 1 | 1 | 1 | 1 | | 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 | @@ -50,14 +47,6 @@ _Presets were updated on 2022-05-16._ #### Fixes -- **Deterministic Fall Damage** - - When enabled with `sm_deterministic_fall_damage 1`, the random variable in - fall damage calculation will be removed. - - Credits to the existing plugin - https://github.com/stephanieLGBT/tf2-FallDamageFixer - - **Empty active ubercharges when the medigun is dropped** When enabled with `sm_empty_active_ubercharges_when_dropped 1`, mediguns that @@ -65,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 @@ -97,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 @@ -206,8 +172,6 @@ Every feature is active immediately when the cvar is enabled except for features that hook short-lived entities, in which case the feature will apply if the entity was created when the feature was enabled. For now this includes: -- `sm_fix_ghost_crossbow_bolts` -- `sm_override_pipe_size` - `sm_projectiles_ignore_teammates` - `sm_remove_pipe_spin` diff --git a/scripting/tf2-comp-fixes.sp b/scripting/tf2-comp-fixes.sp index 17ce00e..638f0f4 100644 --- a/scripting/tf2-comp-fixes.sp +++ b/scripting/tf2-comp-fixes.sp @@ -15,9 +15,7 @@ // Here #include "tf2-comp-fixes/concede.sp" #include "tf2-comp-fixes/debug.sp" -#include "tf2-comp-fixes/deterministic-fall-damage.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" @@ -25,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" @@ -37,7 +33,7 @@ #include "tf2-comp-fixes/tournament-end-ignores-whitelist.sp" #include "tf2-comp-fixes/winger-jump-bonus-when-fully-deployed.sp" -#define PLUGIN_VERSION "1.16.14" +#define PLUGIN_VERSION "1.16.15" // clang-format off public @@ -83,9 +79,7 @@ void OnPluginStart() { // Here Concede_Setup(); - DeterministicFallDamage_Setup(game_config); EmptyActiveUberchargesWhenDropped_Setup(game_config); - FixGhostCrossbowBolts_Setup(); FixPostPauseState_Setup(); FixReflectSelfDamage_Setup(game_config); FixSlopeBug_Setup(game_config); @@ -93,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(); @@ -153,15 +145,11 @@ Action Command_Cf(int client, int args) { if (StrEqual(full, "list")) { // Here ReplyToCommand(client, "--- Fixes"); - ReplyDiffConVar(client, "sm_deterministic_fall_damage"); 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,15 +195,9 @@ Action Command_Cf(int client, int args) { // Here // clang-format off - FindConVar("sm_deterministic_fall_damage") - .SetBool(all || fixes || asf || etf2l || ozf || rgl); - 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); @@ -228,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/deterministic-fall-damage.sp b/scripting/tf2-comp-fixes/deterministic-fall-damage.sp deleted file mode 100644 index 29bd8c8..0000000 --- a/scripting/tf2-comp-fixes/deterministic-fall-damage.sp +++ /dev/null @@ -1,44 +0,0 @@ -// Credit to https://github.com/stephanieLGBT/tf2-FallDamageFixer - -static Handle g_detour_CTFGameRules_FlPlayerFallDamage; - -void DeterministicFallDamage_Setup(Handle game_config) { - g_detour_CTFGameRules_FlPlayerFallDamage = - CheckedDHookCreateFromConf(game_config, "CTFGameRules::FlPlayerFallDamage"); - - CreateBoolConVar("sm_deterministic_fall_damage", WhenConVarChange); -} - -static void WhenConVarChange(ConVar cvar, const char[] before, const char[] after) { - if (cvar.BoolValue == TruthyConVar(before)) { - return; - } - - if (!DHookToggleDetour(g_detour_CTFGameRules_FlPlayerFallDamage, HOOK_PRE, - Detour_CTFGameRules_FlPlayerFallDamage, cvar.BoolValue)) { - SetFailState("Failed to toggle detour on CTFGameRules::FlPlayerFallDamage"); - } -} - -static MRESReturn Detour_CTFGameRules_FlPlayerFallDamage(Address self, Handle ret, Handle params) { - int player = DHookGetParam(params, 1); - float fall_velocity = GetEntPropFloat(player, Prop_Send, "m_flFallVelocity"); - float fall_damage; - - if (fall_velocity > 650.0) { - int max_health = - GetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_iMaxHealth", _, player); - - // 5 * (fall_velocity / 300) * (max_health / 100) - fall_damage = fall_velocity * float(max_health) / 6000.0; - - LogDebug("Removing random factor (+-%.0f) from fall damage (%.0f) for player %N", - fall_damage * 0.2, fall_damage, player); - } else { - fall_damage = 0.0; - } - - DHookSetReturn(ret, fall_damage); - - return MRES_Override; -} 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 f78cf5c..b69e28a 100644 --- a/updatefile.txt +++ b/updatefile.txt @@ -15,9 +15,7 @@ "Source" "Path_SM/scripting/tf2-comp-fixes/common.sp" "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/deterministic-fall-damage.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" @@ -25,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"