Cult spells update (#607)

* - add: CultSystem.BloodSpells.

* - add: Cleanup.
This commit is contained in:
Aviu00
2024-08-11 10:55:01 +00:00
committed by GitHub
parent 00a58cf850
commit e14b6cb948
26 changed files with 290 additions and 72 deletions

View File

@@ -0,0 +1,53 @@
using Content.Server.EUI;
using Content.Server.Popups;
using Content.Server._White.Cult.Runes.Comps;
using Content.Server._White.Cult.Runes.Systems;
using Content.Shared._White.Cult.Components;
using Content.Shared.Eui;
using Content.Shared.Popups;
using Content.Shared._White.Cult.UI;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server._White.Cult.UI;
public sealed class CultBloodSpellsEui : BaseEui
{
private readonly IEntityManager _entityManager;
private readonly CultSystem _cult;
private readonly EntityUid _performer;
public CultBloodSpellsEui(EntityUid performer, IEntityManager entityManager)
{
_entityManager = entityManager;
_cult = _entityManager.System<CultSystem>();
_performer = performer;
}
public override void HandleMessage(EuiMessageBase msg)
{
base.HandleMessage(msg);
if (msg is not BloodSpellMessage cast || cast.State == BloodSpellMessageState.Cancel)
{
Close();
return;
}
if (!_entityManager.TryGetComponent(_performer, out CultistComponent? cultist))
{
Close();
return;
}
if (cast.State == BloodSpellMessageState.Create)
_cult.CreateSpell((_performer, cultist), Player);
else if (cast.State == BloodSpellMessageState.Remove)
_cult.RemoveSpell((_performer, cultist), Player);
Close();
}
}

View File

@@ -0,0 +1,21 @@
using Content.Server.EUI;
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Shared.Player;
namespace Content.Server._White.Cult.UI;
[UsedImplicitly, DataDefinition]
public sealed partial class OpenBloodSpellsUi : IAlertClick
{
public void AlertClicked(EntityUid player)
{
var euiManager = IoCManager.Resolve<EuiManager>();
var entManager = IoCManager.Resolve<IEntityManager>();
if (!entManager.TryGetComponent(player, out ActorComponent? actor))
return;
euiManager.OpenEui(new CultBloodSpellsEui(player, entManager), actor.PlayerSession);
}
}