diff --git a/Content.Server/_Floof/Vore/DevouredSystem.cs b/Content.Server/_Floof/Vore/DevouredSystem.cs index f83db84d82..cc879f9291 100644 --- a/Content.Server/_Floof/Vore/DevouredSystem.cs +++ b/Content.Server/_Floof/Vore/DevouredSystem.cs @@ -19,6 +19,8 @@ using Content.Shared.Movement.Components; using Content.Shared.Movement; using Content.Server.Radiation.Components; +using Content.Shared.Flash.Components; +using Content.Shared.Inventory; namespace Content.Server._Floof.Vore; public sealed class VoreImmunitySystem : EntitySystem @@ -27,6 +29,7 @@ public sealed class VoreImmunitySystem : EntitySystem [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly SharedSuitSensorSystem _suitSensorSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; + [Dependency] private readonly InventorySystem _inventorySystem = default!; private readonly HashSet _pendingImmunityUpdates = new(); @@ -138,7 +141,7 @@ private bool IsInVoreContainer(EntityUid uid){ } /// - /// the prey needs to have certain components such as pressure immunity + /// the prey needs to have certain components such as pressure immunity and their cords off /// for consent purposes -> having others avoid stumbling on scenarios /// private void ApplyStomachImmunities(EntityUid prey){ @@ -168,12 +171,23 @@ should prevent possible exploitation of the system*/ EnsureComp(prey); tracker.AddedRadiation = true; } + if (!HasComp(prey)){ + EnsureComp(prey); + tracker.AddedFlash = true; + } - _suitSensorSystem.SetAllSensors(prey, SuitSensorMode.SensorOff); + var slotEnumerator = _inventorySystem.GetSlotEnumerator(prey, SlotFlags.All); + while (slotEnumerator.NextItem(out var item, out var slot)){ + if (TryComp(item, out var sensorComp)){ + tracker.OriginalSensorModes[item] = sensorComp.Mode; + _suitSensorSystem.SetSensor((item, sensorComp), SuitSensorMode.SensorOff); + } + } } /// /// the removal of the devouredcomponent and immunities after leaving a container + /// and the reset of their cords to their original state /// to avoid intentional and accidental exploitation /// private void RemoveStomachImmunities(EntityUid prey){ @@ -199,7 +213,15 @@ private void RemoveStomachImmunities(EntityUid prey){ RemComp(prey); tracker.AddedRadiation = false; } - _suitSensorSystem.SetAllSensors(prey, SuitSensorMode.SensorCords); + if (tracker.AddedFlash){ + RemComp(prey); + tracker.AddedFlash = false; + } + foreach (var (item, originalMode) in tracker.OriginalSensorModes){ + if (TryComp(item, out var sensorComp)) + _suitSensorSystem.SetSensor((item, sensorComp), originalMode); + } + tracker.OriginalSensorModes.Clear(); RemComp(prey); } } \ No newline at end of file diff --git a/Content.Server/_Floof/Vore/VoreSystem.cs b/Content.Server/_Floof/Vore/VoreSystem.cs index 7118592c53..2373214d92 100644 --- a/Content.Server/_Floof/Vore/VoreSystem.cs +++ b/Content.Server/_Floof/Vore/VoreSystem.cs @@ -82,17 +82,33 @@ private void OnConsentStartup(EntityUid uid, ConsentComponent comp, ComponentSta /// /// gives a mob the vore component if they have selected either pred or prey consent and removes it if they have neither + /// also handles container if consent is off but preds container is still full/prey is inside vore container /// private void ApplyVoreConsent(EntityUid uid){ var hasPred = _consentSystem.HasConsent(uid, isPred); var hasPrey = _consentSystem.HasConsent(uid, isPrey); //TODO var for digest - /* in case prey is inside a container immediately release them when they turn off prey consent - works as an emergency leave for the prey*/ - if (!hasPrey && IsInVoreContainer(uid) && - _containerSystem.TryGetContainingContainer(uid, out var container)){ - _containerSystem.Remove(uid, container); + if (TryComp(uid, out var comp)){ + /* in case prey is inside a container immediately release them when they turn off prey consent + works as an emergency leave for the prey*/ + if (!hasPrey){ + var safety = 0; + while (_containerSystem.TryGetContainingContainer(uid, out var container) && container.ID == comp.ContainerId){ + if (++safety > 10) + break; + if (!_containerSystem.Remove(uid, container)) + break; + } + } + + // same for pred release all current prey after turning off consent + if (!hasPred){ + if (_containerSystem.TryGetContainer(uid, comp.ContainerId, out var container)){ + _containerSystem.EmptyContainer(container); + _containerSystem.ShutdownContainer(container); + } + } } //give the mob the needed component to be able to see the verbs diff --git a/Content.Shared/_Floof/Vore/DevouredComponent.cs b/Content.Shared/_Floof/Vore/DevouredComponent.cs index 15d7a023d4..ec53ba3f92 100644 --- a/Content.Shared/_Floof/Vore/DevouredComponent.cs +++ b/Content.Shared/_Floof/Vore/DevouredComponent.cs @@ -1,3 +1,6 @@ +using Content.Shared.Medical.SuitSensor; +namespace Content.Server._Floof.Vore; + [RegisterComponent] public sealed partial class DevouredComponent : Component { @@ -5,4 +8,8 @@ public sealed partial class DevouredComponent : Component public bool AddedBreathing; public bool AddedTemperature; public bool AddedRadiation; + public bool AddedFlash; + + [DataField("originalSensorModes")] + public Dictionary OriginalSensorModes = new(); } \ No newline at end of file