Fix various IC states not counting as dead (#19049)
This commit is contained in:
@@ -650,6 +650,15 @@ public sealed class MindSystem : EntitySystem
|
||||
/// </summary>
|
||||
public bool IsCharacterDeadIc(Mind mind)
|
||||
{
|
||||
if (mind.OwnedEntity is { } owned)
|
||||
{
|
||||
var ev = new GetCharactedDeadIcEvent(null);
|
||||
RaiseLocalEvent(owned, ref ev);
|
||||
|
||||
if (ev.Dead != null)
|
||||
return ev.Dead.Value;
|
||||
}
|
||||
|
||||
return IsCharacterDeadPhysically(mind);
|
||||
}
|
||||
|
||||
@@ -665,3 +674,11 @@ public sealed class MindSystem : EntitySystem
|
||||
return "(originally " + mind.OriginalOwnerUserId + ")";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised on an entity to determine whether or not they are "dead" in IC-logic.
|
||||
/// If not handled, then it will simply check if they are dead physically.
|
||||
/// </summary>
|
||||
/// <param name="Dead"></param>
|
||||
[ByRefEvent]
|
||||
public record struct GetCharactedDeadIcEvent(bool? Dead);
|
||||
|
||||
@@ -24,15 +24,12 @@ namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
get
|
||||
{
|
||||
var targetName = string.Empty;
|
||||
var targetName = Target?.CharacterName ?? "Unknown";
|
||||
var jobName = Target?.CurrentJob?.Name ?? "Unknown";
|
||||
|
||||
if (Target == null)
|
||||
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
||||
|
||||
if (Target.OwnedEntity is {Valid: true} owned)
|
||||
targetName = EntityManager.GetComponent<MetaDataComponent>(owned).EntityName;
|
||||
|
||||
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
SubscribeLocalEvent<BorgChassisComponent, PowerCellChangedEvent>(OnPowerCellChanged);
|
||||
SubscribeLocalEvent<BorgChassisComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
|
||||
SubscribeLocalEvent<BorgChassisComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
|
||||
SubscribeLocalEvent<BorgChassisComponent, GetCharactedDeadIcEvent>(OnGetDeadIC);
|
||||
|
||||
SubscribeLocalEvent<BorgBrainComponent, MindAddedMessage>(OnBrainMindAdded);
|
||||
|
||||
@@ -198,6 +199,11 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnGetDeadIC(EntityUid uid, BorgChassisComponent component, ref GetCharactedDeadIcEvent args)
|
||||
{
|
||||
args.Dead = true;
|
||||
}
|
||||
|
||||
private void OnBrainMindAdded(EntityUid uid, BorgBrainComponent component, MindAddedMessage args)
|
||||
{
|
||||
if (!Container.TryGetOuterContainer(uid, Transform(uid), out var container))
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Drone.Components;
|
||||
using Content.Server.Inventory;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Server.Emoting.Systems;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Speech.EntitySystems;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Inventory;
|
||||
@@ -49,6 +50,7 @@ namespace Content.Server.Zombies
|
||||
SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState);
|
||||
SubscribeLocalEvent<ZombieComponent, CloningEvent>(OnZombieCloning);
|
||||
SubscribeLocalEvent<ZombieComponent, TryingToSleepEvent>(OnSleepAttempt);
|
||||
SubscribeLocalEvent<ZombieComponent, GetCharactedDeadIcEvent>(OnGetCharacterDeadIC);
|
||||
|
||||
SubscribeLocalEvent<PendingZombieComponent, MapInitEvent>(OnPendingMapInit);
|
||||
|
||||
@@ -116,6 +118,11 @@ namespace Content.Server.Zombies
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnGetCharacterDeadIC(EntityUid uid, ZombieComponent component, ref GetCharactedDeadIcEvent args)
|
||||
{
|
||||
args.Dead = true;
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, ZombieComponent component, ComponentStartup args)
|
||||
{
|
||||
if (component.EmoteSoundsId == null)
|
||||
|
||||
@@ -34,9 +34,6 @@
|
||||
proto: robot
|
||||
- type: Speech
|
||||
speechSounds: Pai
|
||||
- type: MobState
|
||||
allowedStates:
|
||||
- Alive
|
||||
- type: ItemSlots
|
||||
slots:
|
||||
brain_slot:
|
||||
|
||||
Reference in New Issue
Block a user