diff --git a/Content.Server/_NF/Smuggling/DeadDropSystem.cs b/Content.Server/_NF/Smuggling/DeadDropSystem.cs index 6a05747fec8..bafbdaf098d 100644 --- a/Content.Server/_NF/Smuggling/DeadDropSystem.cs +++ b/Content.Server/_NF/Smuggling/DeadDropSystem.cs @@ -195,11 +195,18 @@ private void OnStationShutdown(EntityUid stationUid, StationDeadDropComponent co public void CompromiseDeadDrop(EntityUid uid, DeadDropComponent _) { - //Get our station: FIXME - check lifecycle on entities before adding another drop. + // Remove the dead drop. + RemComp(uid); + var station = _station.GetOwningStation(uid); + // If station is terminating, or if we aren't on one, nothing to do here. + if (station == null || + !station.Value.Valid || + MetaData(station.Value).EntityLifeStage >= EntityLifeStage.Terminating) + { + return; + } - //Remove the dead drop. - RemComp(uid); //Find a new potential dead drop to spawn. var deadDropQuery = EntityManager.EntityQueryEnumerator(); List<(EntityUid ent, PotentialDeadDropComponent comp)> potentialDeadDrops = new(); @@ -220,6 +227,12 @@ public void CompromiseDeadDrop(EntityUid uid, DeadDropComponent _) if (potentialDeadDrops.Count > 0) { var item = _random.Pick(potentialDeadDrops); + + // If the item is tearing down, do nothing for now. + // FIXME: separate sector-wide scheduler? + if (MetaData(item.ent).EntityLifeStage >= EntityLifeStage.Terminating) + return; + AddDeadDrop(item.ent); _sawmill.Debug($"Dead drop at {uid} compromised, new drop at {item.ent}!"); }