Option to disable Crawling in Cvar (#39739)

This commit is contained in:
InsoPL
2025-08-26 21:32:45 +02:00
committed by GitHub
parent 4505f61ff2
commit c9c8fcbb82
2 changed files with 14 additions and 3 deletions

View File

@@ -56,4 +56,12 @@ public sealed partial class CCVars
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<float> MovementPushMassCap =
CVarDef.Create("movement.push_mass_cap", 1.75f, CVar.SERVER | CVar.REPLICATED);
/// <summary>
/// Is crawling enabled
/// </summary>
[CVarControl(AdminFlags.VarEdit)]
public static readonly CVarDef<bool> MovementCrawling =
CVarDef.Create("movement.crawling", true, CVar.SERVER | CVar.REPLICATED);
}

View File

@@ -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<AlertPrototype> KnockdownAlert = "Knockdown";
@@ -238,7 +241,7 @@ public abstract partial class SharedStunSystem
private void ToggleKnockdown(Entity<CrawlerComponent?, KnockedDownComponent?> 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.