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;
|
2024-06-30 05:43:43 +02:00
|
|
|
using Content.Shared.EntityEffects;
|
2023-06-04 16:45:02 -04:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-20 16:47:53 -07:00
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
namespace Content.Server.EntityEffects.Effects
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
2024-06-30 05:43:43 +02:00
|
|
|
public sealed partial class AdjustTemperature : EntityEffect
|
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)));
|
|
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
public override void Effect(EntityEffectBaseArgs args)
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
2024-06-30 05:43:43 +02:00
|
|
|
if (args.EntityManager.TryGetComponent(args.TargetEntity, 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;
|
|
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
if (args is EntityEffectReagentArgs reagentArgs)
|
|
|
|
|
{
|
|
|
|
|
amount *= reagentArgs.Scale.Float();
|
|
|
|
|
}
|
2022-12-21 09:51:49 -05:00
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
sys.ChangeHeat(args.TargetEntity, amount, true, temp);
|
2021-11-20 16:47:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|