Add prevent suicide to minds and add tag control commands (#13307)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user