Fix actions not being usable, ordering, and containers (#19964)

This commit is contained in:
DrSmugleaf
2023-09-09 16:14:17 -07:00
committed by GitHub
parent 7b41f7451c
commit 09bce85f19
21 changed files with 166 additions and 119 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Actions;
using Content.Shared.Bed.Sleep;
using Content.Shared.Eye.Blinding.Systems;
using Content.Shared.Speech;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
@@ -10,6 +11,7 @@ namespace Content.Server.Bed.Sleep
public abstract class SharedSleepingSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly BlindableSystem _blindableSystem = default!;
@@ -19,7 +21,6 @@ namespace Content.Server.Bed.Sleep
{
base.Initialize();
SubscribeLocalEvent<SleepingComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<SleepingComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<SleepingComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<SleepingComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<SleepingComponent, CanSeeAttemptEvent>(OnSeeAttempt);
@@ -37,10 +38,10 @@ namespace Content.Server.Bed.Sleep
var ev = new SleepStateChangedEvent(true);
RaiseLocalEvent(uid, ev);
_blindableSystem.UpdateIsBlind(uid);
}
private void OnMapInit(EntityUid uid, SleepingComponent component, MapInitEvent args)
{
if (_net.IsClient)
return;
component.WakeAction = Spawn(WakeActionId);
_actionsSystem.SetCooldown(component.WakeAction, _gameTiming.CurTime, _gameTiming.CurTime + TimeSpan.FromSeconds(15));
_actionsSystem.AddAction(uid, component.WakeAction.Value, null);