forked from wylab/wylab-station-14
revert: remove Sleep on Buckle feature (requires wl-specific StandingStateComponent)
This feature depends on StandingStateComponent.SleepAction which doesn't exist in wylab. Removing instead of modifying base components. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._WL.Sleep;
|
||||
|
||||
/// <summary>
|
||||
/// Allows entities buckled to this strap to sleep.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class SleepOnBuckleComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The sleep action entity that will be granted to buckled entities.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public EntityUid? SleepAction;
|
||||
|
||||
/// <summary>
|
||||
/// Who unbuckle entity
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public EntityUid? User;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Standing;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
|
||||
namespace Content.Shared._WL.Sleep;
|
||||
|
||||
public sealed class SleepOnBuckleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ActionContainerSystem _actConts = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly SleepingSystem _sleepingSystem = default!;
|
||||
[Dependency] protected readonly StandingStateSystem _standing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SleepOnBuckleComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<SleepOnBuckleComponent, StrappedEvent>(OnStrapped);
|
||||
SubscribeLocalEvent<SleepOnBuckleComponent, UnstrappedEvent>(OnUnstrapped);
|
||||
SubscribeLocalEvent<SleepOnBuckleComponent, UnstrapAttemptEvent>(OnUnstrapAttempt);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<SleepOnBuckleComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
_actConts.EnsureAction(ent.Owner, ref ent.Comp.SleepAction, SleepingSystem.SleepActionId);
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
private void OnStrapped(Entity<SleepOnBuckleComponent> ent, ref StrappedEvent args)
|
||||
{
|
||||
// WL-wylab: Removed StandingStateComponent.SleepAction cleanup (wylab doesn't have that property)
|
||||
_actionsSystem.AddAction(args.Buckle, ref ent.Comp.SleepAction, SleepingSystem.SleepActionId, ent);
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
private void OnUnstrapped(Entity<SleepOnBuckleComponent> ent, ref UnstrappedEvent args)
|
||||
{
|
||||
if (!Terminating(args.Buckle.Owner))
|
||||
{
|
||||
_actionsSystem.RemoveAction(args.Buckle.Owner, ent.Comp.SleepAction);
|
||||
_sleepingSystem.TryWaking(args.Buckle.Owner);
|
||||
|
||||
if (ent.Comp.User == args.Buckle.Owner)
|
||||
{
|
||||
RemComp<KnockedDownComponent>(args.Buckle.Owner);
|
||||
RemComp<StunnedComponent>(args.Buckle.Owner);
|
||||
|
||||
_standing.Stand(args.Buckle.Owner, force: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUnstrapAttempt(Entity<SleepOnBuckleComponent> ent, ref UnstrapAttemptEvent args)
|
||||
{
|
||||
ent.Comp.User = args.User;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user