2022-02-17 15:00:41 -07:00
|
|
|
|
using Content.Server.Body.Components;
|
|
|
|
|
|
using Content.Server.Body.Systems;
|
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
|
|
|
|
|
using Content.Shared.FixedPoint;
|
2023-06-04 16:45:02 -04:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2022-02-17 15:00:41 -07:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects;
|
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class ModifyBloodLevel : ReagentEffect
|
2022-02-17 15:00:41 -07:00
|
|
|
|
{
|
2023-12-29 04:47:43 -08:00
|
|
|
|
[DataField]
|
2022-02-17 15:00:41 -07:00
|
|
|
|
public bool Scaled = false;
|
|
|
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
|
[DataField]
|
2022-02-17 15:00:41 -07:00
|
|
|
|
public FixedPoint2 Amount = 1.0f;
|
|
|
|
|
|
|
2023-06-04 16:45:02 -04:00
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
|
|
|
|
=> Loc.GetString("reagent-effect-guidebook-modify-blood-level", ("chance", Probability),
|
|
|
|
|
|
("deltasign", MathF.Sign(Amount.Float())));
|
|
|
|
|
|
|
2022-02-17 15:00:41 -07:00
|
|
|
|
public override void Effect(ReagentEffectArgs args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood))
|
|
|
|
|
|
{
|
|
|
|
|
|
var sys = EntitySystem.Get<BloodstreamSystem>();
|
|
|
|
|
|
var amt = Scaled ? Amount * args.Quantity : Amount;
|
2022-12-21 09:51:49 -05:00
|
|
|
|
amt *= args.Scale;
|
|
|
|
|
|
|
2022-02-17 15:00:41 -07:00
|
|
|
|
sys.TryModifyBloodLevel(args.SolutionEntity, amt, blood);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|