CorsixTH Lua Documentation

Machine Class

An `Object` which needs occasional repair (to prevent explosion).

Declared on: line 23 of Lua/entities/machine.lua.
Inheritance: Machine » Object » Entity
Subclasses: OperatingTable

Method Index

Member Index

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

Parameters:

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

Declared on: line 29 of Lua/entities/machine.lua.

function Machine:afterLoad(old, new)

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Object:afterLoad.
Declared on: line 503 of Lua/entities/machine.lua.

function Machine:calculateIsMachineMustExplode(room)

Call on machine use. Handles crashing the machine

Parameters:

NameTypeDescription
room ? ?

Declared on: line 196 of Lua/entities/machine.lua.

function Machine:callHandymanForRepairIfNecessary(room)

Call on machine use.

Parameters:

NameTypeDescription
room object machine room

Declared on: line 168 of Lua/entities/machine.lua.

function Machine:createHandymanActions(handyman)

Parameters:

NameTypeDescription
handyman ? ?

Declared on: line 296 of Lua/entities/machine.lua.

function Machine:earthquakeImpact(room)

Function defines the machine's reaction to an earthquake.

During an earthquake, this function is called one or several times.

Parameters:

NameTypeDescription
room object machine room

Declared on: line 119 of Lua/entities/machine.lua.

function Machine:explodeMachine(room)

Call on machine explode. Handles machine and room exploding

Parameters:

NameTypeDescription
room object machine room

Declared on: line 228 of Lua/entities/machine.lua.

function Machine:finalize(room)

Currently used to make the hover cursor of the machine be special only if the room is active at the moment (e.g. not being edited)

Parameters:

NameTypeDescription
room object machine room

Declared on: line 447 of Lua/entities/machine.lua.

function Machine:getRemainingUses()

Calculates the number of times the machine can be used before crashing (unless repaired first)

Declared on: line 60 of Lua/entities/machine.lua.

function Machine:getSmokeDrawingLayer()

Access the dedicated DrawingLayer for the smoke animation attached to this machine

Declared on: line 590 of Lua/entities/machine.lua.

function Machine:getState()

Gets the state of a machine

In addition to the object implementation this includes total_usage

Overrides: Object:getState.
Declared on: line 531 of Lua/entities/machine.lua.

function Machine:incrementUsageCounts(total_usage_only, is_earthquake)

Call after use of the machine.

Parameters:

NameTypeDescription
total_usage_only ? ?
is_earthquake ? ?

Declared on: line 157 of Lua/entities/machine.lua.

function Machine:isBreaking()

Returns true if a machine is smoking/needs repair

Declared on: line 66 of Lua/entities/machine.lua.

function Machine:machineRepaired(room, strength_reducible)

Call on machine repaired.

Parameters:

NameTypeDescription
room object machine room
strength_reducible bool machine room

Declared on: line 371 of Lua/entities/machine.lua.

function Machine:machineUsed(room, earthquake_activated)

Call on machine use.

Parameters:

NameTypeDescription
room object machine room
earthquake_activated boolean If true, machine was damaged by an active earthquake

Declared on: line 127 of Lua/entities/machine.lua.

function Machine:notifyNewRoom(room)

Parameters:

NameTypeDescription
room object machine room

Overrides: Entity:notifyNewRoom.
Declared on: line 48 of Lua/entities/machine.lua.

function Machine:onClick(ui, button)

Parameters:

NameTypeDescription
ui ? ?
button ? ?

Overrides: Object:onClick.
Declared on: line 480 of Lua/entities/machine.lua.

function Machine:placed(room)

Call on machine place.

Parameters:

NameTypeDescription
room object machine room

Declared on: line 283 of Lua/entities/machine.lua.

function Machine:reduceStrengthOnRepair()

Calculates if machine strength should be reduced as a result of repair

Declared on: line 396 of Lua/entities/machine.lua.

function Machine:removeHandymanRepairTask()

Call on machine repaired. Removes repair task for that machine.

Declared on: line 386 of Lua/entities/machine.lua.

function Machine:removeRepairingStatus()

Remove the room's repair status. Unlock room and remove gear icon.

Declared on: line 423 of Lua/entities/machine.lua.

function Machine:replaceMachine(cost)

Replace this machine (make it pretend it's brand new)

Parameters:

NameTypeDescription
cost int Cost to replace the machine

Declared on: line 349 of Lua/entities/machine.lua.

function Machine:setHandymanRepairPosition(direction)

Calculate handyman use position based on object orientation

or the normal use position if one not available

Parameters:

NameTypeDescription
direction string orientation of object

Declared on: line 557 of Lua/entities/machine.lua.

function Machine:setRepairingStatus()

Set the room's repair status manually. Lock room and show gear icon.

Declared on: line 411 of Lua/entities/machine.lua.

function Machine:setState(state)

Sets the state of a machine

Adds total_usage

Parameters:

NameTypeDescription
state table table holding the state

Overrides: Object:setState.
Declared on: line 543 of Lua/entities/machine.lua.

function Machine.slaveMixinClass(class_method_table)

Parameters:

NameTypeDescription
class_method_table ? ?

Overrides: Object.slaveMixinClass.
Declared on: line 438 of Lua/entities/machine.lua.
Note: Is a function rather than a method.

function Machine:updateSmokeDisplay(room)

Calculates whether smoke gets displayed for this machine (and if so, how much)

Parameters:

NameTypeDescription
room object machine room

Declared on: line 257 of Lua/entities/machine.lua.