Centralized Energy Generation

Energy consumption is now handled by the entity code via the TryConsumeEnergy function, will return false when out of power.
This commit is contained in:
Reinier Vens 2021-03-02 23:02:19 +00:00
commit 56f97d82f9
7 changed files with 120 additions and 54 deletions

View file

@ -42,7 +42,6 @@ public class EnergyDraw : IBehavior
public bool Execute(float delta)
{
Entity.Energy -= Context.Evaluate(_data.EnergyDraw, Item.EquippableItem, Entity) * (_data.PerSecond ? delta : 1);
return true;
return Entity.TryConsumeEnergy(Context.Evaluate(_data.EnergyDraw, Item.EquippableItem, Entity) * (_data.PerSecond ? delta : 1));
}
}