Tore out the old SharedLayingDownSystem and replaced all references with Wizden's crawling system

This commit is contained in:
Vanessa 2025-11-20 10:25:48 -06:00
parent e442b8d9f3
commit c77c0b5f21
18 changed files with 19 additions and 365 deletions

View File

@ -125,7 +125,7 @@ internal sealed class BuckleSystem : SharedBuckleSystem
!buckled ||
args.Sprite == null)
{
//_rotationVisualizerSystem.SetHorizontalAngle((uid, rotVisuals), rotVisuals.DefaultRotation); // WD EDIT
_rotationVisualizerSystem.SetHorizontalAngle((uid, rotVisuals), rotVisuals.DefaultRotation);
return;
}

View File

@ -34,7 +34,6 @@ namespace Content.Client.Input
common.AddFunction(ContentKeyFunctions.RotateStoredItem);
common.AddFunction(ContentKeyFunctions.SaveItemLocation);
common.AddFunction(ContentKeyFunctions.Point);
common.AddFunction(ContentKeyFunctions.ToggleStanding); // WD EDIT
common.AddFunction(ContentKeyFunctions.ZoomOut);
common.AddFunction(ContentKeyFunctions.ZoomIn);
common.AddFunction(ContentKeyFunctions.ResetZoom);

View File

@ -104,12 +104,6 @@ namespace Content.Client.Options.UI.Tabs
_cfg.SaveToFile();
}
private void HandleToggleAutoGetUp(BaseButton.ButtonToggledEventArgs args) // WD EDIT
{
_cfg.SetCVar(GoobCVars.AutoGetUp, args.Pressed);
_cfg.SaveToFile();
}
public KeyRebindTab()
{
IoCManager.InjectDependencies(this);
@ -168,8 +162,6 @@ namespace Content.Client.Options.UI.Tabs
AddButton(EngineKeyFunctions.MoveRight);
AddButton(EngineKeyFunctions.Walk);
AddCheckBox("ui-options-hotkey-toggle-walk", _cfg.GetCVar(CCVars.ToggleWalk), HandleToggleWalk);
AddButton(ContentKeyFunctions.ToggleStanding);
AddCheckBox("ui-options-function-auto-get-up", _cfg.GetCVar(GoobCVars.AutoGetUp), HandleToggleAutoGetUp); // WD EDIT
InitToggleWalk();
AddButton(ContentKeyFunctions.ToggleKnockdown);

View File

@ -1,82 +0,0 @@
using Content.Shared._White.Standing;
using Content.Shared.Buckle;
using Content.Shared.Rotation;
using Content.Shared.Standing;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Timing;
namespace Content.Client._White.Standing;
public sealed class LayingDownSystem : SharedLayingDownSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly AnimationPlayerSystem _animation = default!;
[Dependency] private readonly SharedBuckleSystem _buckle = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LayingDownComponent, MoveEvent>(OnMovementInput);
SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
}
private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveEvent args)
{
if (!_timing.IsFirstTimePredicted)
return;
if (!_standing.IsDown(uid))
return;
if (_buckle.IsBuckled(uid))
return;
if (_animation.HasRunningAnimation(uid, "rotate"))
return;
if (!TryComp<TransformComponent>(uid, out var transform)
|| !TryComp<SpriteComponent>(uid, out var sprite)
|| !TryComp<RotationVisualsComponent>(uid, out var rotationVisuals))
{
return;
}
var rotation = transform.LocalRotation + (_eyeManager.CurrentEye.Rotation - (transform.LocalRotation - transform.WorldRotation));
if (rotation.GetDir() is Direction.SouthEast or Direction.East or Direction.NorthEast or Direction.North)
{
rotationVisuals.HorizontalRotation = Angle.FromDegrees(270);
sprite.Rotation = Angle.FromDegrees(270);
return;
}
rotationVisuals.HorizontalRotation = Angle.FromDegrees(90);
sprite.Rotation = Angle.FromDegrees(90);
}
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
{
if (!_timing.IsFirstTimePredicted)
return;
var uid = GetEntity(ev.User);
if (!TryComp<TransformComponent>(uid, out var transform) || !TryComp<RotationVisualsComponent>(uid, out var rotationVisuals))
return;
var rotation = transform.LocalRotation + (_eyeManager.CurrentEye.Rotation - (transform.LocalRotation - transform.WorldRotation));
if (rotation.GetDir() is Direction.SouthEast or Direction.East or Direction.NorthEast or Direction.North)
{
rotationVisuals.HorizontalRotation = Angle.FromDegrees(270);
return;
}
rotationVisuals.HorizontalRotation = Angle.FromDegrees(90);
}
}

View File

@ -1,29 +0,0 @@
using Content.Shared._White;
using Content.Shared._White.Standing;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
using Content.Shared._Goobstation.CCVar;
namespace Content.Server.Standing;
public sealed class LayingDownSystem : SharedLayingDownSystem
{
[Dependency] private readonly INetConfigurationManager _cfg = default!;
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
}
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
{
var uid = GetEntity(ev.User);
if (!TryComp(uid, out LayingDownComponent? layingDown))
return;
layingDown.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, GoobCVars.AutoGetUp);
Dirty(uid, layingDown);
}
}

View File

@ -68,7 +68,6 @@ namespace Content.Shared.Input
public static readonly BoundKeyFunction ZoomOut = "ZoomOut";
public static readonly BoundKeyFunction ZoomIn = "ZoomIn";
public static readonly BoundKeyFunction ResetZoom = "ResetZoom";
public static readonly BoundKeyFunction ToggleStanding = "ToggleStanding"; // WD EDIT
// Shitmed Change Start
public static readonly BoundKeyFunction TargetHead = "TargetHead";

View File

@ -2,9 +2,6 @@
// if wizden ever does something to this system we're FUCKED
// regards.
using Content.Shared._White;
using Content.Shared.Buckle;
using Content.Shared.Buckle.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
@ -20,8 +17,6 @@ public sealed class StandingStateSystem : EntitySystem
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!; // WD EDIT
[Dependency] private readonly SharedBuckleSystem _buckle = default!; // WD EDIT
// If StandingCollisionLayer value is ever changed to more than one layer, the logic needs to be edited.
public const int StandingCollisionLayer = (int) CollisionGroup.MidImpassable;
@ -38,7 +33,7 @@ public sealed class StandingStateSystem : EntitySystem
private void OnMobTargetCollide(Entity<StandingStateComponent> ent, ref AttemptMobTargetCollideEvent args)
{
if (ent.Comp.CurrentState is StandingState.Lying) // DeltaV
if (!ent.Comp.Standing)
{
args.Cancelled = true;
}
@ -46,7 +41,7 @@ public sealed class StandingStateSystem : EntitySystem
private void OnMobCollide(Entity<StandingStateComponent> ent, ref AttemptMobCollideEvent args)
{
if (ent.Comp.CurrentState is StandingState.Lying) // DeltaV
if (!ent.Comp.Standing)
{
args.Cancelled = true;
}
@ -78,7 +73,7 @@ public sealed class StandingStateSystem : EntitySystem
if (!Resolve(uid, ref standingState, false))
return false;
return standingState.CurrentState is StandingState.Lying or StandingState.GettingUp;
return !standingState.Standing;
}
public bool Down(EntityUid uid, bool playSound = true, bool dropHeldItems = true,
@ -92,7 +87,7 @@ public sealed class StandingStateSystem : EntitySystem
// Optional component.
Resolve(uid, ref appearance, ref hands, false);
if (standingState.CurrentState is StandingState.Lying or StandingState.GettingUp)
if (!standingState.Standing)
return true;
// This is just to avoid most callers doing this manually saving boilerplate
@ -105,8 +100,9 @@ public sealed class StandingStateSystem : EntitySystem
RaiseLocalEvent(uid, ref ev, false);
}
if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle)) // WD EDIT
return false;
// DeltaV - Unsure if this is needed after ripping out the old laying down system. Left it in in case.
//if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle))
// return false;
var msg = new DownAttemptEvent();
RaiseLocalEvent(uid, msg, false);
@ -114,7 +110,7 @@ public sealed class StandingStateSystem : EntitySystem
if (msg.Cancelled)
return false;
standingState.CurrentState = StandingState.Lying;
standingState.Standing = false;
Dirty(uid, standingState);
RaiseLocalEvent(uid, new DownedEvent(), false);
@ -141,7 +137,6 @@ public sealed class StandingStateSystem : EntitySystem
_audio.PlayPredicted(standingState.DownSound, uid, null);
}
_movement.RefreshMovementSpeedModifiers(uid); // WD EDIT
return true;
}
@ -156,11 +151,12 @@ public sealed class StandingStateSystem : EntitySystem
// Optional component.
Resolve(uid, ref appearance, false);
if (standingState.CurrentState is StandingState.Standing)
if (standingState.Standing)
return true;
if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle)) // WD EDIT
return false;
// DeltaV - Unsure if this is needed after ripping out the old laying down system. Left it in in case.
//if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle))
// return false;
if (!force)
{
@ -170,7 +166,7 @@ public sealed class StandingStateSystem : EntitySystem
return false;
}
standingState.CurrentState = StandingState.Standing;
standingState.Standing = true;
Dirty(uid, standingState);
RaiseLocalEvent(uid, new StoodEvent(), false);
@ -184,7 +180,6 @@ public sealed class StandingStateSystem : EntitySystem
}
}
standingState.ChangedFixtures.Clear();
_movement.RefreshMovementSpeedModifiers(uid); // WD EDIT
return true;
}

View File

@ -21,8 +21,8 @@ public sealed partial class StatusEffectsSystem
SubscribeLocalEvent<StatusEffectContainerComponent, TileFrictionEvent>(RefRelayStatusEffectEvent);
// DV - We don't have the upstream crawling system
SubscribeLocalEvent<StatusEffectContainerComponent, StandUpAttemptEvent>(RefRelayStatusEffectEvent);
SubscribeLocalEvent<StatusEffectContainerComponent, StunEndAttemptEvent>(RefRelayStatusEffectEvent);
//SubscribeLocalEvent<StatusEffectContainerComponent, StandUpAttemptEvent>(RefRelayStatusEffectEvent);
//SubscribeLocalEvent<StatusEffectContainerComponent, StunEndAttemptEvent>(RefRelayStatusEffectEvent);
}
private void RefRelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, ref T args) where T : struct

View File

@ -21,7 +21,6 @@ using Robust.Shared.Audio.Systems;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Containers;
using Content.Shared._White.Standing;
using Robust.Shared.Timing;
namespace Content.Shared.Stunnable;
@ -39,9 +38,6 @@ public abstract partial class SharedStunSystem : EntitySystem
[Dependency] protected readonly SharedDoAfterSystem DoAfter = default!;
[Dependency] protected readonly SharedStaminaSystem Stamina = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffect = default!;
[Dependency] private readonly SharedLayingDownSystem _layingDown = default!; // WD EDIT
[Dependency] private readonly SharedContainerSystem _container = default!; // WD EDIT
public override void Initialize()
{
SubscribeLocalEvent<SlowedDownComponent, ComponentInit>(OnSlowInit);

View File

@ -1,5 +1,4 @@
using Content.Shared._DV.CCVars;
using Content.Shared._White.Standing;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Standing;
@ -25,7 +24,7 @@ public sealed class LayingDownCombatSystem : EntitySystem
base.Initialize();
// subscribe to LayingDownComponent instead of StandingState so it only applies to mobs that can lie down on keypress
SubscribeLocalEvent<LayingDownComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
SubscribeLocalEvent<StandingStateComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
Subs.CVar(_cfg, DCCVars.LayingDownMeleeMod, mod =>
{
@ -37,7 +36,7 @@ public sealed class LayingDownCombatSystem : EntitySystem
}, true);
}
private void OnGetMeleeDamage(Entity<LayingDownComponent> ent, ref GetMeleeDamageEvent args)
private void OnGetMeleeDamage(Entity<StandingStateComponent> ent, ref GetMeleeDamageEvent args)
{
if (!_standing.IsDown(ent))
return;

View File

@ -12,12 +12,6 @@ public sealed partial class GoobCVars
#endregion
/// <summary>
/// Should the player automatically get up after being knocked down
/// </summary>
public static readonly CVarDef<bool> AutoGetUp =
CVarDef.Create("white.auto_get_up", true, CVar.CLIENT | CVar.ARCHIVE | CVar.REPLICATED); // WD EDIT
#region Mechs
/// <summary>

View File

@ -503,7 +503,7 @@ public partial class SharedBodySystem
|| !TryComp<StandingStateComponent>(uid, out var standingState)
|| _mobState.IsCritical(uid, mobState)
|| _mobState.IsDead(uid, mobState)
|| standingState.CurrentState == StandingState.Lying)
|| !standingState.Standing)
return false;
return true;

View File

@ -1,25 +0,0 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared._White.Standing;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class LayingDownComponent : Component
{
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public float StandingUpTime { get; set; } = .5f;
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public float SpeedModify { get; set; } = .2f; // DeltaV - reduce from .4f to .2f
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public bool AutoGetUp;
}
[Serializable, NetSerializable]
public sealed class ChangeLayingDownEvent : CancellableEntityEventArgs;
[Serializable, NetSerializable]
public sealed class CheckAutoGetUpEvent(NetEntity user) : CancellableEntityEventArgs
{
public NetEntity User = user;
}

View File

@ -1,179 +0,0 @@
using Content.Shared._Shitmed.Body.Organ; // Shitmed Change
using Content.Shared.Body.Components; // Shitmed Change
using Content.Shared.DoAfter;
using Content.Shared.Gravity;
using Content.Shared.Input;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Systems;
using Content.Shared.Standing;
using Content.Shared.Stunnable;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Serialization;
namespace Content.Shared._White.Standing;
public abstract class SharedLayingDownSystem : EntitySystem
{
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
public override void Initialize()
{
CommandBinds.Builder
.Bind(ContentKeyFunctions.ToggleStanding, InputCmdHandler.FromDelegate(ToggleStanding))
.Register<SharedLayingDownSystem>();
SubscribeNetworkEvent<ChangeLayingDownEvent>(OnChangeState);
SubscribeLocalEvent<StandingStateComponent, StandingUpDoAfterEvent>(OnStandingUpDoAfter);
SubscribeLocalEvent<LayingDownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeed);
SubscribeLocalEvent<LayingDownComponent, EntParentChangedMessage>(OnParentChanged);
}
public override void Shutdown()
{
base.Shutdown();
CommandBinds.Unregister<SharedLayingDownSystem>();
}
private void ToggleStanding(ICommonSession? session)
{
if (session?.AttachedEntity == null ||
!HasComp<LayingDownComponent>(session.AttachedEntity) ||
_gravity.IsWeightless(session.AttachedEntity.Value))
{
return;
}
RaiseNetworkEvent(new ChangeLayingDownEvent());
}
private void OnChangeState(ChangeLayingDownEvent ev, EntitySessionEventArgs args)
{
if (!args.SenderSession.AttachedEntity.HasValue)
return;
var uid = args.SenderSession.AttachedEntity.Value;
// TODO: Wizard
//if (HasComp<FrozenComponent>(uid))
// return;
if (!TryComp(uid, out StandingStateComponent? standing) ||
!TryComp(uid, out LayingDownComponent? layingDown))
{
return;
}
RaiseNetworkEvent(new CheckAutoGetUpEvent(GetNetEntity(uid)));
if (HasComp<KnockedDownComponent>(uid) || !_mobState.IsAlive(uid))
return;
if (_standing.IsDown(uid, standing))
TryStandUp(uid, layingDown, standing);
else
TryLieDown(uid, layingDown, standing);
}
private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component, StandingUpDoAfterEvent args)
{
if (args.Handled || args.Cancelled || HasComp<KnockedDownComponent>(uid) ||
_mobState.IsIncapacitated(uid) || !_standing.Stand(uid))
{
component.CurrentState = StandingState.Lying;
}
component.CurrentState = StandingState.Standing;
Dirty(uid, component);
}
private void OnRefreshMovementSpeed(EntityUid uid, LayingDownComponent component, RefreshMovementSpeedModifiersEvent args)
{
if (_standing.IsDown(uid))
args.ModifySpeed(component.SpeedModify, component.SpeedModify);
else
args.ModifySpeed(1f, 1f);
}
private void OnParentChanged(EntityUid uid, LayingDownComponent component, EntParentChangedMessage args)
{
// If the entity is not on a grid, try to make it stand up to avoid issues
if (!TryComp<StandingStateComponent>(uid, out var standingState)
|| standingState.CurrentState is StandingState.Standing
|| Transform(uid).GridUid != null)
{
return;
}
_standing.Stand(uid, standingState);
}
public bool TryStandUp(EntityUid uid, LayingDownComponent? layingDown = null, StandingStateComponent? standingState = null)
{
if (!Resolve(uid, ref standingState, false) ||
!Resolve(uid, ref layingDown, false) ||
standingState.CurrentState is not StandingState.Lying ||
!_mobState.IsAlive(uid) ||
TerminatingOrDeleted(uid) ||
// Shitmed Change
!TryComp<BodyComponent>(uid, out var body) ||
body.LegEntities.Count == 0 ||
HasComp<DebrainedComponent>(uid))
return false;
// Begin DeltaV Addition
// Don't allow users to start trying to stand if they couldn't stand anyway
var msg = new StandAttemptEvent();
RaiseLocalEvent(uid, msg, false);
if (msg.Cancelled)
return false;
// End DeltaV Addition
var args = new DoAfterArgs(EntityManager, uid, layingDown.StandingUpTime, new StandingUpDoAfterEvent(), uid)
{
BreakOnHandChange = false,
RequireCanInteract = false
};
if (!_doAfter.TryStartDoAfter(args))
return false;
standingState.CurrentState = StandingState.GettingUp;
Dirty(uid, standingState);
return true;
}
public bool TryLieDown(EntityUid uid, LayingDownComponent? layingDown = null, StandingStateComponent? standingState = null, DropHeldItemsBehavior behavior = DropHeldItemsBehavior.NoDrop)
{
if (!Resolve(uid, ref standingState, false) ||
!Resolve(uid, ref layingDown, false) ||
standingState.CurrentState is not StandingState.Standing)
{
if (behavior == DropHeldItemsBehavior.AlwaysDrop)
{
var ev = new DropHandItemsEvent();
RaiseLocalEvent(uid, ref ev);
}
return false;
}
_standing.Down(uid, true, behavior != DropHeldItemsBehavior.NoDrop, standingState);
return true;
}
}
[Serializable, NetSerializable]
public sealed partial class StandingUpDoAfterEvent : SimpleDoAfterEvent;
public enum DropHeldItemsBehavior : byte
{
NoDrop,
DropIfStanding,
AlwaysDrop
}

View File

@ -229,7 +229,6 @@
- AnomalyHost
- type: PotentialPsionic # DeltaV - organic species can all be psionic
- type: FootPrints # DeltaV port from EE, blood splatter
- type: LayingDown # WD EDIT
- type: Targeting # Shitmed Change
- type: SurgeryTarget # Shitmed Change
- type: CosmicCenserTarget # DeltaV - Cosmic Cult
@ -304,7 +303,6 @@
Asphyxiation: -1.0
- type: FireVisuals
alternateState: Standing
- type: LayingDown # WD EDIT
#- type: StunVisuals # DeltaV - disabled stun visuals for now
- type: CanDoCPR # DeltaV - Addition of CPR

View File

@ -185,7 +185,6 @@
- type: Vocal
sounds:
Unsexed: MobDog
- type: LayingDown
- type: RotationVisuals
defaultRotation: 90
horizontalRotation: 90

View File

@ -59,7 +59,6 @@
- type: Temperature
heatDamageThreshold: 315 # 10 lower than base
coldDamageThreshold: 240 # 20 lower than base
- type: LayingDown
- type: Grappler
handDisabling: SingleActive
grapplingPart: grapple-part-jaws

View File

@ -317,7 +317,6 @@
- type: Carriable
- type: Targeting
- type: SurgeryTarget
- type: LayingDown
- type: Fiber # DeltaV - IPCs leave fibers instead of prints
fiberMaterial: fibers-steel
- type: Anesthesia # DeltaV - IPCs can be operated on without anesthesia