Невозможность использования снаряжения культистов

This commit is contained in:
Aviu00
2024-01-28 08:05:01 +03:00
parent e81367d2d0
commit 467dd23bf0
14 changed files with 78 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
using Content.Shared.Ghost;
using Content.Shared.Item;
using Content.Shared.Popups;
using Content.Shared.White.Cult.Components;
namespace Content.Shared.White.Cult.Systems;
public sealed class CultItemSystem : EntitySystem
{
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CultItemComponent, GettingPickedUpAttemptEvent>(OnHandPickUp);
}
private void OnHandPickUp(EntityUid uid, CultItemComponent component, GettingPickedUpAttemptEvent args)
{
if (HasComp<CultistComponent>(args.User) || HasComp<GhostComponent>(args.User))
return;
args.Cancel();
_transform.AttachToGridOrMap(uid);
_popupSystem.PopupClient(Loc.GetString("cult-item-component-not-cultist", ("name", Name(uid))), uid, args.User);
}
}