2026-06-13 04:56:50 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2020-12-22 03:13:43 +00:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-05-26 01:12:06 +01:00
|
|
|
using System.Linq;
|
2021-04-18 05:13:20 +01:00
|
|
|
public class Thermotoggle : Behavior
|
2020-05-26 01:12:06 +01:00
|
|
|
{
|
2020-06-07 03:21:47 +01:00
|
|
|
public float TargetTemperature;
|
2026-06-15 17:54:59 +01:00
|
|
|
public bool Adjustable { get; }
|
|
|
|
|
private readonly bool _highPass;
|
2020-05-26 01:12:06 +01:00
|
|
|
|
2026-06-15 19:20:06 +01:00
|
|
|
public Thermotoggle(RuntimeBehaviorDefinition definition, EquippedItem item) : base(definition, item)
|
2021-04-18 05:13:20 +01:00
|
|
|
{
|
2026-06-15 19:20:06 +01:00
|
|
|
TargetTemperature = definition.Float(1);
|
|
|
|
|
_highPass = definition.Bool(2);
|
|
|
|
|
Adjustable = definition.Bool(3);
|
2021-04-18 05:13:20 +01:00
|
|
|
}
|
2026-06-15 19:20:06 +01:00
|
|
|
|
|
|
|
|
public Thermotoggle(RuntimeBehaviorDefinition definition, ConsumableItemEffect item) : base(definition, item)
|
2020-05-26 01:12:06 +01:00
|
|
|
{
|
2026-06-15 19:20:06 +01:00
|
|
|
TargetTemperature = definition.Float(1);
|
|
|
|
|
_highPass = definition.Bool(2);
|
|
|
|
|
Adjustable = definition.Bool(3);
|
2020-05-26 01:12:06 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-18 05:13:20 +01:00
|
|
|
public override bool Execute(float dt)
|
2020-05-26 01:12:06 +01:00
|
|
|
{
|
2026-06-15 17:54:59 +01:00
|
|
|
return Temperature < TargetTemperature ^ _highPass;
|
2020-05-26 01:12:06 +01:00
|
|
|
}
|
2026-06-15 17:54:59 +01:00
|
|
|
}
|