obj.Energy - originalfoo/Prison-Architect-API GitHub Wiki
This property requires further investigation
##Overview
This property is applicable to all (need to check) Entities and determines how much energy they have remaining.
##Syntax
-- get:
local energy = someEntity.Energy -- <number>
-- set:
someEntity.Energy = <number>Where <number> is an integer in the range 0 to 100:
- A value of
0means they have no energy left - A value of
100means they have full energy
##Example
-- give nearby Guard entities full energy
-- shortcuts:
local find = this.GetNearbyObjects
for guard in next, find( 'Guard', 50 ) do
guard.Energy = 100
end##Example Mods
-
Tired Armed Guards mod - allows [
ArmedGuardentities](ArmedGuard (Entity)) to become tired and makes them rest in the [Armouryroom](Armoury (Room)).
##Notes
This property appears to exist on all Entities:
- An entities'
.Energywill automatically decrease throughout the day, unless they have thePropertiesDoesNotTiresetting in theirmaterials.txtdefinition block - While [
Prisonerentities](Prisoner (Entity)) also have the property, their resting requirements are primarily handled by their.Needs.Sleep(need to test whether their.Energyplays a role in that)
##See Also
The value of Energy can be below 0 and thus make the entity exhausted and unable to move.
The prisoners' Sleep need is just a need and has nothing to do with Energy.
-- Contributor: GrandSong
