Functions for working with the current map.
There is only ever one map loaded at a given time.
local Map = ELONA.require("core.Map")
width () | Returns the current map's width. |
height () | Returns the current map's height. |
integer_id () | Returns the current map's integer ID. |
id () | Returns the current map's ID. |
instance_id () | Returns the ID of the current map's instance. |
current_dungeon_level () | Returns the current dungeon level. |
is_overworld () | Returns true if this map is the overworld. |
valid (position) | Checks if a position is inside the map. |
is_solid (position) | Returns true if the map tile at the given position is solid. |
is_blocked (position) | Checks if a position is blocked and cannot be reached by walking. |
random_pos () | Returns a random position in the current map. |
generate_tile (tile_kind) | Generates a random tile ID from the current map's tileset. |
chip_type () | Returns the type of chip for the given tile kind. |
get_tile (position) | Gets the tile type of a tile position. |
get_memory (position) | Gets the player's memory of a tile position. |
get_feat (position) | Returns a table containing map feature information at the given tile position. |
get_mef (position) | Returns the ID of the map effect at the given position. |
get_chara (position) | Gets the character standing at a tile position. |
set_tile (position, id) | Sets a tile of the current map. |
set_memory (position, id) | Sets the player's memory of a tile position to the given tile kind. |
set_feat (position, tile, param1, param2) | Sets a feat at the given position. |
clear_feat (position) | Clears the feat at the given position. |
spray_tile () | Randomly sprays the map with the given tile type; |
area () | Returns the area in the world map that corresponds to this map. |
data | [R] The map data for the current map. |
Returns the current map's width.
This is only valid until the map changes.
Returns:Returns the current map's height.
This is only valid until the map changes.
Returns:Returns the current map's integer ID.
Returns:
Returns the current map's ID.
Returns:
Returns the ID of the current map's instance.
There can be more than one instance of a map of the same kind, like player-owned buildings.
Returns:Returns the current dungeon level.
TODO: unify with World.data or Map.data
Returns true if this map is the overworld.
Returns:
Checks if a position is inside the map.
It might be blocked by something.
Parameters:Returns true if the map tile at the given position is solid.
Parameters:
Checks if a position is blocked and cannot be reached by walking.
Parameters:
Returns a random position in the current map.
It might be blocked by something.
Returns:Generates a random tile ID from the current map's tileset.
Tile kinds can contain one of several different tile variations.
Parameters:Returns the type of chip for the given tile kind.
Gets the tile type of a tile position.
Parameters:
Gets the player's memory of a tile position.
Parameters:
Returns a table containing map feature information at the given tile position.
Returns the ID of the map effect at the given position.
Parameters:
Gets the character standing at a tile position.
Parameters:
Sets a tile of the current map.
Only checks if the position is valid, not things like blocking objects.
Parameters:Map.set_tile(10, 10, Map.generate_tile(Enums.TileKind.Room))
Sets the player's memory of a tile position to the given tile kind.
Parameters:
Map.set_memory(10, 10, Map.generate_tile(Enums.TileKind.Room))
Sets a feat at the given position.
Parameters:
Clears the feat at the given position.
Parameters:
Randomly sprays the map with the given tile type;
Returns the area in the world map that corresponds to this map.
[R] The map data for the current map.
This contains serialized values controlling various aspects of the current map.