1718 {
1720 {
1721 float available_energy =
AddEnergy(-amount);
1722
1723 if (available_energy < 0 &&
IsPlugged())
1724 {
1725
1727
1728 if (next_power_source && next_power_source != original_caller)
1729 {
1730 return next_power_source.GetCompEM().FindAndConsumeEnergy(original_caller, -available_energy);
1731 }
1732 }
1733
1734 if (available_energy >= 0)
1735 {
1736 return true;
1737 }
1738
1739 return false;
1740 }
1741 else
1742 {
1743 return false;
1744 }
1745 }
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....