Humanoid Class
An `Entity` which occupies a single tile and is capable of moving around the map.
Inheritance: Humanoid ยป Entity
Subclasses: Patient, Staff, Vip
Method Index
- _tick() (inherited from Entity)
- afterLoad(old, new) (overrides Entity:afterLoad)
- changeAttribute(attribute, amount)
- clearDynamicInfo() (inherited from Entity)
- dump()
- finishAction(action)
- getCurrentMood()
- getDrawingLayer() (overrides Entity:getDrawingLayer)
- getDynamicInfo() (inherited from Entity)
- getIdleAnimation(humanoid_class)
- getRoom() (overrides Entity:getRoom)
- goingToUseObject(object_type)
- handleRemovedObject(object)
- hasLeavingAction()
- isLeaving()
- isMoodActive(mood)
- notifyNewObject(id) (inherited from Entity)
- onClick(ui, button)
- onDestroy() (overrides Entity:onDestroy)
- playSound(name) (inherited from Entity)
- queueAction(action, pos)
- registerRoomBuildCallback(callback)
- registerRoomRemoveCallback(callback)
- resetAnimation() (inherited from Entity)
- setAnimation(animation, flags) (inherited from Entity)
- setCallCompleted()
- setDynamicInfo(type, value) (inherited from Entity)
- setHospital(hospital)
- setLayer(layer, id) (inherited from Entity)
- setMood(mood_name, activate) (overrides Entity:setMood)
- setMoodInfo(new_mood) (inherited from Entity)
- setNextAction(action, high_priority)
- setPosition(x, y) (inherited from Entity)
- setSpeed(x, y) (inherited from Entity)
- setTile(x, y) (inherited from Entity)
- setTilePositionSpeed(tx, ty, px, py, sx, sy) (inherited from Entity)
- setTimer(tick_count, f) (inherited from Entity)
- setType(humanoid_class)
- tick() (inherited from Entity)
- tickDay() (overrides Entity:tickDay)
- tire(amount)
- unregisterCallbacks()
- unregisterRoomBuildCallback(callback)
- unregisterRoomRemoveCallback(callback)
- updateSpeed()
- wake(amount)
- walkTo(tile_x, tile_y, must_happen)
Member Index
- action_queue
- active_moods
- animation_flags (*)
- animation_idx (*)
- associated_desk
- attributes
- build_callback
- build_callbacks
- check_watch_anim
- die_anims
- door_anims
- dynamic_info (*)
- falling_anim
- get_up_anim
- going_home
- has_fallen
- has_vomitted
- hospital
- humanoid_class
- in_room
- last_move_direction
- layers (*)
- message_callback
- mood_info
- num_animation_ticks (*)
- on_call
- on_ground_anim
- pee_anim
- permanent_flags
- previous_action
- profile
- remove_callbacks
- shake_fist_anim
- should_knock_on_doors
- skip_next_tick (*)
- slow_animation (*)
- speed
- tap_foot_anim
- th
- ticks (*)
- tile_x
- tile_y
- timer_function (*)
- timer_time (*)
- toilet_callback
- user_of (*)
- vomit_anim
- walk_anims
- world
- yawn_anim
function Humanoid:Humanoid(...)
Parameters:
Name | Type | Description |
---|---|---|
... | ? | Arguments for base class constructor. |
Declared on: line 273 of Lua/entities/humanoid.lua.
function Humanoid:afterLoad(old, new)
Save game compatibility
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
action | ? | ? |
Declared on: line 634 of Lua/entities/humanoid.lua.
function Humanoid:getDrawingLayer()
Overrides: Entity:getDrawingLayer.
Declared on: line 876 of Lua/entities/humanoid.lua.
function Humanoid.getIdleAnimation(humanoid_class)
Parameters:
Name | Type | Description |
---|---|---|
humanoid_class | ? | ? |
Declared on: line 474 of Lua/entities/humanoid.lua.
Note: Is a function rather than a method.
function Humanoid:getRoom()
Overrides: Entity:getRoom.
Declared on: line 336 of Lua/entities/humanoid.lua.
function Humanoid:goingToUseObject(object_type)
Helper function that finds out if there is an action queued to use the specified object
Parameters:
Name | Type | Description |
---|---|---|
object_type | ? | ? |
Declared on: line 804 of Lua/entities/humanoid.lua.
function Humanoid:handleRemovedObject(object)
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
action | ? | ? |
pos | ? | ? |
Declared on: line 621 of Lua/entities/humanoid.lua.
function Humanoid:registerRoomBuildCallback(callback)
Registers a new build callback for this humanoid.
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
mood_name | ? | ? |
activate | ? | ? |
Overrides: Entity:setMood.
Declared on: line 426 of Lua/entities/humanoid.lua.
function Humanoid:setNextAction(action, high_priority)
Parameters:
Name | Type | Description |
---|---|---|
action | ? | ? |
high_priority | ? | ? |
Declared on: line 562 of Lua/entities/humanoid.lua.
function Humanoid:setType(humanoid_class)
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
callback | function | The callback to remove. |
Declared on: line 847 of Lua/entities/humanoid.lua.
function Humanoid:wake(amount)
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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.