Small changes for crit mobs to be able to gasp and dead mobs to show dead on examine (#5828)

* [ADD] changes to be able to identify living downed players

* [FIX] format of tryGetComponent, fixed string

* [CHANGE] PR mind component suggestions

* [CHANGE] trycomp based on qa feedback

* [CHANGE] Condensed mindcomponent as per feedback

Co-authored-by: fishfish458 <fishfish458>
This commit is contained in:
Fishfish458
2021-12-19 16:45:47 -06:00
committed by GitHub
parent a51b102949
commit 026f2ee313
4 changed files with 23 additions and 22 deletions

View File

@@ -38,7 +38,7 @@ public class LungSystem : EntitySystem
LungComponent? lung=null, LungComponent? lung=null,
SharedMechanismComponent? mech=null) SharedMechanismComponent? mech=null)
{ {
if (!Resolve(uid, ref lung)) if (!Resolve(uid, ref lung, ref mech))
return; return;
if (_gameTiming.CurTime >= lung.LastGaspPopupTime + lung.GaspPopupCooldown) if (_gameTiming.CurTime >= lung.LastGaspPopupTime + lung.GaspPopupCooldown)
@@ -47,6 +47,9 @@ public class LungSystem : EntitySystem
_popupSystem.PopupEntity(Loc.GetString("lung-behavior-gasp"), uid, Filter.Pvs(uid)); _popupSystem.PopupEntity(Loc.GetString("lung-behavior-gasp"), uid, Filter.Pvs(uid));
} }
if (mech.Body != null && TryComp((mech.Body).Owner, out MobStateComponent? mobState) && !mobState.IsAlive())
return;
Inhale(uid, lung.CycleDelay); Inhale(uid, lung.CycleDelay);
} }

View File

@@ -152,15 +152,12 @@ namespace Content.Server.Body.Systems
var deficit = 0f; var deficit = 0f;
if (bloodstreamAmount < amountNeeded) if (bloodstreamAmount < amountNeeded)
{
if (!EntityManager.GetComponent<MobStateComponent>(uid).IsCritical())
{ {
// Panic inhale // Panic inhale
foreach (var (lung, mech) in lungs) foreach (var (lung, mech) in lungs)
{ {
_lungSystem.Gasp((lung).Owner, lung, mech); _lungSystem.Gasp((lung).Owner, lung, mech);
} }
}
bloodstreamAmount = bloodstream.Air.GetMoles(gas); bloodstreamAmount = bloodstream.Air.GetMoles(gas);

View File

@@ -137,22 +137,23 @@ namespace Content.Server.Mind.Components
_entMan.TryGetComponent<MobStateComponent?>(Owner, out var state) && _entMan.TryGetComponent<MobStateComponent?>(Owner, out var state) &&
state.IsDead(); state.IsDead();
if (!HasMind) if (dead)
{ {
var aliveText = if (Mind?.Session == null) {
$"[color=purple]{Loc.GetString("comp-mind-examined-catatonic", ("ent", Owner))}[/color]"; // Player has no session attached and dead
var deadText = $"[color=red]{Loc.GetString("comp-mind-examined-dead", ("ent", Owner))}[/color]"; message.AddMarkup($"[color=yellow]{Loc.GetString("mind-component-no-mind-and-dead-text", ("ent", Owner))}[/color]");
} else {
message.AddMarkup(dead ? deadText : aliveText); // Player is dead with session
message.AddMarkup($"[color=red]{Loc.GetString("comp-mind-examined-dead", ("ent", Owner))}[/color]");
}
}
else if (!HasMind)
{
message.AddMarkup($"[color=purple]{Loc.GetString("comp-mind-examined-catatonic", ("ent", Owner))}[/color]");
} }
else if (Mind?.Session == null) else if (Mind?.Session == null)
{ {
if (dead) return; message.AddMarkup($"[color=yellow]{Loc.GetString("comp-mind-examined-ssd", ("ent", Owner))}[/color]");
var text =
$"[color=yellow]{Loc.GetString("comp-mind-examined-ssd", ("ent", Owner))}[/color]";
message.AddMarkup(text);
} }
} }
} }

View File

@@ -6,6 +6,6 @@ comp-mind-examined-dead = { CAPITALIZE(POSS-ADJ($ent)) } soul has departed.
comp-mind-examined-ssd = { CAPITALIZE(SUBJECT($ent)) } { CONJUGATE-HAVE($ent) } a blank, absent-minded stare and appears completely unresponsive to anything. { CAPITALIZE(SUBJECT($ent)) } may snap out of it soon. comp-mind-examined-ssd = { CAPITALIZE(SUBJECT($ent)) } { CONJUGATE-HAVE($ent) } a blank, absent-minded stare and appears completely unresponsive to anything. { CAPITALIZE(SUBJECT($ent)) } may snap out of it soon.
mind-component-no-mind-and-alive-text = {$owner} is totally catatonic. The stresses of life in deep-space must have been too much for them. Any recovery is unlikely. mind-component-no-mind-and-alive-text = { CAPITALIZE(POSS-ADJ($ent)) } is totally catatonic. The stresses of life in deep-space must have been too much for them. Any recovery is unlikely.
mind-component-no-mind-and-dead-text = {$owner}'s soul has departed. mind-component-no-mind-and-dead-text = { CAPITALIZE(POSS-ADJ($ent)) } soul has departed and moved on. Any recovery is unlikely.
mind-component-mind-and-no-session-text = {$owner} has a blank, absent-minded stare and appears completely unresponsive to anything. {$owner} may snap out of it soon. mind-component-mind-and-no-session-text = { CAPITALIZE(POSS-ADJ($ent)) } { CONJUGATE-HAVE($ent) } a blank, absent-minded stare and appears completely unresponsive to anything. { CAPITALIZE(POSS-ADJ($ent)) } may snap out of it soon.