From c9c8fcbb8217197b64e18c9ceeacaab2c268d0aa Mon Sep 17 00:00:00 2001 From: InsoPL Date: Tue, 26 Aug 2025 21:32:45 +0200 Subject: [PATCH] Option to disable Crawling in Cvar (#39739) --- Content.Shared/CCVar/CCVars.Movement.cs | 8 ++++++++ Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Content.Shared/CCVar/CCVars.Movement.cs b/Content.Shared/CCVar/CCVars.Movement.cs index 37e355b032..96ceada099 100644 --- a/Content.Shared/CCVar/CCVars.Movement.cs +++ b/Content.Shared/CCVar/CCVars.Movement.cs @@ -56,4 +56,12 @@ public sealed partial class CCVars [CVarControl(AdminFlags.VarEdit)] public static readonly CVarDef MovementPushMassCap = CVarDef.Create("movement.push_mass_cap", 1.75f, CVar.SERVER | CVar.REPLICATED); + + /// + /// Is crawling enabled + /// + [CVarControl(AdminFlags.VarEdit)] + public static readonly CVarDef MovementCrawling = + CVarDef.Create("movement.crawling", true, CVar.SERVER | CVar.REPLICATED); + } diff --git a/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs b/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs index 1a7bc88ec3..3ab4791269 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs @@ -1,5 +1,6 @@ -using Content.Shared.Alert; +using Content.Shared.Alert; using Content.Shared.Buckle.Components; +using Content.Shared.CCVar; using Content.Shared.Damage; using Content.Shared.Damage.Components; using Content.Shared.Database; @@ -13,6 +14,7 @@ using Content.Shared.Popups; using Content.Shared.Rejuvenate; using Content.Shared.Standing; using Robust.Shared.Audio; +using Robust.Shared.Configuration; using Robust.Shared.Input.Binding; using Robust.Shared.Physics; using Robust.Shared.Physics.Systems; @@ -33,6 +35,7 @@ public abstract partial class SharedStunSystem [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly StandingStateSystem _standingState = default!; + [Dependency] private readonly IConfigurationManager _cfgManager = default!; public static readonly ProtoId KnockdownAlert = "Knockdown"; @@ -238,7 +241,7 @@ public abstract partial class SharedStunSystem private void ToggleKnockdown(Entity entity) { // We resolve here instead of using TryCrawling to be extra sure someone without crawler can't stand up early. - if (!Resolve(entity, ref entity.Comp1, false)) + if (!Resolve(entity, ref entity.Comp1, false) || !_cfgManager.GetCVar(CCVars.MovementCrawling)) return; if (!Resolve(entity, ref entity.Comp2, false)) @@ -263,7 +266,7 @@ public abstract partial class SharedStunSystem if (!KnockdownOver((entity, entity.Comp))) return false; - if (!_crawlerQuery.TryComp(entity, out var crawler)) + if (!_crawlerQuery.TryComp(entity, out var crawler) || !_cfgManager.GetCVar(CCVars.MovementCrawling)) { // If we can't crawl then just have us sit back up... // In case you're wondering, the KnockdownOverCheck, returns if we're able to move, so if next update is null.