Fix/Addition - Wizard Survivor Antag Status (#35226)

This commit is contained in:
keronshb
2025-02-23 12:24:36 -05:00
committed by GitHub
parent 326bd7f93a
commit 3192914fc5
15 changed files with 246 additions and 2 deletions

View File

@@ -1,12 +1,20 @@
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 class MagicSystem : SharedMagicSystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
public override void Initialize()
{
@@ -32,4 +40,20 @@ public sealed class MagicSystem : SharedMagicSystem
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, "InvalidForSurvivorAntag"))
_tag.AddTag(mind, "InvalidForSurvivorAntag");
EntProtoId survivorRule = "Survivor";
if (!_gameTicker.IsGameRuleActive<SurvivorRuleComponent>())
_gameTicker.StartGameRule(survivorRule);
}
}