From b501026dcda092e88aaf5a5745e5b6dc2f9922db Mon Sep 17 00:00:00 2001
From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Sat, 5 Apr 2025 02:14:04 +1100
Subject: [PATCH] Mob collision tweaks (#36296)
* Mob collision tweaks
- Remove the dot product default so moving also pops it.
- Cleanup the cvars so admins can adjust
* Gas canister revert
---
.../Commands/ToggleMobCollisionCommand.cs | 24 -------------------
Content.Shared/CCVar/CCVars.Movement.cs | 11 ++++++++-
.../Storage/Canisters/gas_canisters.yml | 2 --
3 files changed, 10 insertions(+), 27 deletions(-)
delete mode 100644 Content.Server/Movement/Commands/ToggleMobCollisionCommand.cs
diff --git a/Content.Server/Movement/Commands/ToggleMobCollisionCommand.cs b/Content.Server/Movement/Commands/ToggleMobCollisionCommand.cs
deleted file mode 100644
index 8276291cb8..0000000000
--- a/Content.Server/Movement/Commands/ToggleMobCollisionCommand.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Content.Server.Administration;
-using Content.Shared.Administration;
-using Content.Shared.CCVar;
-using Robust.Shared.Configuration;
-using Robust.Shared.Console;
-
-namespace Content.Server.Movement.Commands;
-
-///
-/// Temporary command to enable admins to toggle the mob collision cvar.
-///
-[AdminCommand(AdminFlags.VarEdit)]
-public sealed class ToggleMobCollisionCommand : IConsoleCommand
-{
- [Dependency] private readonly IConfigurationManager _cfgManager = default!;
-
- public string Command => "toggle_mob_collision";
- public string Description => "Toggles mob collision";
- public string Help => Description;
- public void Execute(IConsoleShell shell, string argStr, string[] args)
- {
- _cfgManager.SetCVar(CCVars.MovementMobPushing, !_cfgManager.GetCVar(CCVars.MovementMobPushing));
- }
-}
diff --git a/Content.Shared/CCVar/CCVars.Movement.cs b/Content.Shared/CCVar/CCVars.Movement.cs
index 539a27c100..39b9836c40 100644
--- a/Content.Shared/CCVar/CCVars.Movement.cs
+++ b/Content.Shared/CCVar/CCVars.Movement.cs
@@ -1,3 +1,5 @@
+using Content.Shared.Administration;
+using Content.Shared.CCVar.CVarAccess;
using Robust.Shared.Configuration;
namespace Content.Shared.CCVar;
@@ -7,24 +9,28 @@ public sealed partial class CCVars
///
/// Is mob pushing enabled.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementMobPushing =
CVarDef.Create("movement.mob_pushing", false, CVar.SERVER | CVar.REPLICATED);
///
/// Can we push mobs not moving.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementPushingStatic =
CVarDef.Create("movement.pushing_static", true, CVar.SERVER | CVar.REPLICATED);
///
/// Dot product for the pushed entity's velocity to a target entity's velocity before it gets moved.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementPushingVelocityProduct =
- CVarDef.Create("movement.pushing_velocity_product", 0.0f, CVar.SERVER | CVar.REPLICATED);
+ CVarDef.Create("movement.pushing_velocity_product", -1f, CVar.SERVER | CVar.REPLICATED);
///
/// Cap for how much an entity can be pushed per second.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementPushingCap =
CVarDef.Create("movement.pushing_cap", 100f, CVar.SERVER | CVar.REPLICATED);
@@ -32,6 +38,7 @@ public sealed partial class CCVars
/// Minimum pushing impulse per tick. If the value is below this it rounds to 0.
/// This is an optimisation to avoid pushing small values that won't actually move the mobs.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementMinimumPush =
CVarDef.Create("movement.minimum_push", 0.1f, CVar.SERVER | CVar.REPLICATED);
@@ -39,12 +46,14 @@ public sealed partial class CCVars
///
/// Penetration depth cap for considering mob collisions.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementPenetrationCap =
CVarDef.Create("movement.penetration_cap", 0.3f, CVar.SERVER | CVar.REPLICATED);
///
/// Based on the mass difference multiplies the push amount by this proportionally.
///
+ [CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef MovementPushMassCap =
CVarDef.Create("movement.push_mass_cap", 1.75f, CVar.SERVER | CVar.REPLICATED);
}
diff --git a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml
index 12b3261dfa..33c4dfbe17 100644
--- a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml
+++ b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml
@@ -65,7 +65,6 @@
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Metallic
- - type: MobCollision
- type: Physics
bodyType: Dynamic
- type: Fixtures
@@ -75,7 +74,6 @@
!type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25"
density: 190
- hard: false
mask:
- SmallMobMask
layer: