Stasis bed cleanup and bugfixes. (#38762)

* Stasis bed sent to shed

* Code Review

* Code Review 2
This commit is contained in:
Nemanja
2025-07-05 20:59:31 -04:00
committed by GitHub
parent 7aaccb5b98
commit ab201b6e82
21 changed files with 243 additions and 222 deletions

View File

@@ -2,6 +2,7 @@ using Content.Server.Body.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Events;
using Content.Shared.Body.Organ;
using Content.Shared.Body.Systems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
@@ -18,7 +19,8 @@ using Robust.Shared.Timing;
namespace Content.Server.Body.Systems
{
public sealed class MetabolizerSystem : EntitySystem
/// <inheritdoc/>
public sealed class MetabolizerSystem : SharedMetabolizerSystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -45,7 +47,7 @@ namespace Content.Server.Body.Systems
private void OnMapInit(Entity<MetabolizerComponent> ent, ref MapInitEvent args)
{
ent.Comp.NextUpdate = _gameTiming.CurTime + ent.Comp.UpdateInterval;
ent.Comp.NextUpdate = _gameTiming.CurTime + ent.Comp.AdjustedUpdateInterval;
}
private void OnUnpaused(Entity<MetabolizerComponent> ent, ref EntityUnpausedEvent args)
@@ -65,20 +67,9 @@ namespace Content.Server.Body.Systems
}
}
private void OnApplyMetabolicMultiplier(
Entity<MetabolizerComponent> ent,
ref ApplyMetabolicMultiplierEvent args)
private void OnApplyMetabolicMultiplier(Entity<MetabolizerComponent> ent, ref ApplyMetabolicMultiplierEvent args)
{
// TODO REFACTOR THIS
// This will slowly drift over time due to floating point errors.
// Instead, raise an event with the base rates and allow modifiers to get applied to it.
if (args.Apply)
{
ent.Comp.UpdateInterval *= args.Multiplier;
return;
}
ent.Comp.UpdateInterval /= args.Multiplier;
ent.Comp.UpdateIntervalMultiplier = args.Multiplier;
}
public override void Update(float frameTime)
@@ -99,7 +90,7 @@ namespace Content.Server.Body.Systems
if (_gameTiming.CurTime < metab.NextUpdate)
continue;
metab.NextUpdate += metab.UpdateInterval;
metab.NextUpdate += metab.AdjustedUpdateInterval;
TryMetabolize((uid, metab));
}
}