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
This commit is contained in:
metalgearsloth
2025-04-05 02:14:04 +11:00
committed by GitHub
parent 593804b517
commit b501026dcd
3 changed files with 10 additions and 27 deletions

View File

@@ -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;
/// <summary>
/// Temporary command to enable admins to toggle the mob collision cvar.
/// </summary>
[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));
}
}

View File

@@ -1,3 +1,5 @@
using Content.Shared.Administration;
using Content.Shared.CCVar.CVarAccess;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
namespace Content.Shared.CCVar; namespace Content.Shared.CCVar;
@@ -7,24 +9,28 @@ public sealed partial class CCVars
/// <summary> /// <summary>
/// Is mob pushing enabled. /// Is mob pushing enabled.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<bool> MovementMobPushing = public static readonly CVarDef<bool> MovementMobPushing =
CVarDef.Create("movement.mob_pushing", false, CVar.SERVER | CVar.REPLICATED); CVarDef.Create("movement.mob_pushing", false, CVar.SERVER | CVar.REPLICATED);
/// <summary> /// <summary>
/// Can we push mobs not moving. /// Can we push mobs not moving.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<bool> MovementPushingStatic = public static readonly CVarDef<bool> MovementPushingStatic =
CVarDef.Create("movement.pushing_static", true, CVar.SERVER | CVar.REPLICATED); CVarDef.Create("movement.pushing_static", true, CVar.SERVER | CVar.REPLICATED);
/// <summary> /// <summary>
/// Dot product for the pushed entity's velocity to a target entity's velocity before it gets moved. /// Dot product for the pushed entity's velocity to a target entity's velocity before it gets moved.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<float> MovementPushingVelocityProduct = public static readonly CVarDef<float> MovementPushingVelocityProduct =
CVarDef.Create("movement.pushing_velocity_product", 0.0f, CVar.SERVER | CVar.REPLICATED); CVarDef.Create("movement.pushing_velocity_product", -1f, CVar.SERVER | CVar.REPLICATED);
/// <summary> /// <summary>
/// Cap for how much an entity can be pushed per second. /// Cap for how much an entity can be pushed per second.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<float> MovementPushingCap = public static readonly CVarDef<float> MovementPushingCap =
CVarDef.Create("movement.pushing_cap", 100f, CVar.SERVER | CVar.REPLICATED); 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. /// 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. /// This is an optimisation to avoid pushing small values that won't actually move the mobs.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<float> MovementMinimumPush = public static readonly CVarDef<float> MovementMinimumPush =
CVarDef.Create("movement.minimum_push", 0.1f, CVar.SERVER | CVar.REPLICATED); CVarDef.Create("movement.minimum_push", 0.1f, CVar.SERVER | CVar.REPLICATED);
@@ -39,12 +46,14 @@ public sealed partial class CCVars
/// <summary> /// <summary>
/// Penetration depth cap for considering mob collisions. /// Penetration depth cap for considering mob collisions.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<float> MovementPenetrationCap = public static readonly CVarDef<float> MovementPenetrationCap =
CVarDef.Create("movement.penetration_cap", 0.3f, CVar.SERVER | CVar.REPLICATED); CVarDef.Create("movement.penetration_cap", 0.3f, CVar.SERVER | CVar.REPLICATED);
/// <summary> /// <summary>
/// Based on the mass difference multiplies the push amount by this proportionally. /// Based on the mass difference multiplies the push amount by this proportionally.
/// </summary> /// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<float> MovementPushMassCap = public static readonly CVarDef<float> MovementPushMassCap =
CVarDef.Create("movement.push_mass_cap", 1.75f, CVar.SERVER | CVar.REPLICATED); CVarDef.Create("movement.push_mass_cap", 1.75f, CVar.SERVER | CVar.REPLICATED);
} }

View File

@@ -65,7 +65,6 @@
- type: Damageable - type: Damageable
damageContainer: Inorganic damageContainer: Inorganic
damageModifierSet: Metallic damageModifierSet: Metallic
- type: MobCollision
- type: Physics - type: Physics
bodyType: Dynamic bodyType: Dynamic
- type: Fixtures - type: Fixtures
@@ -75,7 +74,6 @@
!type:PhysShapeAabb !type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25" bounds: "-0.25,-0.25,0.25,0.25"
density: 190 density: 190
hard: false
mask: mask:
- SmallMobMask - SmallMobMask
layer: layer: