* flame creation spell backend * flame creation visuals * flame creation spell visual * tweak * some tweaks * ice dagger spell * move spells to rings * Update ring.yml * fix server crash
41 lines
1.7 KiB
C#
41 lines
1.7 KiB
C#
using Content.Server.Chat.Systems;
|
|
using Content.Shared._CP14.MagicSpell;
|
|
using Content.Shared._CP14.MagicSpell.Components;
|
|
using Content.Shared._CP14.MagicSpell.Events;
|
|
using Robust.Server.GameObjects;
|
|
|
|
namespace Content.Server._CP14.MagicSpell;
|
|
|
|
public sealed partial class CP14MagicSystem : CP14SharedMagicSystem
|
|
{
|
|
[Dependency] private readonly ChatSystem _chat = default!;
|
|
[Dependency] private readonly TransformSystem _transform = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<CP14MagicEffectVerbalAspectComponent, CP14VerbalAspectSpeechEvent>(OnSpellSpoken);
|
|
|
|
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14StartCastMagicEffectEvent>(OnSpawnMagicVisualEffect);
|
|
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14StopCastMagicEffectEvent>(OnDespawnMagicVisualEffect);
|
|
}
|
|
|
|
private void OnSpellSpoken(Entity<CP14MagicEffectVerbalAspectComponent> ent, ref CP14VerbalAspectSpeechEvent args)
|
|
{
|
|
if (args.Performer is not null && args.Speech is not null)
|
|
_chat.TrySendInGameICMessage(args.Performer.Value, args.Speech, InGameICChatType.Speak, true);
|
|
}
|
|
|
|
private void OnSpawnMagicVisualEffect(Entity<CP14MagicEffectCastingVisualComponent> ent, ref CP14StartCastMagicEffectEvent args)
|
|
{
|
|
var vfx = SpawnAttachedTo(ent.Comp.Proto, Transform(args.Performer).Coordinates);
|
|
_transform.SetParent(vfx, args.Performer);
|
|
ent.Comp.SpawnedEntity = vfx;
|
|
}
|
|
|
|
private void OnDespawnMagicVisualEffect(Entity<CP14MagicEffectCastingVisualComponent> ent, ref CP14StopCastMagicEffectEvent args)
|
|
{
|
|
QueueDel(ent.Comp.SpawnedEntity);
|
|
ent.Comp.SpawnedEntity = null;
|
|
}
|
|
}
|