obj.Energy
GrandSong edited this page Nov 1, 2016
·
2 revisions
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
0
means they have no energy left - A value of
100
means 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 [
ArmedGuard
entities](ArmedGuard (Entity)) to become tired and makes them rest in the [Armoury
room](Armoury (Room)).
##Notes
This property appears to exist on all Entities:
- An entities'
.Energy
will automatically decrease throughout the day, unless they have theProperties
DoesNotTire
setting in theirmaterials.txt
definition block - While [
Prisoner
entities](Prisoner (Entity)) also have the property, their resting requirements are primarily handled by their.Needs.Sleep
(need to test whether their.Energy
plays 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
^ Open "Pages" to Search
- [Lua Basics](Lua Basics Guide)
- [Save-Load Cycle](Save-Load Cycle Guide)
[Globals](Object Globals):
- [
Game
](Game (Global)) - [
me
](me (Global)) - [
Object
](Object (Global)) - [
this
](this (Global))
[Events](Object Events):
- [Rotation table](Rotation table)
- [Id table](Id table)
- [Location table](Location table)
- [Velocity table](Velocity table)
[Methods](Object Methods):
.ApplyVelocity()
.ClearRouting()
.CreateJob()
.Delete()
.GetNearbyObjects()
.LeaveMap()
.NavigateTo()
.Sound()
[Properties](Object Properties):
.Active
.Age
.AiSetTarget
.AiWalkSpeed
.AnimateRotation
.AnimateVelocity
.AssignedRoom
.Attacker
.AttackTimer
.AvailableMoney
.AvatarControl
.BodyArmour
.BoilingPoint
.BookInCell
.Carried
.CarrierId
.Carrying
.CarryingBook
.Category
.Cell
.CellId
.CellIdTimer
.CloseTimer
-
.Connections
⚠️ .Contents
.CutsceneActor
.Damage
.Dest
.Door
.Driver
.Energy
.Equipment
.Entity
-
.ExternalPower
⚠️ .FailedToFindCell
.FeedJobId
.FireEngine
.Fireman
.FollowerId
.Fuel
.Gang
.Garbage
.HealingJobId
.Hidden
.Hose
.HoseOffset
.Hostage
.Id
.Intensity
.IsExternalTeacher
.IsNewIntake
.JobId
.LastAccess
.LastAte
.LastTreated
.LastVisitors
.LeavingMap
.Library
.Loaded
.Locked
.Misbehaviour
.Mode
.Naked
.Name
.Needs
.Office
-
.On
⚠️ .Open
.OpenDir
.Opened
.OpenOnTrigger
.OpenTimer
.Operation
.OperationTimer
.Or
.Patrol
.PermitPlayerControl
.PlayerOrderPos
.Pos
-
.Powered
⚠️ .Prisoner
.ProcessingRoom
.Quantity
.ReloadTimer
.RemotelyOpenable
.RequiredCellType
.RestState
.Result
.RotateDir
.SectorTimer
.Shackled
.Slot0..7
.SnitchTimer
.Speed
.State
.Station
.StatusEffects
.SubType
.TargetObject
.TazerTrained
.TimeOfLastMisconduct
.Timer
.Tooltip
.Triggered
.TriggeredBy
.TriggeredTime
.Type
.UnlockingDoor
.Vel
.WallCheckTimer
.Walls
.WatchingFight
.Weight
-
.Wired
⚠️ .WorldObject