36 lines
943 B
C#
36 lines
943 B
C#
using Content.Server.Chat.Systems;
|
|
using Content.Shared.Magic;
|
|
using Content.Shared.Magic.Events;
|
|
|
|
namespace Content.Server.Magic;
|
|
|
|
public sealed class MagicSystem : SharedMagicSystem
|
|
{
|
|
[Dependency] private readonly ChatSystem _chat = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SpeakSpellEvent>(OnSpellSpoken);
|
|
}
|
|
|
|
private void OnSpellSpoken(ref SpeakSpellEvent args)
|
|
{
|
|
_chat.TrySendInGameICMessage(args.Performer, Loc.GetString(args.Speech), InGameICChatType.Speak, false);
|
|
}
|
|
|
|
public override void OnVoidApplause(VoidApplauseSpellEvent ev)
|
|
{
|
|
base.OnVoidApplause(ev);
|
|
|
|
_chat.TryEmoteWithChat(ev.Performer, ev.Emote);
|
|
|
|
var perfXForm = Transform(ev.Performer);
|
|
var targetXForm = Transform(ev.Target);
|
|
|
|
Spawn(ev.Effect, perfXForm.Coordinates);
|
|
Spawn(ev.Effect, targetXForm.Coordinates);
|
|
}
|
|
}
|