2021-02-27 19:58:08 -06:00
|
|
|
using System.Linq;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Body.Circulatory;
|
|
|
|
|
using Content.Shared.Body.Networks;
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2021-02-27 19:58:08 -06:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Body.Behavior
|
2021-02-27 19:58:08 -06:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Metabolizes reagents in <see cref="SharedBloodstreamComponent"/> after they are digested.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class LiverBehavior : MechanismBehavior
|
|
|
|
|
{
|
|
|
|
|
private float _accumulatedFrameTime;
|
|
|
|
|
|
|
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
if (Body == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_accumulatedFrameTime += frameTime;
|
|
|
|
|
|
2021-07-31 04:50:32 -07:00
|
|
|
// Update at most once per second
|
|
|
|
|
if (_accumulatedFrameTime < 1)
|
2021-02-27 19:58:08 -06:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-31 04:50:32 -07:00
|
|
|
_accumulatedFrameTime -= 1;
|
2021-02-27 19:58:08 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|