move lockcomponent to shared (#13722)
* move lockcomponent to shared * ajcm review
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
using System.Threading;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Server.Lock;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Resist;
|
||||
using Content.Server.Station.Components;
|
||||
@@ -10,6 +9,8 @@ using Content.Server.Storage.Components;
|
||||
using Content.Server.Tools.Systems;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Coordinates;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -58,7 +59,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
||||
Spawn(effectSourceComponent.BehaviorProperties.BluespaceEffectPrototype, effectTargetUid.ToCoordinates());
|
||||
}
|
||||
|
||||
private void PreOpen(EntityUid uid, BluespaceLockerComponent component, StorageBeforeOpenEvent args)
|
||||
private void PreOpen(EntityUid uid, BluespaceLockerComponent component, ref StorageBeforeOpenEvent args)
|
||||
{
|
||||
EntityStorageComponent? entityStorageComponent = null;
|
||||
int transportedEntities = 0;
|
||||
@@ -259,7 +260,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void PostClose(EntityUid uid, BluespaceLockerComponent component, StorageAfterCloseEvent args)
|
||||
private void PostClose(EntityUid uid, BluespaceLockerComponent component, ref StorageAfterCloseEvent args)
|
||||
{
|
||||
PostClose(uid, component);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using System.Linq;
|
||||
using Content.Shared.Storage.Components;
|
||||
|
||||
namespace Content.Server.Storage.EntitySystems;
|
||||
|
||||
@@ -21,7 +20,7 @@ public sealed class CursedEntityStorageSystem : EntitySystem
|
||||
SubscribeLocalEvent<CursedEntityStorageComponent, StorageAfterCloseEvent>(OnClose);
|
||||
}
|
||||
|
||||
private void OnClose(EntityUid uid, CursedEntityStorageComponent component, StorageAfterCloseEvent args)
|
||||
private void OnClose(EntityUid uid, CursedEntityStorageComponent component, ref StorageAfterCloseEvent args)
|
||||
{
|
||||
if (!TryComp<EntityStorageComponent>(uid, out var storage))
|
||||
return;
|
||||
|
||||
@@ -10,8 +10,10 @@ using Content.Shared.Destructible;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Wall;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Server.Containers;
|
||||
@@ -20,7 +22,6 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Storage.EntitySystems;
|
||||
|
||||
@@ -167,13 +168,15 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
RaiseLocalEvent(uid, new StorageBeforeOpenEvent());
|
||||
var beforeev = new StorageBeforeOpenEvent();
|
||||
RaiseLocalEvent(uid, ref beforeev);
|
||||
component.Open = true;
|
||||
EmptyContents(uid, component);
|
||||
ModifyComponents(uid, component);
|
||||
_audio.PlayPvs(component.OpenSound, component.Owner);
|
||||
_audio.PlayPvs(component.OpenSound, uid);
|
||||
ReleaseGas(uid, component);
|
||||
RaiseLocalEvent(uid, new StorageAfterOpenEvent());
|
||||
var afterev = new StorageAfterOpenEvent();
|
||||
RaiseLocalEvent(uid, ref afterev);
|
||||
}
|
||||
|
||||
public void CloseStorage(EntityUid uid, EntityStorageComponent? component = null)
|
||||
@@ -186,8 +189,8 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
|
||||
var entities = _lookup.GetEntitiesInRange(targetCoordinates, component.EnteringRange, LookupFlags.Approximate | LookupFlags.Dynamic | LookupFlags.Sundries);
|
||||
|
||||
var ev = new StorageBeforeCloseEvent(entities);
|
||||
RaiseLocalEvent(uid, ev);
|
||||
var ev = new StorageBeforeCloseEvent(entities, new());
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
var count = 0;
|
||||
foreach (var entity in ev.Contents)
|
||||
{
|
||||
@@ -207,9 +210,10 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
|
||||
TakeGas(uid, component);
|
||||
ModifyComponents(uid, component);
|
||||
_audio.PlayPvs(component.CloseSound, component.Owner);
|
||||
_audio.PlayPvs(component.CloseSound, uid);
|
||||
component.LastInternalOpenAttempt = default;
|
||||
RaiseLocalEvent(uid, new StorageAfterCloseEvent());
|
||||
var afterev = new StorageAfterCloseEvent();
|
||||
RaiseLocalEvent(uid, ref afterev);
|
||||
}
|
||||
|
||||
public bool Insert(EntityUid toInsert, EntityUid container, EntityStorageComponent? component = null)
|
||||
@@ -302,7 +306,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
}
|
||||
|
||||
var ev = new StorageOpenAttemptEvent(silent);
|
||||
RaiseLocalEvent(target, ev, true);
|
||||
RaiseLocalEvent(target, ref ev, true);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
@@ -310,7 +314,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
public bool CanClose(EntityUid target, bool silent = false)
|
||||
{
|
||||
var ev = new StorageCloseAttemptEvent();
|
||||
RaiseLocalEvent(target, ev, silent);
|
||||
RaiseLocalEvent(target, ref ev, silent);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
@@ -347,7 +351,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
// 6. if this is an item, then mobs must only be eaten if some other component prevents
|
||||
// pick-up interactions while a mob is inside (e.g. foldable)
|
||||
var attemptEvent = new InsertIntoEntityStorageAttemptEvent();
|
||||
RaiseLocalEvent(toInsert, attemptEvent);
|
||||
RaiseLocalEvent(toInsert, ref attemptEvent);
|
||||
if (attemptEvent.Cancelled)
|
||||
return false;
|
||||
|
||||
@@ -367,7 +371,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
else
|
||||
{
|
||||
var storeEv = new StoreMobInItemContainerAttemptEvent();
|
||||
RaiseLocalEvent(container, storeEv);
|
||||
RaiseLocalEvent(container, ref storeEv);
|
||||
allowedToEat = storeEv.Handled && !storeEv.Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Implants.Components;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Movement.Events;
|
||||
|
||||
namespace Content.Server.Storage.EntitySystems
|
||||
|
||||
Reference in New Issue
Block a user