if (args.NewMobState != MobState.Dead)
return;
+ var ev = new BeforeRemoveAnomalyOnDeathEvent();
+ RaiseLocalEvent(args.Target, ref ev);
+ if (ev.Cancelled)
+ return;
+
_anomaly.ChangeAnomalyHealth(ent, -2); //Shutdown it
}
using Content.Server.Chat.Systems;
using Content.Server.Emoting.Systems;
using Content.Server.Speech.EntitySystems;
+using Content.Shared.Anomaly.Components;
using Content.Shared.Bed.Sleep;
using Content.Shared.Cloning;
using Content.Shared.Damage;
SubscribeLocalEvent<ZombieComponent, GetCharactedDeadIcEvent>(OnGetCharacterDeadIC);
SubscribeLocalEvent<PendingZombieComponent, MapInitEvent>(OnPendingMapInit);
+ SubscribeLocalEvent<PendingZombieComponent, BeforeRemoveAnomalyOnDeathEvent>(OnBeforeRemoveAnomalyOnDeath);
SubscribeLocalEvent<IncurableZombieComponent, MapInitEvent>(OnPendingMapInit);
SubscribeLocalEvent<ZombifyOnDeathComponent, MobStateChangedEvent>(OnDamageChanged);
+
+ }
+
+ private void OnBeforeRemoveAnomalyOnDeath(Entity<PendingZombieComponent> ent, ref BeforeRemoveAnomalyOnDeathEvent args)
+ {
+ // Pending zombies (e.g. infected non-zombies) do not remove their hosted anomaly on death.
+ // Current zombies DO remove the anomaly on death.
+ args.Cancelled = true;
}
private void OnPendingMapInit(EntityUid uid, IncurableZombieComponent component, MapInitEvent args)
[DataField]
public string LayerMap = "inner_anomaly_layer";
}
+
+/// <summary>
+/// Event broadcast when an anomaly is being removed because the host is dying.
+/// Raised directed at the host entity with the anomaly.
+/// Cancel this if you want to prevent the host from losing their anomaly on death.
+/// </summary>
+[ByRefEvent]
+public record struct BeforeRemoveAnomalyOnDeathEvent(bool Cancelled = false);