Objectives all use a consistent definition of "dead" defined in Mind now. DieCondition is no longer inverted. (#4006)

More brain fixes, mainly
This commit is contained in:
20kdc
2021-05-15 16:46:55 +01:00
committed by GitHub
parent ae8887dea6
commit f6a2daffa9
4 changed files with 40 additions and 44 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Shared.GameObjects.Components.Mobs.State;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Observer;
using Content.Server.Mobs.Roles;
@@ -106,6 +107,41 @@ namespace Content.Server.Mobs
}
}
/// <summary>
/// True if this Mind is 'sufficiently dead' IC (objectives, endtext).
/// Note that this is *IC logic*, it's not necessarily tied to any specific truth.
/// "If administrators decide that zombies are dead, this returns true for zombies."
/// (Maybe you were looking for the action blocker system?)
/// </summary>
[ViewVariables]
public bool CharacterDeadIC
{
get
{
// This is written explicitly so that the logic can be understood.
// But it's also weird and potentially situational.
// Specific considerations when updating this:
// + Does being turned into a borg (if/when implemented) count as dead?
// *If not, add specific conditions to users of this property where applicable.*
// + Is being transformed into a donut 'dead'?
// TODO: Consider changing the way ghost roles work.
// Mind is an *IC* mind, therefore ghost takeover is IC revival right now.
// + Is it necessary to have a reference to a specific 'mind iteration' to cycle when certain events happen?
// (If being a borg or AI counts as dead, then this is highly likely, as it's still the same Mind for practical purposes.)
// This can be null if they're deleted (spike / brain nom)
if (OwnedEntity == null)
return true;
var targetMobState = OwnedEntity.GetComponentOrNull<IMobStateComponent>();
// This can be null if it's a brain (this happens very often)
// Brains are the result of gibbing so should definitely count as dead
if (targetMobState == null)
return true;
// They might actually be alive.
return targetMobState.IsDead();
}
}
/// <summary>
/// Gives this mind a new role.
/// </summary>