Add cvar to disable ghosting killing your crit mob (#28945)

* Add cvar to disable ghosting killing your crit mob

* Update Content.Shared/CCVar/CCVars.cs

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2024-06-16 04:21:16 -07:00
committed by GitHub
parent 32e1d1a3b5
commit 4954b6d79e
2 changed files with 9 additions and 1 deletions

View File

@@ -251,7 +251,9 @@ namespace Content.Server.GameTicking
// (If the mob survives, that's a bug. Ghosting is kept regardless.)
var canReturn = canReturnGlobal && _mind.IsCharacterDeadPhysically(mind);
if (canReturnGlobal && TryComp(playerEntity, out MobStateComponent? mobState))
if (_configurationManager.GetCVar(CCVars.GhostKillCrit) &&
canReturnGlobal &&
TryComp(playerEntity, out MobStateComponent? mobState))
{
if (_mobState.IsCritical(playerEntity.Value, mobState))
{

View File

@@ -1948,6 +1948,12 @@ namespace Content.Shared.CCVar
public static readonly CVarDef<float> GhostRoleTime =
CVarDef.Create("ghost.role_time", 3f, CVar.REPLICATED | CVar.SERVER);
/// <summary>
/// Whether or not to kill the player's mob on ghosting, when it is in a critical health state.
/// </summary>
public static readonly CVarDef<bool> GhostKillCrit =
CVarDef.Create("ghost.kill_crit", true, CVar.REPLICATED | CVar.SERVER);
/*
* Fire alarm
*/