Prevents suicide if someone is already dead (#7677)

* Prevents suicide if someone is already dead

* Adds the Localization text for trying to suicide when dead
This commit is contained in:
keronshb
2022-04-22 01:37:49 -04:00
committed by GitHub
parent 2bb8a776a7
commit a09f45eec7
2 changed files with 10 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Content.Shared.MobState.Components;
namespace Content.Server.Chat.Commands namespace Content.Server.Chat.Commands
{ {
@@ -83,6 +84,13 @@ namespace Content.Server.Chat.Commands
return; return;
} }
//Checks to see if the player is dead.
if(_entities.TryGetComponent<MobStateComponent>(owner, out var mobState) && mobState.IsDead())
{
shell.WriteLine(Loc.GetString("suicide-command-already-dead"));
return;
}
//Checks to see if the CannotSuicide tag exits, ghosts instead. //Checks to see if the CannotSuicide tag exits, ghosts instead.
if(EntitySystem.Get<TagSystem>().HasTag(owner, "CannotSuicide")) if(EntitySystem.Get<TagSystem>().HasTag(owner, "CannotSuicide"))
{ {

View File

@@ -4,4 +4,5 @@ suicide-command-help-text = The suicide command gives you a quick way out of a r
If that fails, it will attempt to use an object in the environment. If that fails, it will attempt to use an object in the environment.
Finally, if neither of the above worked, you will die by biting your tongue. Finally, if neither of the above worked, you will die by biting your tongue.
suicide-command-default-text-others = {$name} is attempting to bite their own tongue! suicide-command-default-text-others = {$name} is attempting to bite their own tongue!
suicide-command-default-text-self = You attempt to bite your own tongue! suicide-command-default-text-self = You attempt to bite your own tongue!
suicide-command-already-dead = You can't suicide. You're dead.