* move to gurps magic types * spell traits, categorize spells * Update TraitSystem.cs * magic spells item provider * Update twoHandedStaffs.yml * Update CP14MagicManacostModifySystem.cs * Update CP14SpellStorageSystem.cs * some funny shit * fix problems 1 * FIX * more funny broken shit * predict slowdown, fixes funny * EntityTarget action * fixes * Update T1_sphere_of_light.yml * fix demiplan loot centering * predict movement!
43 lines
1.7 KiB
C#
43 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()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CP14MagicEffectVerbalAspectComponent, CP14VerbalAspectSpeechEvent>(OnSpellSpoken);
|
|
|
|
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14StartCastMagicEffectEvent>(OnSpawnMagicVisualEffect);
|
|
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14EndCastMagicEffectEvent>(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 CP14EndCastMagicEffectEvent args)
|
|
{
|
|
QueueDel(ent.Comp.SpawnedEntity);
|
|
ent.Comp.SpawnedEntity = null;
|
|
}
|
|
}
|