diff --git a/Content.Server/Corvax/AutoDeleteItems/AutoDeleteComponent.cs b/Content.Server/Corvax/AutoDeleteItems/AutoDeleteComponent.cs index ed618b36dec..09e3016754e 100644 --- a/Content.Server/Corvax/AutoDeleteItems/AutoDeleteComponent.cs +++ b/Content.Server/Corvax/AutoDeleteItems/AutoDeleteComponent.cs @@ -9,6 +9,10 @@ public sealed partial class AutoDeleteComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] public bool IsHumanoidNear; + [ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] + public bool IsSSDNear = false; + [DataField, ViewVariables(VVAccess.ReadWrite)] public bool ReadyToDelete = false; diff --git a/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs b/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs index 93fac8dc852..3d80078d80a 100644 --- a/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs +++ b/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs @@ -2,6 +2,8 @@ using Content.Shared.Humanoid; using Content.Shared.Mobs.Systems; using Robust.Shared.Timing; +using Robust.Shared.Player; +using Content.Shared.SSDIndicator; namespace Content.Server.Corvax.AutoDeleteItems; @@ -28,40 +30,60 @@ public override void Update(float frameTime) { return; } - var humanoids = new HashSet>(); if (autoDeleteComponent.NextTimeToCheck > _gameTiming.CurTime) return; - _lookup.GetEntitiesInRange(xform.Coordinates, autoDeleteComponent.DistanceToCheck, humanoids); - if (humanoids.Count > 0) - autoDeleteComponent.IsHumanoidNear = true; - else - autoDeleteComponent.IsHumanoidNear = false; - - if (autoDeleteComponent.IsHumanoidNear == false && autoDeleteComponent.ReadyToDelete == true && autoDeleteComponent.NextTimeToDelete < _gameTiming.CurTime) + SSDIndicatorComponent? ssdComponent = null; + //if (!TryComp(xform., out var ssd)) + // continue; + foreach (var iterator in _lookup.GetEntitiesInRange(xform.Coordinates, autoDeleteComponent.DistanceToCheck)) { - EntityManager.DeleteEntity(uid); - } + if (TryComp(iterator, out ssdComponent) && ssdComponent.IsSSD == true) + { + autoDeleteComponent.IsSSDNear = true; + } + else if(TryComp(iterator, out ssdComponent) && ssdComponent.IsSSD == false) + { + autoDeleteComponent.IsSSDNear = false; + } + + if (iterator.Owner == uid) + continue; - if (autoDeleteComponent.IsHumanoidNear == true) - { - if (autoDeleteComponent.ReadyToDelete == true) - autoDeleteComponent.ReadyToDelete = false; + var humanoids = new HashSet>(); - autoDeleteComponent.NextTimeToDelete = _gameTiming.CurTime + autoDeleteComponent.DelayToDelete; - autoDeleteComponent.NextTimeToCheck = _gameTiming.CurTime + autoDeleteComponent.DelayToCheck; - } + _lookup.GetEntitiesInRange(xform.Coordinates, autoDeleteComponent.DistanceToCheck, humanoids); - if (autoDeleteComponent.IsHumanoidNear == false && autoDeleteComponent.ReadyToDelete == false) - { - autoDeleteComponent.NextTimeToDelete = _gameTiming.CurTime + autoDeleteComponent.DelayToDelete; - autoDeleteComponent.NextTimeToCheck = _gameTiming.CurTime + autoDeleteComponent.DelayToCheck; - autoDeleteComponent.ReadyToDelete = true; - } + if (humanoids.Count > 0 && !autoDeleteComponent.IsSSDNear) + autoDeleteComponent.IsHumanoidNear = true; + else + autoDeleteComponent.IsHumanoidNear = false; + + if (autoDeleteComponent.IsHumanoidNear == false && autoDeleteComponent.ReadyToDelete == true && autoDeleteComponent.NextTimeToDelete < _gameTiming.CurTime) + { + EntityManager.DeleteEntity(uid); + } + if (autoDeleteComponent.IsSSDNear == true) + { + autoDeleteComponent.IsHumanoidNear = false; + } + if (autoDeleteComponent.IsHumanoidNear == true && autoDeleteComponent.IsSSDNear == false) + { + if (autoDeleteComponent.ReadyToDelete == true) + autoDeleteComponent.ReadyToDelete = false; - //autoDeleteComponent.NextTimeToDelete = _gameTiming.CurTime + autoDeleteComponent.DelayToDelete; - //autoDeleteComponent.NextTimeToCheck = _gameTiming.CurTime + autoDeleteComponent.DelayToCheck; + autoDeleteComponent.NextTimeToDelete = _gameTiming.CurTime + autoDeleteComponent.DelayToDelete; + autoDeleteComponent.NextTimeToCheck = _gameTiming.CurTime + autoDeleteComponent.DelayToCheck; + } + + if (autoDeleteComponent.IsHumanoidNear == false && autoDeleteComponent.ReadyToDelete == false) + { + autoDeleteComponent.NextTimeToDelete = _gameTiming.CurTime + autoDeleteComponent.DelayToDelete; + autoDeleteComponent.NextTimeToCheck = _gameTiming.CurTime + autoDeleteComponent.DelayToCheck; + autoDeleteComponent.ReadyToDelete = true; + } + } } } }