main cult

This commit is contained in:
EnefFlow
2024-01-27 15:19:52 +03:00
committed by Aviu00
parent 6310813ce6
commit 4fab8188f0
429 changed files with 12281 additions and 9 deletions

View File

@@ -0,0 +1,34 @@
using Content.Shared.Interaction.Events;
using Content.Shared.White.Cult;
using Robust.Server.GameObjects;
using Robust.Server.Player;
namespace Content.Server.White.Cult.Structures;
public sealed class CultStructureCraftSystem : EntitySystem
{
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RunicMetalComponent, UseInHandEvent>(OnUseInHand);
}
private void OnUseInHand(EntityUid uid, RunicMetalComponent component, UseInHandEvent args)
{
if (!HasComp<CultistComponent>(args.User))
return;
if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not IPlayerSession playerSession)
return;
if (component.UserInterface != null)
{
_uiSystem.CloseUi(component.UserInterface, playerSession);
_uiSystem.OpenUi(component.UserInterface, playerSession);
}
}
}