CorsixTH Lua Documentation

Object Class

An `Entity` which occupies at least a single map tile and does not move.

Declared on: line 23 of Lua/entities/object.lua.
Inheritance: Object ยป Entity
Subclasses: AtomAnalyser, Bench, Chair, Door, EntranceDoor, Helicopter, Machine, OperatingSink, Plant, RadiationShield, Rathole, ReceptionDesk, SideObject, SurgeonScreen

Method Index

Member Index

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

Parameters:

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

Declared on: line 36 of Lua/entities/object.lua.

function Object:_getUsageTile(usage_position_name)

param usage_position_name (string) usage position name

return (table) table with {x, y, usage_position_name} table

Parameters:

NameTypeDescription
usage_position_name ? ?

Declared on: line 276 of Lua/entities/object.lua.

function Object:addReservedUser(user)

Adds a reserved user for this object. If multiple_users_allowed is set there can be many users reserving the object. reserved_for will then be the user who most recently reserved this object.

Parameters:

NameTypeDescription
user ? ?

Declared on: line 677 of Lua/entities/object.lua.

function Object:afterLoad(old, new)

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Entity:afterLoad.
Declared on: line 892 of Lua/entities/object.lua.

function Object:deoccupyTilesByObjectFootprintAt(x, y)

param x (integer) target tile x coordinate.

param y (integer) target tile y coordinate.

Parameters:

NameTypeDescription
x ? ?
y ? ?

Declared on: line 551 of Lua/entities/object.lua.

function Object.directionParameters()

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

function Object:getAllUsageTiles()

object use positions

return (table) use positions offsets

Declared on: line 333 of Lua/entities/object.lua.

function Object.getComplementaryPassableFlag(passable_flag)

param passable_flag (string) 'passable_flag' that we want to invert.

return (string) inverted 'passable_flag'.

Parameters:

NameTypeDescription
passable_flag ? ?

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

function Object:getRenderAttachTile()

Get the primary tile which the object is attached to for rendering

For objects which attach to a single tile for rendering, this method will return the X and Y Lua world coordinates of that tile. For objects which split their rendering over multiple tiles, one of them is arbitrarily designated as the primary tile, and its coordinates are returned.

Declared on: line 243 of Lua/entities/object.lua.

function Object:getSecondaryUsageTile()

This function returns tile offset coordinate for "use_position_secondary"

return (int, int) x, y tile offset

Declared on: line 346 of Lua/entities/object.lua.

function Object:getState()

Gets the state of an object

The state can be later used to set the state of this object. This is useful when we would destroy and create a new object that should represent the same object.

Declared on: line 1049 of Lua/entities/object.lua.

function Object:getWalkableTiles()

This function returns a list of all "only_passable" tiles belonging to an object. It must be overridden by objects which do not have a footprint, but walkable tiles (e.g. doors of any kind)

Declared on: line 358 of Lua/entities/object.lua.

function Object:getXYforUsePosition(object_x, object_y, object_layout, usage_position_name)

param usage_position_name (string) usage position name.

return (array) array with '{x, y, usage_position_name}' tables inside.

Parameters:

NameTypeDescription
object_x ? ?
object_y ? ?
object_layout ? ?
usage_position_name ? ?

Declared on: line 291 of Lua/entities/object.lua.

function Object:incrementUsedCount()

Call on object used. After object used increment use values accordingly.

Declared on: line 263 of Lua/entities/object.lua.

function Object:initOrientation(direction)

Initializes the footprint, finds out what to draw and checks for split animations.

Parameters:

NameTypeDescription
direction ? The orientation in which the object is facing.

Declared on: line 61 of Lua/entities/object.lua.

function Object:isMachine()

This function is for overriding it in the inheriting Machine class.

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

function Object:isReservedFor(user)

Checks whether the object is reserved for the specified user. If the argument is nil a check for any reserved user is done.

Parameters:

NameTypeDescription
user ? ?

Declared on: line 724 of Lua/entities/object.lua.

function Object:occupyTilesByObjectFootprintAt(x, y)

param x (integer) target tile x coordinate.

param y (integer) target tile y coordinate.

Parameters:

NameTypeDescription
x ? ?
y ? ?

Declared on: line 462 of Lua/entities/object.lua.

function Object:onClick(ui, button, data)

Called when the object is clicked

Parameters:

NameTypeDescription
ui UI The active ui.
button string Which button was clicked.
data table If some data should be retained after moving an object it is in this table.

Declared on: line 755 of Lua/entities/object.lua.

function Object.processTypeDefinition(object_type)

Parameters:

NameTypeDescription
object_type ? ?

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

function Object:removeReservedUser(user)

If multiple_users_allowed is true: Removes the user specified from this object's list of reserved users. If the argument is nil it is assumed that the list should be emptied. Note that if there are many humanoids reserving this object reserved_for might still be set after a call to this function. Otherwise: sets reserved_for to nil.

Parameters:

NameTypeDescription
user ? ?

Declared on: line 693 of Lua/entities/object.lua.

function Object:removeUser(user)

Removes a user from the set of users if multiple_users_allowed is set to true for this object. Otherwise it sets "user" to nil. Please don't directly change the variable "user".

Parameters:

NameTypeDescription
user ? ?

Declared on: line 647 of Lua/entities/object.lua.

function Object:setAnimation(animation, flags)

Parameters:

NameTypeDescription
animation ? ?
flags ? ?

Overrides: Entity:setAnimation.
Declared on: line 223 of Lua/entities/object.lua.

function Object:setInvisible(invisible)

Set object invisible state.

param invisible (bool) 'true' to make the object invisible, 'false' to make the object visible.

Parameters:

NameTypeDescription
invisible ? ?

Declared on: line 609 of Lua/entities/object.lua.

function Object:setPosition(x, y)

Parameters:

NameTypeDescription
x ? ?
y ? ?

Overrides: Entity:setPosition.
Declared on: line 207 of Lua/entities/object.lua.

function Object:setState(state)

Sets the state of an object

This is a complement to a pair function. IT will use the generated state table to update it's state.

Parameters:

NameTypeDescription
state table table holding the state

Declared on: line 1061 of Lua/entities/object.lua.

function Object:setTile(x, y)

Parameters:

NameTypeDescription
x ? ?
y ? ?

Overrides: Entity:setTile.
Declared on: line 395 of Lua/entities/object.lua.

function Object:setUser(user)

Sets the user of this object to the given user. Note that if multiple_users_allowed is set to true for this object "user" will always be the last added user to this object. Please do not modify object.user directly.

Parameters:

NameTypeDescription
user ? The user that is about to use this object.

Declared on: line 630 of Lua/entities/object.lua.

function Object.slaveMixinClass(class_method_table)

Add methods to a class for creating and controlling a slave object

Parameters:

NameTypeDescription
class_method_table ? ?

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

function Object:updateDynamicInfo()

Updates the object's dynamic info

Declared on: line 268 of Lua/entities/object.lua.

function Object:usePositionNames()

This function returns an array with use positions names

return (array) use positions names

Declared on: line 320 of Lua/entities/object.lua.