Map
┗> Class
Stores and manages the currently loaded map.
If a map in scrips/world/maps is defined as a folder, map data can be placed in data.lua, and a file named map.lua can be used to define a custom Map object for that map.
Methods
Map:addTileLayer(depth: any, battle_border: any)
Arguments:
| depth: any | |
| battle_border: any |
Returns:
| 1: TileLayer |
Map:createTileObject(data: any, x: any, y: any, width: any, height: any)
Arguments:
| data: any | |
| x: any | |
| y: any | |
| width: any | |
| height: any |
Returns:
| 1: TileObject |
Map:draw()
Map:getEvent(id: string|number)
Gets a specific event present in the current map.
Arguments:
| id: string|number | The unique numerical id of an event OR the text id of an event type to get the first instance of. |
Returns:
| event: Event? | The event instnace, or |
Map:getEvents(name: string?)
Gets a list of all instances of one type of event in the current maps
Arguments:
| name: string? | The text id of the event to search for, fetches every event if |
Returns:
| events: Event[] | A table containing every instance of the event in the current map |
Map:getMarker(name: string)
Gets a specific marker from the current map.
Arguments:
| name: string | The name of the marker to search for. |
Returns:
| x: number | The x-coordinate of the marker's center. |
| y: number | The y-coordinate of the marker's center. |
Map:getTile(x: any, y: any, layer: any)
Arguments:
| x: any | |
| y: any | |
| layer: any |
Returns:
| 1: unknown|nil | |
| 2: integer|unknown |
Map:getTileObjectRect(data: any)
Arguments:
| data: any |
Returns:
| 1: unknown | |
| 2: unknown | |
| 3: unknown | |
| 4: unknown |
Map:legacyLoadObject(name: string, data: table)
Loads an object using the old system, based on the Registry.
Solely for legacy support of projects and libraries that use the old event system.
Arguments:
| name: string | The name of the object to load. |
| data: table | The Tiled object data for the object. |
Returns:
| 1: Event? | The loaded object, or |
Map:load()
Map:loadController(name: any, data: any)
Arguments:
| name: any | |
| data: any |
Returns:
| 1: Event|FountainShadowController|Object|ToggleController|unknown |
Map:loadObject(name: string, data: table)
Load an object by its name.
Arguments:
| name: string | The name of the object to load. |
| data: table | The Tiled object data for the object. |
Returns:
| The: Event? | loaded object, or |
Map:loadObjects(layer: any, depth: any, layer_type: any)
Arguments:
| layer: any | |
| depth: any | |
| layer_type: any |
Map:loadTextureFromImagePath(filename: any)
Arguments:
| filename: any |
Returns:
| 1: boolean | |
| 2: string|"not under prefix"|"path outside root" |
Map:loadTilesetFromTilesetPath(filename: any)
Arguments:
| filename: any |
Returns:
| 1: boolean | |
| 2: string|Tileset |
Map:setTile(x: any, y: any, tileset: any, ...: unknown)
Arguments:
| x: any | |
| y: any | |
| tileset: any | |
| ...: unknown |