obj.Age - originalfoo/Prison-Architect-API GitHub Wiki

This property needs further investigation

##Overview

This property, which is found on Garbage, Tree and Prisoner objects, defines their age.

##Syntax

-- get:
local age = obj.Age -- <number> or nil

-- set:
obj.Age = <number> -- not tested

Values:

  • <number> - a number representing the age of the object (in game seconds = prison minutes)
  • nil - the object does not have an age property

##Example

-- if garbage is too old, let's destroy it

local maxAge = 720 -- 60 prison mins * 12hrs (12 real-life minutes)

local find = this.GetNearbyObjects

for garbage in next, find( 'Garbage', 9001 ) do

  if garbage.Age > maxAge then

    garbage.Delete()

  end

end

##Notes

Prisoners seem to be given an random starting age when they first arrive in the prison. In the case of Garbage and Trees, their age starts at 0 when they are first placed on the map. Trees that are auto-generated during map creation start with an age of 7200.000.

The age of a tree is used to determine which SubType (sprite) is used so that the trees will grow from a sapling to a mature tree over time. Testing is needed to determine what age ranges relate to each SubType.

##See Also

⚠️ **GitHub.com Fallback** ⚠️