Fix brains, borgs etc not counting as marooned (#37148)

* init

* comments

* comment

* no more debug
This commit is contained in:
ScarKy0
2025-05-06 19:24:26 +02:00
committed by GitHub
parent ac24be2fb7
commit 9b5ddb87f5
4 changed files with 62 additions and 3 deletions

View File

@@ -253,6 +253,24 @@ public abstract partial class SharedMindSystem : EntitySystem
return _mobState.IsDead(mind.OwnedEntity.Value, targetMobState);
}
/// <summary>
/// True if the OwnedEntity of this mind is physically unrevivable.
/// This is mainly to check whether a mind is able to inherit their "original" character again without the need for creating a new one.
/// In cases of being a brain, being borged or a zombie they are "unrevivable"
/// </summary>
public bool IsCharacterUnrevivablePhysically(MindComponent mind)
{
if (mind.OwnedEntity == null)
return true;
// This entity cannot be dead, alive or crit, so it makes sense it cannot be revived to begin with.
if (!HasComp<MobStateComponent>(mind.OwnedEntity))
return true;
// Could use checks for the amount of damage they have, but with chemistry you can never tell what damage means someone is truly "unrevivable".
return false;
}
public virtual void Visit(EntityUid mindId, EntityUid entity, MindComponent? mind = null)
{
}
@@ -556,6 +574,27 @@ public abstract partial class SharedMindSystem : EntitySystem
return IsCharacterDeadPhysically(mind);
}
/// <summary>
/// True if this Mind is 'sufficiently unrevivable' IC (Objectives, EndText).
/// Note that this is *IC logic*, it's not necessarily tied to any specific truth.
/// "If administrators decide that zombies are unrevivable, this returns true for zombies."
/// Alternative IsCharacterDeadIC that checks for whether they will be able to inherit their body again.
/// State in which they must be given a new body to "live" (borging, being a brain, etc) should count as "unrevivable".
/// </summary>
public bool IsCharacterUnrevivableIc(MindComponent mind)
{
if (mind.OwnedEntity is { } owned)
{
var ev = new GetCharacterUnrevivableIcEvent(null);
RaiseLocalEvent(owned, ref ev);
if (ev.Unrevivable != null)
return ev.Unrevivable.Value;
}
return IsCharacterUnrevivablePhysically(mind);
}
/// <summary>
/// A string to represent the mind for logging
/// </summary>
@@ -602,3 +641,11 @@ public abstract partial class SharedMindSystem : EntitySystem
/// <param name="Dead"></param>
[ByRefEvent]
public record struct GetCharactedDeadIcEvent(bool? Dead);
/// <summary>
/// Raised on an entity to determine whether or not they are "unrevivable" in IC-logic.
/// Used to check for things such as being borged or a zombie.
/// </summary>
/// <param name="Unrevivable"></param>
[ByRefEvent]
public record struct GetCharacterUnrevivableIcEvent(bool? Unrevivable);