2022-02-17 15:00:41 -07:00
|
|
|
|
using Content.Server.Body.Components;
|
|
|
|
|
|
using Content.Server.Body.Systems;
|
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
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 ModifyBleedAmount : 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 float 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-bleed-amount", ("chance", Probability),
|
|
|
|
|
|
("deltasign", MathF.Sign(Amount)));
|
|
|
|
|
|
|
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.Float() : Amount;
|
2022-12-21 09:51:49 -05:00
|
|
|
|
amt *= args.Scale;
|
|
|
|
|
|
|
2022-02-17 15:00:41 -07:00
|
|
|
|
sys.TryModifyBleedAmount(args.SolutionEntity, amt, blood);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|