Plant Class
An `Object` which needs watering now and then.
Method Index
- _getUsageTile(usage_position_name) (inherited from Object)
- _tick() (inherited from Entity)
- addReservedUser(user) (inherited from Object)
- afterLoad(old, new) (overrides Object:afterLoad)
- callForWatering()
- cancelUsage() (inherited from Object)
- clearDynamicInfo() (inherited from Entity)
- createHandymanActions(handyman)
- denyReservation() (inherited from Object)
- deoccupyTilesByObjectFootprintAt(x, y) (inherited from Object)
- directionParameters() (inherited from Object)
- eraseObject() (inherited from Object)
- getAllUsageTiles() (inherited from Object)
- getBestUsageTileXY(from_x, from_y)
- getComplementaryPassableFlag(passable_flag) (inherited from Object)
- getDrawingLayer() (inherited from Entity)
- getDynamicInfo() (inherited from Entity)
- getRenderAttachTile() (inherited from Object)
- getRoom() (inherited from Entity)
- getSecondaryUsageTile() (inherited from Object)
- getState() (inherited from Object)
- getTile() (inherited from Entity)
- getWalkableTiles() (inherited from Object)
- getXYforUsePosition(object_x, object_y, object_layout, usage_position_name) (inherited from Object)
- incrementUsedCount() (inherited from Object)
- initOrientation(direction) (inherited from Object)
- isDying()
- isMachine() (inherited from Object)
- isPleasingFactor()
- isReservedFor(user) (inherited from Object)
- needsWatering()
- notifyNewObject(id) (inherited from Entity)
- notifyNewRoom(room) (inherited from Entity)
- occupyTilesByObjectFootprintAt(x, y) (inherited from Object)
- onClick(ui, button) (overrides Object:onClick)
- onDestroy() (inherited from Object)
- onPickUp() (inherited from Object)
- playAfterLoadSound() (inherited from Entity)
- playEntitySounds(name_pattern, min_silence_lengths, max_silence_lengths, num_silences) (inherited from Entity)
- playSound(name, played_callback, played_callback_delay) (inherited from Entity)
- processTypeDefinition(object_type) (inherited from Object)
- rebuildPassableCellFlags() (inherited from Object)
- removeReservedUser(user) (inherited from Object)
- removeUser(user) (inherited from Object)
- resetAnimation() (inherited from Object)
- resetUsageAndReservaton() (overrides Object:resetUsageAndReservaton)
- restoreToFullHealth()
- setAnimation(animation, flags) (inherited from Object)
- setDynamicInfo(type, value) (inherited from Entity)
- setInvisible(invisible) (inherited from Object)
- setLayer(layer, id) (inherited from Entity)
- setMood(mood_name, activate) (inherited from Entity)
- setMoodInfo(new_mood) (inherited from Entity)
- setNextState(restoring)
- setPosition(x, y) (inherited from Object)
- setSpeed(x, y) (inherited from Entity)
- setState(state) (inherited from Object)
- setTile(x, y) (inherited from Object)
- setTilePositionSpeed(tx, ty, px, py, sx, sy) (inherited from Entity)
- setTimer(tick_count, f) (inherited from Entity)
- setUser(user) (inherited from Object)
- setWaitingForSoundEffectsToBeTurnedOn() (inherited from Entity)
- slaveMixinClass(class_method_table) (inherited from Object)
- tick() (overrides Object:tick)
- tickDay() (overrides Entity:tickDay)
- updateDynamicInfo() (inherited from Object)
- usePositionNames() (inherited from Object)
Member Index
- animation_flags (*)
- animation_idx (*)
- base_frame
- current_frame
- current_state
- cycles
- days_left
- direction
- dynamic_info (*)
- footprint (*)
- hospital
- layers (*)
- mood_info (*)
- mood_marker (*)
- num_animation_ticks (*)
- object_type (*)
- orientation_before (*)
- permanent_flags (*)
- phase
- phases
- picked_up
- plant_announced
- playing_sounds_in_random_sequence (*)
- random_sound_sequence_parameters (*)
- reserved_for
- reserved_for_list (*)
- set_passable_flags (*)
- skip_next_tick (*)
- slow_animation (*)
- split_anim_positions (*)
- split_anims (*)
- th
- ticks
- tile_x
- tile_y
- timer_function
- timer_time
- times_used (*)
- unreachable
- unreachable_counter
- user (*)
- user_list (*)
- user_of (*)
- waiting_for_sound_effects_to_be_turned_on (*)
- world
function Plant:Plant(hospital, object_type, x, y, direction, etc)
Parameters:
| Name | Type | Description |
|---|---|---|
| hospital | ? | ? |
| object_type | ? | ? |
| x | ? | ? |
| y | ? | ? |
| direction | ? | ? |
| etc | ? | ? |
Declared on: line 96 of Lua/objects/plant.lua.
function Plant:afterLoad(old, new)
Parameters:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| ui | ? | ? |
| button | ? | ? |
Overrides: Object:onClick.
Declared on: line 285 of Lua/objects/plant.lua.
function Plant:resetUsageAndReservaton()
Overrides: Object:resetUsageAndReservaton.
Declared on: line 309 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:
| Name | Type | Description |
|---|---|---|
| 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.