CorsixTH Lua Documentation

Plant Class

An `Object` which needs watering now and then.

Declared on: line 90 of Lua/objects/plant.lua.
Inheritance: Plant » Object » Entity

Method Index

Member Index

(*) only used in superclass methods
function Plant:Plant(hospital, object_type, x, y, direction, etc)

Parameters:

NameTypeDescription
hospital ? ?
object_type ? ?
x ? ?
y ? ?
direction ? ?
etc ? ?

Declared on: line 96 of Lua/objects/plant.lua.

function Plant:afterLoad(old, new)

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Object:afterLoad.
Declared on: line 317 of Lua/objects/plant.lua.

function Plant:callForWatering()

When the plant needs water it periodically calls for a nearby handyman.

Declared on: line 168 of Lua/objects/plant.lua.

function Plant:createHandymanActions(handyman)

When a handyman is about to be summoned this function queues the complete set of actions necessary, including entering and leaving any room involved. It also queues a meander action at the end. Note that if there are more plants that need watering inside the room he will continue to water those too before leaving.

Parameters:

NameTypeDescription
handyman Staff The handyman that is about to get the actions.

Declared on: line 191 of Lua/objects/plant.lua.

function Plant:getBestUsageTileXY(from_x, from_y)

When a handyman should go to the plant he should approach it from the closest reachable tile within hospital buildings.

Parameters:

NameTypeDescription
from_x integer The x coordinate of tile to calculate from.
from_y integer The y coordinate of tile to calculate from.

Declared on: line 231 of Lua/objects/plant.lua.

function Plant:isDying()

Check if a plant is dying or about to start dying

Declared on: line 301 of Lua/objects/plant.lua.

function Plant:isPleasingFactor()

Plant health/state should be used on evaluations of pleasantness

returns (integer) score of this plants health, 1 to 5 (best)

Declared on: line 295 of Lua/objects/plant.lua.

function Plant:needsWatering()

Returns whether the plant is in need of watering right now.

Declared on: line 163 of Lua/objects/plant.lua.

function Plant:onClick(ui, button)

The plant needs to retain its animation and reset its unreachable flag when being moved

Parameters:

NameTypeDescription
ui ? ?
button ? ?

Overrides: Object:onClick.
Declared on: line 285 of Lua/objects/plant.lua.

function Plant:restoreToFullHealth()

Restores the plant to its initial state. (i.e. healthy)

Declared on: line 133 of Lua/objects/plant.lua.

function Plant:setNextState(restoring)

Goes one step forward (or backward) in the states of the plant.

Parameters:

NameTypeDescription
restoring boolean If true the plant improves its health instead of drooping.

Declared on: line 108 of Lua/objects/plant.lua.

function Plant:tick()

Overridden since the plant animates slowly over time

Overrides: Object:tick.
Declared on: line 147 of Lua/objects/plant.lua.

function Plant:tickDay()

Counts down to eventually let the plant droop.

Overrides: Entity:tickDay.
Declared on: line 264 of Lua/objects/plant.lua.