Skip to content
aubergine10 edited this page Dec 6, 2015 · 6 revisions

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

^ 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