predict morgue and crematorium (#39293)
This commit is contained in:
@@ -48,12 +48,12 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
|
||||
public const string ContainerName = "entity_storage";
|
||||
|
||||
protected void OnEntityUnpausedEvent(EntityUid uid, SharedEntityStorageComponent component, EntityUnpausedEvent args)
|
||||
protected void OnEntityUnpausedEvent(EntityUid uid, EntityStorageComponent component, EntityUnpausedEvent args)
|
||||
{
|
||||
component.NextInternalOpenAttempt += args.PausedTime;
|
||||
}
|
||||
|
||||
protected void OnGetState(EntityUid uid, SharedEntityStorageComponent component, ref ComponentGetState args)
|
||||
protected void OnGetState(EntityUid uid, EntityStorageComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new EntityStorageComponentState(component.Open,
|
||||
component.Capacity,
|
||||
@@ -63,7 +63,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
component.NextInternalOpenAttempt);
|
||||
}
|
||||
|
||||
protected void OnHandleState(EntityUid uid, SharedEntityStorageComponent component, ref ComponentHandleState args)
|
||||
protected void OnHandleState(EntityUid uid, EntityStorageComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not EntityStorageComponentState state)
|
||||
return;
|
||||
@@ -75,19 +75,19 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
component.NextInternalOpenAttempt = state.NextInternalOpenAttempt;
|
||||
}
|
||||
|
||||
protected virtual void OnComponentInit(EntityUid uid, SharedEntityStorageComponent component, ComponentInit args)
|
||||
protected virtual void OnComponentInit(EntityUid uid, EntityStorageComponent component, ComponentInit args)
|
||||
{
|
||||
component.Contents = _container.EnsureContainer<Container>(uid, ContainerName);
|
||||
component.Contents.ShowContents = component.ShowContents;
|
||||
component.Contents.OccludesLight = component.OccludesLight;
|
||||
}
|
||||
|
||||
protected virtual void OnComponentStartup(EntityUid uid, SharedEntityStorageComponent component, ComponentStartup args)
|
||||
protected virtual void OnComponentStartup(EntityUid uid, EntityStorageComponent component, ComponentStartup args)
|
||||
{
|
||||
_appearance.SetData(uid, StorageVisuals.Open, component.Open);
|
||||
}
|
||||
|
||||
protected void OnInteract(EntityUid uid, SharedEntityStorageComponent component, ActivateInWorldEvent args)
|
||||
protected void OnInteract(EntityUid uid, EntityStorageComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.Handled || !args.Complex)
|
||||
return;
|
||||
@@ -96,9 +96,9 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
ToggleOpen(args.User, uid, component);
|
||||
}
|
||||
|
||||
public abstract bool ResolveStorage(EntityUid uid, [NotNullWhen(true)] ref SharedEntityStorageComponent? component);
|
||||
public abstract bool ResolveStorage(EntityUid uid, [NotNullWhen(true)] ref EntityStorageComponent? component);
|
||||
|
||||
protected void OnLockToggleAttempt(EntityUid uid, SharedEntityStorageComponent target, ref LockToggleAttemptEvent args)
|
||||
protected void OnLockToggleAttempt(EntityUid uid, EntityStorageComponent target, ref LockToggleAttemptEvent args)
|
||||
{
|
||||
// Cannot (un)lock open lockers.
|
||||
if (target.Open)
|
||||
@@ -109,7 +109,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
protected void OnDestruction(EntityUid uid, SharedEntityStorageComponent component, DestructionEventArgs args)
|
||||
protected void OnDestruction(EntityUid uid, EntityStorageComponent component, DestructionEventArgs args)
|
||||
{
|
||||
component.Open = true;
|
||||
Dirty(uid, component);
|
||||
@@ -125,7 +125,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnRelayMovement(EntityUid uid, SharedEntityStorageComponent component, ref ContainerRelayMovementEntityEvent args)
|
||||
protected void OnRelayMovement(EntityUid uid, EntityStorageComponent component, ref ContainerRelayMovementEntityEvent args)
|
||||
{
|
||||
if (!HasComp<HandsComponent>(args.Entity))
|
||||
return;
|
||||
@@ -136,21 +136,21 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
if (_timing.CurTime < component.NextInternalOpenAttempt)
|
||||
return;
|
||||
|
||||
component.NextInternalOpenAttempt = _timing.CurTime + SharedEntityStorageComponent.InternalOpenAttemptDelay;
|
||||
component.NextInternalOpenAttempt = _timing.CurTime + EntityStorageComponent.InternalOpenAttemptDelay;
|
||||
Dirty(uid, component);
|
||||
|
||||
if (component.OpenOnMove)
|
||||
TryOpenStorage(args.Entity, uid);
|
||||
}
|
||||
|
||||
protected void OnFoldAttempt(EntityUid uid, SharedEntityStorageComponent component, ref FoldAttemptEvent args)
|
||||
protected void OnFoldAttempt(EntityUid uid, EntityStorageComponent component, ref FoldAttemptEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
args.Cancelled = component.Open || component.Contents.ContainedEntities.Count != 0;
|
||||
}
|
||||
|
||||
protected void AddToggleOpenVerb(EntityUid uid, SharedEntityStorageComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||
protected void AddToggleOpenVerb(EntityUid uid, EntityStorageComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||
{
|
||||
if (!args.CanAccess || !args.CanInteract)
|
||||
return;
|
||||
@@ -175,7 +175,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
}
|
||||
|
||||
|
||||
public void ToggleOpen(EntityUid user, EntityUid target, SharedEntityStorageComponent? component = null)
|
||||
public void ToggleOpen(EntityUid user, EntityUid target, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(target, ref component))
|
||||
return;
|
||||
@@ -190,7 +190,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public void EmptyContents(EntityUid uid, SharedEntityStorageComponent? component = null)
|
||||
public void EmptyContents(EntityUid uid, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(uid, ref component))
|
||||
return;
|
||||
@@ -203,7 +203,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenStorage(EntityUid uid, SharedEntityStorageComponent? component = null)
|
||||
public void OpenStorage(EntityUid uid, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(uid, ref component))
|
||||
return;
|
||||
@@ -224,7 +224,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
RaiseLocalEvent(uid, ref afterev);
|
||||
}
|
||||
|
||||
public void CloseStorage(EntityUid uid, SharedEntityStorageComponent? component = null)
|
||||
public void CloseStorage(EntityUid uid, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(uid, ref component))
|
||||
return;
|
||||
@@ -275,7 +275,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
RaiseLocalEvent(uid, ref afterev);
|
||||
}
|
||||
|
||||
public bool Insert(EntityUid toInsert, EntityUid container, SharedEntityStorageComponent? component = null)
|
||||
public bool Insert(EntityUid toInsert, EntityUid container, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(container, ref component))
|
||||
return false;
|
||||
@@ -295,7 +295,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Remove(EntityUid toRemove, EntityUid container, SharedEntityStorageComponent? component = null, TransformComponent? xform = null)
|
||||
public bool Remove(EntityUid toRemove, EntityUid container, EntityStorageComponent? component = null, TransformComponent? xform = null)
|
||||
{
|
||||
if (!Resolve(container, ref xform, false))
|
||||
return false;
|
||||
@@ -322,7 +322,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanInsert(EntityUid toInsert, EntityUid container, SharedEntityStorageComponent? component = null)
|
||||
public bool CanInsert(EntityUid toInsert, EntityUid container, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(container, ref component))
|
||||
return false;
|
||||
@@ -379,7 +379,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsOpen(EntityUid target, SharedEntityStorageComponent? component = null)
|
||||
public bool IsOpen(EntityUid target, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(target, ref component))
|
||||
return false;
|
||||
@@ -387,7 +387,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return component.Open;
|
||||
}
|
||||
|
||||
public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, SharedEntityStorageComponent? component = null)
|
||||
public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(target, ref component))
|
||||
return false;
|
||||
@@ -429,7 +429,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool AddToContents(EntityUid toAdd, EntityUid container, SharedEntityStorageComponent? component = null)
|
||||
public bool AddToContents(EntityUid toAdd, EntityUid container, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(container, ref component))
|
||||
return false;
|
||||
@@ -440,7 +440,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
return Insert(toAdd, container, component);
|
||||
}
|
||||
|
||||
private void ModifyComponents(EntityUid uid, SharedEntityStorageComponent? component = null)
|
||||
private void ModifyComponents(EntityUid uid, EntityStorageComponent? component = null)
|
||||
{
|
||||
if (!ResolveStorage(uid, ref component))
|
||||
return;
|
||||
@@ -472,12 +472,12 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
_appearance.SetData(uid, StorageVisuals.HasContents, component.Contents.ContainedEntities.Count > 0);
|
||||
}
|
||||
|
||||
protected virtual void TakeGas(EntityUid uid, SharedEntityStorageComponent component)
|
||||
protected virtual void TakeGas(EntityUid uid, EntityStorageComponent component)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ReleaseGas(EntityUid uid, SharedEntityStorageComponent component)
|
||||
public virtual void ReleaseGas(EntityUid uid, EntityStorageComponent component)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user