mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* Add [ForbidLiteral] to GameTicker GameRule methods * Cleanup violations in tests * Fix for NukeopsRuleSystem with TODO * This one wasn't a violation, but should still be fixed.
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using Content.Server.Chat.Systems;
|
|
using Content.Server.GameTicking;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Shared.Magic;
|
|
using Content.Shared.Magic.Events;
|
|
using Content.Shared.Mind;
|
|
using Content.Shared.Tag;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server.Magic;
|
|
|
|
public sealed partial class MagicSystem : SharedMagicSystem
|
|
{
|
|
[Dependency] private ChatSystem _chat = default!;
|
|
[Dependency] private GameTicker _gameTicker = default!;
|
|
[Dependency] private TagSystem _tag = default!;
|
|
[Dependency] private SharedMindSystem _mind = default!;
|
|
|
|
private static readonly ProtoId<TagPrototype> InvalidForSurvivorAntagTag = "InvalidForSurvivorAntag";
|
|
private static readonly EntProtoId SurvivorGameRule = "Survivor";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
protected override void OnRandomGlobalSpawnSpell(RandomGlobalSpawnSpellEvent ev)
|
|
{
|
|
base.OnRandomGlobalSpawnSpell(ev);
|
|
|
|
if (!ev.MakeSurvivorAntagonist)
|
|
return;
|
|
|
|
if (_mind.TryGetMind(ev.Performer, out var mind, out _) && !_tag.HasTag(mind, InvalidForSurvivorAntagTag))
|
|
_tag.AddTag(mind, InvalidForSurvivorAntagTag);
|
|
|
|
if (!_gameTicker.IsGameRuleActive<SurvivorRuleComponent>())
|
|
_gameTicker.StartGameRule(SurvivorGameRule);
|
|
}
|
|
}
|