More ent storage ref (#19693)
This commit is contained in:
@@ -43,22 +43,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
|
||||
public const string ContainerName = "entity_storage";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, ComponentStartup>(OnComponentStartup);
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, ActivateInWorldEvent>(OnInteract, after: new[] { typeof(LockSystem) });
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, DestructionEventArgs>(OnDestruction);
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, GetVerbsEvent<InteractionVerb>>(AddToggleOpenVerb);
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, ContainerRelayMovementEntityEvent>(OnRelayMovement);
|
||||
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<SharedEntityStorageComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, SharedEntityStorageComponent component, ref ComponentGetState args)
|
||||
protected void OnGetState(EntityUid uid, SharedEntityStorageComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new EntityStorageComponentState(component.Open,
|
||||
component.Capacity,
|
||||
@@ -68,7 +53,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
component.IsWeldedShut);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, SharedEntityStorageComponent component, ref ComponentHandleState args)
|
||||
protected void OnHandleState(EntityUid uid, SharedEntityStorageComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not EntityStorageComponentState state)
|
||||
return;
|
||||
@@ -92,7 +77,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
_appearance.SetData(uid, StorageVisuals.Open, component.Open);
|
||||
}
|
||||
|
||||
private void OnInteract(EntityUid uid, SharedEntityStorageComponent component, ActivateInWorldEvent args)
|
||||
protected void OnInteract(EntityUid uid, SharedEntityStorageComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
@@ -103,7 +88,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
|
||||
public abstract bool ResolveStorage(EntityUid uid, [NotNullWhen(true)] ref SharedEntityStorageComponent? component);
|
||||
|
||||
private void OnLockToggleAttempt(EntityUid uid, SharedEntityStorageComponent target, ref LockToggleAttemptEvent args)
|
||||
protected void OnLockToggleAttempt(EntityUid uid, SharedEntityStorageComponent target, ref LockToggleAttemptEvent args)
|
||||
{
|
||||
// Cannot (un)lock open lockers.
|
||||
if (target.Open)
|
||||
@@ -114,7 +99,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnDestruction(EntityUid uid, SharedEntityStorageComponent component, DestructionEventArgs args)
|
||||
protected void OnDestruction(EntityUid uid, SharedEntityStorageComponent component, DestructionEventArgs args)
|
||||
{
|
||||
component.Open = true;
|
||||
Dirty(component);
|
||||
@@ -130,7 +115,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRelayMovement(EntityUid uid, SharedEntityStorageComponent component, ref ContainerRelayMovementEntityEvent args)
|
||||
protected void OnRelayMovement(EntityUid uid, SharedEntityStorageComponent component, ref ContainerRelayMovementEntityEvent args)
|
||||
{
|
||||
if (!HasComp<HandsComponent>(args.Entity))
|
||||
return;
|
||||
@@ -145,7 +130,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void AddToggleOpenVerb(EntityUid uid, SharedEntityStorageComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||
protected void AddToggleOpenVerb(EntityUid uid, SharedEntityStorageComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||
{
|
||||
if (!args.CanAccess || !args.CanInteract)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user