1748 {
1750 {
1751 float available_energy =
AddEnergy(-amount);
1752
1753 if (available_energy < 0 &&
IsPlugged())
1754 {
1755
1757
1758 if (next_power_source && next_power_source != original_caller)
1759 {
1760 return next_power_source.GetCompEM().FindAndConsumeEnergy(original_caller, -available_energy);
1761 }
1762 }
1763
1764 if (available_energy >= 0)
1765 {
1766 return true;
1767 }
1768
1769 return false;
1770 }
1771 else
1772 {
1773 return false;
1774 }
1775 }
float AddEnergy(float added_energy)
Energy manager: Adds energy to this device and clamps it within its min/max storage limits....
bool IsPlugged()
Energy manager: Returns true if this device is plugged into some other device (even if they are OFF o...
EntityAI GetEnergySource()
Energy manager: Returns the energy source this device is plugged into.
bool IsSwitchedOn()
Energy manager: Returns state of the switch. Whenever the device is working or not does not matter....