CorsixTH Lua Documentation

Humanoid Class

An `Entity` which occupies a single tile and is capable of moving around the map.

Declared on: line 21 of Lua/entities/humanoid.lua.
Inheritance: Humanoid ยป Entity
Subclasses: Patient, Staff, Vip

Method Index

Member Index

(*) only used in superclass methods
function Humanoid:Humanoid(...)

Parameters:

NameTypeDescription
... ? Arguments for base class constructor.

Declared on: line 273 of Lua/entities/humanoid.lua.

function Humanoid:afterLoad(old, new)

Save game compatibility

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Entity:afterLoad.
Declared on: line 292 of Lua/entities/humanoid.lua.

function Humanoid:changeAttribute(attribute, amount)

Adjusts one of the `Humanoid`'s attributes.

Parameters:

NameTypeDescription
attribute string One of: "happiness", "thirst", "toilet_need", "warmth".
amount number This amount is added to the existing value for the attribute, and is then capped to be between 0 and 1.

Declared on: line 750 of Lua/entities/humanoid.lua.

function Humanoid:finishAction(action)

Parameters:

NameTypeDescription
action ? ?

Declared on: line 634 of Lua/entities/humanoid.lua.

function Humanoid.getIdleAnimation(humanoid_class)

Parameters:

NameTypeDescription
humanoid_class ? ?

Declared on: line 474 of Lua/entities/humanoid.lua.
Note: Is a function rather than a method.

function Humanoid:goingToUseObject(object_type)

Helper function that finds out if there is an action queued to use the specified object

Parameters:

NameTypeDescription
object_type ? ?

Declared on: line 804 of Lua/entities/humanoid.lua.

function Humanoid:handleRemovedObject(object)

Parameters:

NameTypeDescription
object ? ?

Declared on: line 718 of Lua/entities/humanoid.lua.

function Humanoid:hasLeavingAction()

Check if there is "is_leaving" action in the action queue

Declared on: line 649 of Lua/entities/humanoid.lua.

function Humanoid:isLeaving()

Check if the humanoid is running actions intended to leave the room, as indicated by the flag

Declared on: line 644 of Lua/entities/humanoid.lua.

function Humanoid:isMoodActive(mood)

Is the given mood in the list of active moods.

Parameters:

NameTypeDescription
mood ? ?

Declared on: line 464 of Lua/entities/humanoid.lua.

function Humanoid:onClick(ui, button)

Function which is called when the user clicks on the `Humanoid`.

Parameters:

NameTypeDescription
ui GameUI The UI which the user in question is using.
button string One of: "left", "middle", "right".

Declared on: line 327 of Lua/entities/humanoid.lua.

function Humanoid:onDestroy()

Called when the humanoid is about to be removed from the world.

Overrides: Entity:onDestroy.
Declared on: line 394 of Lua/entities/humanoid.lua.

function Humanoid:queueAction(action, pos)

Parameters:

NameTypeDescription
action ? ?
pos ? ?

Declared on: line 621 of Lua/entities/humanoid.lua.

function Humanoid:registerRoomBuildCallback(callback)

Registers a new build callback for this humanoid.

Parameters:

NameTypeDescription
callback function The callback to call when a room has been built.

Declared on: line 814 of Lua/entities/humanoid.lua.

function Humanoid:registerRoomRemoveCallback(callback)

Registers a new remove callback for this humanoid.

Parameters:

NameTypeDescription
callback function The callback to call when a room has been removed.

Declared on: line 836 of Lua/entities/humanoid.lua.

function Humanoid:setHospital(hospital)

Set the `Hospital` which is responsible for treating or employing the `Humanoid`. In single player games, this has little effect, but it is very important in multiplayer games.

Parameters:

NameTypeDescription
hospital Hospital or nil The `Hospital` which should be responsible for the `Humanoid`. If nil, then the `Humanoid` is despawned.

Declared on: line 408 of Lua/entities/humanoid.lua.

function Humanoid:setMood(mood_name, activate)

Function to activate/deactivate moods of a humanoid. If mood_name is nil it is considered a refresh only.

Parameters:

NameTypeDescription
mood_name ? ?
activate ? ?

Overrides: Entity:setMood.
Declared on: line 426 of Lua/entities/humanoid.lua.

function Humanoid:setNextAction(action, high_priority)

Parameters:

NameTypeDescription
action ? ?
high_priority ? ?

Declared on: line 562 of Lua/entities/humanoid.lua.

function Humanoid:setType(humanoid_class)

Parameters:

NameTypeDescription
humanoid_class ? ?

Declared on: line 659 of Lua/entities/humanoid.lua.

function Humanoid:tickDay()

Check if it is cold or hot around the humanoid and increase/decrease the feeling of warmth accordingly. Returns whether the calling function should proceed.

Overrides: Entity:tickDay.
Declared on: line 771 of Lua/entities/humanoid.lua.

function Humanoid:tire(amount)

Stub functions for handling fatigue. These are overridden by the staff subclass, but also defined here, so we can just call it on any humanoid

Parameters:

NameTypeDescription
amount ? ?

Declared on: line 706 of Lua/entities/humanoid.lua.

function Humanoid:unregisterCallbacks()

Function called when a humanoid is sent away from the hospital to prevent further actions taken as a result of a callback

Declared on: line 858 of Lua/entities/humanoid.lua.

function Humanoid:unregisterRoomBuildCallback(callback)

Unregisters a build callback for this humanoid.

Parameters:

NameTypeDescription
callback function The callback to remove.

Declared on: line 825 of Lua/entities/humanoid.lua.

function Humanoid:unregisterRoomRemoveCallback(callback)

Unregisters a remove callback for this humanoid.

Parameters:

NameTypeDescription
callback function The callback to remove.

Declared on: line 847 of Lua/entities/humanoid.lua.

function Humanoid:wake(amount)

Parameters:

NameTypeDescription
amount ? ?

Declared on: line 711 of Lua/entities/humanoid.lua.

function Humanoid:walkTo(tile_x, tile_y, must_happen)

Helper function for the common case of instructing a `Humanoid` to walk to a position on the map. Equivalent to calling `setNextAction` with a walk action.

Parameters:

NameTypeDescription
tile_x integer The X-component of the Lua tile co-ordinates of the tile to walk to.
tile_y integer The Y-component of the Lua tile co-ordinates of the tile to walk to.
must_happen boolean or nil If true, then the walk action will not be interrupted.

Declared on: line 688 of Lua/entities/humanoid.lua.

Page generated on Sat Feb 07, 2015 at 18:38:28 by LDocGen.