EntityStorage ECS (#9291)

This commit is contained in:
Nemanja
2022-07-13 19:11:59 -04:00
committed by GitHub
parent a655891a8d
commit 5edf2ccad5
46 changed files with 1057 additions and 1126 deletions

View File

@@ -20,6 +20,7 @@ namespace Content.Server.Lock
public sealed class LockSystem : EntitySystem
{
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
[Dependency] private readonly SharedPopupSystem _sharedPopupSystem = default!;
/// <inheritdoc />
public override void Initialize()
@@ -27,6 +28,7 @@ namespace Content.Server.Lock
base.Initialize();
SubscribeLocalEvent<LockComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<LockComponent, ActivateInWorldEvent>(OnActivated);
SubscribeLocalEvent<LockComponent, StorageOpenAttemptEvent>(OnStorageOpenAttempt);
SubscribeLocalEvent<LockComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<LockComponent, GetVerbsEvent<AlternativeVerb>>(AddToggleLockVerb);
SubscribeLocalEvent<LockComponent, GotEmaggedEvent>(OnEmagged);
@@ -58,6 +60,17 @@ namespace Content.Server.Lock
}
}
private void OnStorageOpenAttempt(EntityUid uid, LockComponent component, StorageOpenAttemptEvent args)
{
if (component.Locked)
{
if (!args.Silent)
_sharedPopupSystem.PopupEntity(Loc.GetString("entity-storage-component-locked-message"), uid, Filter.Pvs(uid));
args.Cancel();
}
}
private void OnExamined(EntityUid uid, LockComponent lockComp, ExaminedEvent args)
{
args.PushText(Loc.GetString(lockComp.Locked