Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Deterministic Fall Damage, Inhibit Extendfreeze, Ghost Crossbow Bolts, Override Pipe Size #106

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions INTERNALS.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,11 @@ 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
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_`.
36 changes: 0 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -50,26 +47,13 @@ _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
are dropped while the ubercharge is active will be emptied.
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`

Expand Down
26 changes: 1 addition & 25 deletions scripting/tf2-comp-fixes.sp
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@
// 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"
#include "tf2-comp-fixes/fix-sticky-delay.sp"
#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"
Expand All @@ -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
Expand Down Expand Up @@ -83,18 +79,14 @@ 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);
FixStickyDelay_Setup(game_config);
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();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down
44 changes: 0 additions & 44 deletions scripting/tf2-comp-fixes/deterministic-fall-damage.sp

This file was deleted.

18 changes: 0 additions & 18 deletions scripting/tf2-comp-fixes/inhibit-extendfreeze.sp

This file was deleted.

79 changes: 0 additions & 79 deletions scripting/tf2-comp-fixes/override-pipe-size.sp

This file was deleted.

4 changes: 0 additions & 4 deletions updatefile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@
"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"
"Source" "Path_SM/scripting/tf2-comp-fixes/fix-sticky-delay.sp"
"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"
Expand Down