Spellblade update (#346)

* - tweak: Don't close eui too quickly.

* - add: Spellblade update.

* - fix: Cult teleport spell.
This commit is contained in:
Aviu00
2024-06-11 20:07:47 +00:00
committed by GitHub
parent ee41166fc0
commit 4d09ed9245
31 changed files with 583 additions and 65 deletions

View File

@@ -0,0 +1,57 @@
using Content.Client._White.UserInterface.Radial;
using Content.Shared._White.Wizard.SpellBlade;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.Client._White.Wizard.SpellBlade;
[UsedImplicitly]
// ReSharper disable once InconsistentNaming
public sealed class SpellBladeBUI(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private RadialContainer? _aspectSelector;
protected override void Open()
{
base.Open();
if (!_entityManager.TryGetComponent(Owner, out SpellBladeComponent? spellBlade) ||
spellBlade.ChosenAspect != string.Empty)
return;
var spriteSystem = _entityManager.System<SpriteSystem>();
_aspectSelector = new RadialContainer();
_aspectSelector.Closed += Close;
foreach (var aspect in spellBlade.Aspects)
{
if (!_prototypeManager.TryIndex(aspect, out var proto))
continue;
var button = _aspectSelector.AddButton(proto.Name,
spriteSystem.GetPrototypeIcon(proto).Default);
button.Tooltip = proto.Description;
button.Controller.OnPressed += _ =>
{
SendMessage(new SpellBladeSystemMessage(aspect));
_aspectSelector.Close();
};
}
_aspectSelector.OpenAttachedLocalPlayer();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_aspectSelector?.Close();
}
}

View File

@@ -0,0 +1,7 @@
using Content.Shared._White.Wizard.SpellBlade;
namespace Content.Client._White.Wizard.SpellBlade;
public sealed class SpellBladeSystem : SharedSpellBladeSystem
{
}

View File

@@ -8,7 +8,7 @@ using JetBrains.Annotations;
namespace Content.Client._White.Wizard.TeleportSpell;
[UsedImplicitly]
public sealed class TeleportSpellEui : BaseEui
public sealed class WizardTeleportSpellEui : BaseEui
{
private readonly TeleportRunesListWindow _window = new();
@@ -30,7 +30,7 @@ public sealed class TeleportSpellEui : BaseEui
public override void HandleState(EuiStateBase state)
{
if (state is not TeleportSpellEuiState cast)
if (state is not WizardTeleportSpellEuiState cast)
return;
_window.Clear();