Add prevent suicide to minds and add tag control commands (#13307)

This commit is contained in:
Chief-Engineer
2023-02-16 18:36:10 -06:00
committed by GitHub
parent a0ea580260
commit b482463c91
5 changed files with 148 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ using Content.Server.Mind.Components;
using Content.Shared.Examine;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Interaction.Events;
using Robust.Shared.Map;
using Robust.Shared.Timing;
@@ -23,6 +24,7 @@ public sealed class MindSystem : EntitySystem
SubscribeLocalEvent<MindComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<MindComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<MindComponent, SuicideEvent>(OnSuicide);
}
public void SetGhostOnShutdown(EntityUid uid, bool value, MindComponent? mind = null)
@@ -157,4 +159,15 @@ public sealed class MindSystem : EntitySystem
args.PushMarkup($"[color=yellow]{Loc.GetString("comp-mind-examined-ssd", ("ent", uid))}[/color]");
}
}
private void OnSuicide(EntityUid uid, MindComponent component, SuicideEvent args)
{
if (args.Handled)
return;
if (component.HasMind && component.Mind!.PreventSuicide)
{
args.BlockSuicideAttempt(true);
}
}
}