Entities such as colonies and ships can now be clicked on to reveal their properties or context menus Orbital Colony loadout now has a new item (thermostatic heater) which itself has a new behavior type (Thermotoggle) allowing it to regulate its temperature for more agreeable living conditions Fixed stat modifiers for hull stats (e.g. Hull Expansion) Widened property label in DB inspector
43 lines
No EOL
1.1 KiB
C#
43 lines
No EOL
1.1 KiB
C#
using System;
|
|
using System.Linq;
|
|
using MessagePack;
|
|
using Newtonsoft.Json;
|
|
|
|
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(-22)]
|
|
public class ThermotoggleData : BehaviorData
|
|
{
|
|
[TemperatureInspectable, JsonProperty("targetTemp"), Key(1)]
|
|
public float TargetTemperature;
|
|
|
|
[InspectableField, JsonProperty("perSecond"), Key(2)]
|
|
public bool HighPass;
|
|
|
|
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
|
{
|
|
return new Thermotoggle(context, this, entity, item);
|
|
}
|
|
}
|
|
|
|
public class Thermotoggle : IBehavior
|
|
{
|
|
private ThermotoggleData _data;
|
|
|
|
private Entity Entity { get; }
|
|
private Gear Item { get; }
|
|
private GameContext Context { get; }
|
|
|
|
public BehaviorData Data => _data;
|
|
|
|
public Thermotoggle(GameContext context, ThermotoggleData data, Entity entity, Gear item)
|
|
{
|
|
_data = data;
|
|
Entity = entity;
|
|
Item = item;
|
|
Context = context;
|
|
}
|
|
|
|
public bool Update(float delta)
|
|
{
|
|
return Entity.Temperature < _data.TargetTemperature ^ _data.HighPass;
|
|
}
|
|
} |