1685 {
1687 {
1688 float available_energy =
AddEnergy(-amount);
1689
1690 if ( available_energy < 0 &&
IsPlugged() )
1691 {
1692
1694
1695 if (next_power_source && next_power_source != original_caller)
1696 {
1697 return next_power_source.GetCompEM().FindAndConsumeEnergy( original_caller, -available_energy );
1698 }
1699 }
1700
1701 if ( available_energy >= 0)
1702 {
1703 return true;
1704 }
1705
1706 return false;
1707 }
1708 else
1709 {
1710 return false;
1711 }
1712 }
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....