Update content for pause event changes (#12970)
This commit is contained in:
@@ -18,6 +18,7 @@ public abstract class SharedStealthSystem : EntitySystem
|
||||
SubscribeLocalEvent<StealthOnMoveComponent, MoveEvent>(OnMove);
|
||||
SubscribeLocalEvent<StealthOnMoveComponent, GetVisibilityModifiersEvent>(OnGetVisibilityModifiers);
|
||||
SubscribeLocalEvent<StealthComponent, EntityPausedEvent>(OnPaused);
|
||||
SubscribeLocalEvent<StealthComponent, EntityUnpausedEvent>(OnUnpaused);
|
||||
SubscribeLocalEvent<StealthComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<StealthComponent, ExamineAttemptEvent>(OnExamineAttempt);
|
||||
SubscribeLocalEvent<StealthComponent, ExaminedEvent>(OnExamined);
|
||||
@@ -57,18 +58,16 @@ public abstract class SharedStealthSystem : EntitySystem
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
private void OnPaused(EntityUid uid, StealthComponent component, EntityPausedEvent args)
|
||||
private void OnPaused(EntityUid uid, StealthComponent component, ref EntityPausedEvent args)
|
||||
{
|
||||
if (args.Paused)
|
||||
{
|
||||
component.LastVisibility = GetVisibility(uid, component);
|
||||
component.LastUpdated = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
component.LastUpdated = _timing.CurTime;
|
||||
}
|
||||
component.LastVisibility = GetVisibility(uid, component);
|
||||
component.LastUpdated = null;
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
private void OnUnpaused(EntityUid uid, StealthComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
component.LastUpdated = _timing.CurTime;
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,23 +20,23 @@ public sealed class UseDelaySystem : EntitySystem
|
||||
SubscribeLocalEvent<UseDelayComponent, ComponentHandleState>(OnHandleState);
|
||||
|
||||
SubscribeLocalEvent<UseDelayComponent, EntityPausedEvent>(OnPaused);
|
||||
SubscribeLocalEvent<UseDelayComponent, EntityUnpausedEvent>(OnUnpaused);
|
||||
}
|
||||
|
||||
private void OnPaused(EntityUid uid, UseDelayComponent component, EntityPausedEvent args)
|
||||
private void OnPaused(EntityUid uid, UseDelayComponent component, ref EntityPausedEvent args)
|
||||
{
|
||||
if (args.Paused)
|
||||
{
|
||||
// This entity just got paused, but wasn't before
|
||||
if (component.DelayEndTime != null)
|
||||
component.RemainingDelay = _gameTiming.CurTime - component.DelayEndTime;
|
||||
// This entity just got paused, but wasn't before
|
||||
if (component.DelayEndTime != null)
|
||||
component.RemainingDelay = _gameTiming.CurTime - component.DelayEndTime;
|
||||
|
||||
_activeDelays.Remove(component);
|
||||
}
|
||||
else if (component.RemainingDelay == null)
|
||||
{
|
||||
// Got unpaused, but had no active delay
|
||||
_activeDelays.Remove(component);
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
private void OnUnpaused(EntityUid uid, UseDelayComponent component, ref EntityUnpausedEvent args)
|
||||
{
|
||||
if (component.RemainingDelay == null)
|
||||
return;
|
||||
}
|
||||
|
||||
// We got unpaused, resume the delay/cooldown. Currently this takes for granted that ItemCooldownComponent
|
||||
// handles the pausing on its own. I'm not even gonna check, because I CBF fixing it if it doesn't.
|
||||
|
||||
Reference in New Issue
Block a user