38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using Content.Shared.Temperature.Components;
|
|
using Content.Shared.Temperature.Systems;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.EntityEffects.Effects;
|
|
|
|
// TODO: When we get a proper temperature/energy struct combine this with the solution temperature effect!!!
|
|
/// <summary>
|
|
/// Adjusts the temperature of this entity.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
|
|
public sealed partial class AdjustTemperatureEntityEffectSystem : EntityEffectSystem<TemperatureComponent, AdjustTemperature>
|
|
{
|
|
[Dependency] private readonly SharedTemperatureSystem _temperature = default!;
|
|
protected override void Effect(Entity<TemperatureComponent> entity, ref EntityEffectEvent<AdjustTemperature> args)
|
|
{
|
|
var amount = args.Effect.Amount * args.Scale;
|
|
|
|
_temperature.ChangeHeat(entity, amount, true, entity.Comp);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="EntityEffect"/>
|
|
public sealed partial class AdjustTemperature : EntityEffectBase<AdjustTemperature>
|
|
{
|
|
/// <summary>
|
|
/// Amount we're adjusting temperature by.
|
|
/// </summary>
|
|
[DataField]
|
|
public float Amount;
|
|
|
|
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
=> Loc.GetString("entity-effect-guidebook-adjust-temperature",
|
|
("chance", Probability),
|
|
("deltasign", MathF.Sign(Amount)),
|
|
("amount", Amount));
|
|
}
|