2022-06-04 19:17:48 +12:00
|
|
|
using Content.Server.Temperature.Components;
|
2021-11-20 16:47:53 -07:00
|
|
|
using Content.Server.Temperature.Systems;
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2023-06-04 16:45:02 -04:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-20 16:47:53 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects
|
|
|
|
|
{
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class AdjustTemperature : ReagentEffect
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField]
|
2021-11-20 16:47:53 -07:00
|
|
|
public float Amount;
|
|
|
|
|
|
2023-06-04 16:45:02 -04:00
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
|
|
|
=> Loc.GetString("reagent-effect-guidebook-adjust-temperature",
|
|
|
|
|
("chance", Probability),
|
|
|
|
|
("deltasign", MathF.Sign(Amount)),
|
|
|
|
|
("amount", MathF.Abs(Amount)));
|
|
|
|
|
|
2021-11-21 00:35:02 -07:00
|
|
|
public override void Effect(ReagentEffectArgs args)
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
2022-06-04 19:17:48 +12:00
|
|
|
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent? temp))
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
|
|
|
|
var sys = args.EntityManager.EntitySysManager.GetEntitySystem<TemperatureSystem>();
|
2022-12-21 09:51:49 -05:00
|
|
|
var amount = Amount;
|
|
|
|
|
|
|
|
|
|
amount *= args.Scale;
|
|
|
|
|
|
|
|
|
|
sys.ChangeHeat(args.SolutionEntity, amount, true, temp);
|
2021-11-20 16:47:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|