Skip to content
GrandSong edited this page Nov 1, 2016 · 2 revisions

This property requires further investigation

##Overview

Entities

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 the Properties DoesNotTire setting in their materials.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



Guides:

  • [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):

Psuedo-Types:

  • [Rotation table](Rotation table)
  • [Id table](Id table)
  • [Location table](Location table)
  • [Velocity table](Velocity table)

[Methods](Object Methods):

[Properties](Object Properties):

Clone this wiki locally