Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions Content.Server/_Floof/Vore/DevouredSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<EntityUid> _pendingImmunityUpdates = new();

Expand Down Expand Up @@ -138,7 +141,7 @@ private bool IsInVoreContainer(EntityUid uid){
}

/// <summary>
/// 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
/// </summary>
private void ApplyStomachImmunities(EntityUid prey){
Expand Down Expand Up @@ -168,12 +171,23 @@ should prevent possible exploitation of the system*/
EnsureComp<RadiationProtectionComponent>(prey);
tracker.AddedRadiation = true;
}
if (!HasComp<FlashImmunityComponent>(prey)){
EnsureComp<FlashImmunityComponent>(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<SuitSensorComponent>(item, out var sensorComp)){
tracker.OriginalSensorModes[item] = sensorComp.Mode;
_suitSensorSystem.SetSensor((item, sensorComp), SuitSensorMode.SensorOff);
}
}
}

/// <summary>
/// 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
/// </summary>
private void RemoveStomachImmunities(EntityUid prey){
Expand All @@ -199,7 +213,15 @@ private void RemoveStomachImmunities(EntityUid prey){
RemComp<RadiationProtectionComponent>(prey);
tracker.AddedRadiation = false;
}
_suitSensorSystem.SetAllSensors(prey, SuitSensorMode.SensorCords);
if (tracker.AddedFlash){
RemComp<FlashImmunityComponent>(prey);
tracker.AddedFlash = false;
}
foreach (var (item, originalMode) in tracker.OriginalSensorModes){
if (TryComp<SuitSensorComponent>(item, out var sensorComp))
_suitSensorSystem.SetSensor((item, sensorComp), originalMode);
}
tracker.OriginalSensorModes.Clear();
RemComp<DevouredComponent>(prey);
}
}
26 changes: 21 additions & 5 deletions Content.Server/_Floof/Vore/VoreSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,33 @@ private void OnConsentStartup(EntityUid uid, ConsentComponent comp, ComponentSta

/// <summary>
/// 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
/// </summary>
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<VoreComponent>(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
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/_Floof/Vore/DevouredComponent.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
using Content.Shared.Medical.SuitSensor;
namespace Content.Server._Floof.Vore;

[RegisterComponent]
public sealed partial class DevouredComponent : Component
{
public bool AddedPressure;
public bool AddedBreathing;
public bool AddedTemperature;
public bool AddedRadiation;
public bool AddedFlash;

[DataField("originalSensorModes")]
public Dictionary<EntityUid, SuitSensorMode> OriginalSensorModes = new();
}
Loading