Skip to main content

Custom Tile State

See Tile State Package Documentation for creating new tile states.

custom_tile_state:field()

Returns Field

custom_tile_state.can_replace_func = function(self, tile, tile_state): boolean

Called when tile:set_state() or tile:can_set_state() is called. Used to accept or deny the change.

custom_tile_state.on_replace_func = function(self, tile)

Called when tile:set_state() is called and passes custom_tile_state.can_replace_func.

custom_tile_state.on_update_func = function(self, tile)

Called for every tile matching the state while time isn't frozen.

custom_tile_state.on_entity_enter_func = function(self, entity)

Called when an entity enters the tile during a movement, tile:add_entity(), tile:set_state(), or spawning.

custom_tile_state.on_entity_leave_func = function(self, entity, prev_tile)

Called when an entity moves to another tile from a movement or tile:add_entity().

tile is the tile the entity left.

custom_tile_state.on_entity_stop_func = function(self, entity, prev_tile)

Called when an entity finishes movement on the tile or is added by tile:add_entity().