Cult spells update (#607)
* - add: CultSystem.BloodSpells. * - add: Cleanup.
This commit is contained in:
53
Content.Server/_White/Cult/UI/CultBloodSpellsEui.cs
Normal file
53
Content.Server/_White/Cult/UI/CultBloodSpellsEui.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
21
Content.Server/_White/Cult/UI/OpenBloodSpellsUi.cs
Normal file
21
Content.Server/_White/Cult/UI/OpenBloodSpellsUi.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user