Fix miasma flies (#10580)
Looks like some of the exceptions still got through. Also had a redundant AttachParent.
This commit is contained in:
@@ -6,8 +6,8 @@ using Content.Server.Temperature.Systems;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.MobState.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Random;
|
||||
@@ -19,6 +19,8 @@ namespace Content.Server.Atmos.Miasma
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly SharedMobStateSystem _mobState = default!;
|
||||
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
/// System Variables
|
||||
@@ -66,7 +68,7 @@ namespace Content.Server.Atmos.Miasma
|
||||
/// </summary>
|
||||
private float _poolAccumulator = 0f;
|
||||
|
||||
/// <summmary>
|
||||
/// <summary>
|
||||
/// How long without an infection before we pick a new disease.
|
||||
/// </summary>
|
||||
private TimeSpan _poolRepickTime = TimeSpan.FromMinutes(5);
|
||||
@@ -165,7 +167,7 @@ namespace Content.Server.Atmos.Miasma
|
||||
|
||||
private void OnMobStateChanged(EntityUid uid, PerishableComponent component, MobStateChangedEvent args)
|
||||
{
|
||||
if (args.Component.IsDead())
|
||||
if (_mobState.IsDead(uid))
|
||||
EnsureComp<RottingComponent>(uid);
|
||||
}
|
||||
|
||||
@@ -218,7 +220,9 @@ namespace Content.Server.Atmos.Miasma
|
||||
|
||||
private void OnEntRemoved(EntityUid uid, AntiRottingContainerComponent component, EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if (TryComp<PerishableComponent>(args.Entity, out var perishable) && !Terminating(uid))
|
||||
// If we get de-parented due to entity shutdown don't add more flies.
|
||||
if (TryComp<PerishableComponent>(args.Entity, out var perishable) &&
|
||||
TryComp<MetaDataComponent>(uid, out var metadata) && metadata.EntityLifeStage < EntityLifeStage.Terminating)
|
||||
{
|
||||
ModifyPreservationSource(args.Entity, false);
|
||||
ToggleDecomposition(args.Entity, true, perishable);
|
||||
@@ -230,7 +234,6 @@ namespace Content.Server.Atmos.Miasma
|
||||
private void OnFliesInit(EntityUid uid, FliesComponent component, ComponentInit args)
|
||||
{
|
||||
component.VirtFlies = EntityManager.SpawnEntity("AmbientSoundSourceFlies", Transform(uid).Coordinates);
|
||||
Transform(component.VirtFlies).AttachParent(uid);
|
||||
}
|
||||
|
||||
private void OnFliesShutdown(EntityUid uid, FliesComponent component, ComponentShutdown args)
|
||||
|
||||
Reference in New Issue
Block a user