var ev = new IsRottingEvent();
RaiseLocalEvent(uid, ref ev);
- return ev.Handled;
+ return !ev.Handled;
}
public bool IsRotten(EntityUid uid, RottingComponent? rotting = null)
{
if (args.Handled)
return;
- args.Handled = component.CurrentTemperature > Atmospherics.T0C + 0.85f;
+ args.Handled = component.CurrentTemperature < Atmospherics.T0C + 0.85f;
}
public override void Update(float frameTime)
--- /dev/null
+using Content.Server.Power.Components;
+using Content.Shared.Atmos.Rotting;
+using Content.Shared.Buckle.Components;
+
+namespace Content.Server.Buckle.Systems;
+
+public sealed class AntiRotOnBuckleSystem : EntitySystem
+{
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent<BuckleComponent, IsRottingEvent>(OnIsRotting);
+ SubscribeLocalEvent<AntiRotOnBuckleComponent, PowerChangedEvent>(OnPowerChanged);
+ }
+
+ private void OnIsRotting(EntityUid uid, BuckleComponent buckle, ref IsRottingEvent args)
+ {
+ if (args.Handled)
+ return;
+ args.Handled = buckle is { Buckled: true, BuckledTo: not null } &&
+ TryComp<AntiRotOnBuckleComponent>(buckle.BuckledTo.Value, out var antiRot) &&
+ antiRot.Enabled;
+ }
+
+ private void OnPowerChanged(EntityUid uid, AntiRotOnBuckleComponent component, ref PowerChangedEvent args)
+ {
+ component.Enabled = !component.RequiresPower || args.Powered;
+ }
+}
--- /dev/null
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Atmos.Rotting;
+
+/// <summary>
+/// Perishable entities buckled to an entity with this component will stop rotting.
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class AntiRotOnBuckleComponent : Component
+{
+ /// <summary>
+ /// Does this component require power to function.
+ /// </summary>
+ [DataField("requiresPower"), ViewVariables(VVAccess.ReadWrite)]
+ public bool RequiresPower = true;
+
+ /// <summary>
+ /// Whether this component is active or not.
+ /// </summarY>
+ [ViewVariables(VVAccess.ReadWrite)]
+ public bool Enabled = true;
+}
id: StasisBed
name: stasis bed
parent: [ BaseMachinePowered, ConstructibleMachine ]
- description: A bed that massively slows down the patient's metabolism, allowing more time to administer a proper treatment for stabilization.
+ description: A bed that massively slows down the patient's metabolism and prevents bodily decay, allowing more time to administer a proper treatment for stabilization.
components:
- type: StasisBed
baseMultiplier: 10
+ - type: AntiRotOnBuckle
- type: Sprite
sprite: Structures/Machines/stasis_bed.rsi
noRot: true