Class Map

Methods

map:init (width, height, gridOnly) Initiates a map.
map:clear (open, clearAll) Completely clear everything from a map.
map:isClear (x, y, ctype, ignoreCreats, ignore_safety, projectile, ignoreAttackableFeatures) Checks whether a map tile is clear
map:isEmpty (x, y, ignoreCreats, lookAtBaseTile) Checks whether a map tile is totally empty (not just open for movement)
map:isWall (x, y) Determines if a tile is a wall
map:isFloor (x, y) Determines if a tile's base is a floor.
map:tile_has_tag (x, y, tag) Checks if the tile_info of a tile has a certain tag set, or if any of the features in that tile have that tag set
map:get_contents (x, y) Gets contents of a map tile
map:can_enter (x, y, creature, fromX, fromY) Run the terrain can_enter() callbacks for the creature's location
map:enter (x, y, creature, fromX, fromY) Run the terrain enter() callbacks for the creature's location
map:can_see_through (x, y, args) Determines if a given tile blocks vision
map:get_tile_creature (x, y, get_attackable_features, ignoreNoDraw) Gets what creature (if any) is on a tile
map:get_tile_features (x, y) Gets a list of all features (if any) on a tile.
map:tile_has_feature (x, y, id) Check if a tile has a specific feature
map:get_blocking_feature (x, y) Returns the first feature that blocks movement
map:get_tile_items (x, y, getAdjacent, ignoreContainers) Gets a list of all items (if any) on a tile.
map:tile_has_item (x, y, id) Check if a tile has an item on it
map:get_tile_actions (x, y, user, noAdjacent, noCreature) Gets a list of all feature actions (if any) available at and around a tile.
map:is_line (startX, startY, endX, endY, pass_through_walls, ctype, ignoreCreats, ignoreSafety, ignoreAttackableFeatures) Determines if you can draw a straight line between two tiles.
map:get_line (startX, startY, endX, endY, pass_through_walls, ctype, ignoreCreats, ignoreSafety, ignoreAttackableFeatures) Gets a line between two tiles, stopping when you encounter an obstacle.
map:get_tile_effects (x, y) Gets all effects (if any) on a tile.
map:tile_has_effect (x, y, id) Check if a tile has a specific effect on it
map:add_creature (creature, x, y, ignoreFunc) Add a creature to a tile
map:add_feature (feature, x, y, args) Add a feature to a tile
map:add_effect (effect, x, y, args) Add an effect to a tile
map:add_item (item, x, y, ignoreFunc) Add an item to a tile
map:change_tile (feature, x, y) Set a map tile to be a certain feature
map:findPath (fromX, fromY, toX, toY, cType, terrainLimit) Find a path between two points
map:touching (fromX, fromY, toX, toY) Check if two tiles are touching
map:swap (creature1, creature2) Swap the positions of two creatures.
map:refresh_pathfinder (cType, terrainLimit, ignoreSafety) Refresh a pathfinder on the map
map:clear_all_pathfinders () Delete all the pathfinders from the map
map:is_passable_for (x, y, cType, include_effects, ignore_safety, ignoreAttackableFeatures) Checks if a tile is passable for a certain creature
map:get_tile_hazards (x, y, ctype, include_effects) Gets the potential hazards on a tile
map:refresh_images () Refresh all the tile images on the map
map:refresh_tile_image (x, y, contentsOnly) Refresh a specific tile's tile image
map:in_map (x, yNumber., exclude_borders) Checks if a tile is within the map boundaries
map:refresh_lightMap (true) Refresh the light map of the map.
map:refresh_light (light, forceRefresh) Refresh the light map based on a light-emitting entity's light.
map:is_lit (x, y) Checks if a tile is lit.
map:clear_tile (x, y) Delete everything from a tile
map:reveal () Mark every tile on the map as "seen" (the whole map will be revealed, but won't see creatures and effects outside of LOS)
map:get_creature_list (self, force, allowAll) Get a list of possible creatures to spawn on this map.
map:get_item_list (self, force, allowAll) Get a list of possible items to spawn on the given map
map:get_store_list (self, force) Get a list of possible stores to spawn on the given map.
map:get_faction_list (self, force) Get a list of possible factions to spawn on the given map
map:get_room_list (self, force) Get a list of possible room decorators to spawn on the given map
map:populate_creatures (creatTotal, forceGeneric) Randomly add creatures to the map
map:populate_items (itemTotal, forceGeneric) Randomly add items to the map
map:populate_stores (forceGeneric) Randomly add a store to the map.
map:populate_factions (forceGeneric) Randomly add an appropriate faction to the map.
map:populate_rooms (forceGeneric) Decorate rooms on the map
map:connect_rooms (info) Connect rooms together TODO: support custom connection code
map:get_connected_rooms () Returns a list of connected rooms
map:get_disconnected_rooms () Returns a list of unconnected rooms
map:cleanup () Cleans up the map, removing effects with temporary durations, and entities with remove_on_cleanup=true
map:get_name (noBranch) Gets the full name string of the map (eg The Wilds Depth 2: The Forest of Horror)
map:get_min_level () Get the minimum creature level for this map
map:get_max_level () Get the maximum creature level for this map
map:get_content_tags (tagType, noBranch) Get a map's content tags
map:has_content_tag (tag, tagType) Checks if a map has a given content tag
map:has_tag (tag) Checks if a map has a descriptive tag.
map:has_room (decorator) Checks if a map has a room with the given decorator.
map:is_safe_to_block (startX, startY, safeType) Determines if a tile is safe to block.
map:damage_all (x, y, amt, attacker, damage_type, args, armor_piercing, noSound, item, ignoreWeakness, attackerSafe, tweak, conditions, source_name, creatureSafe) Applies damage to all creates and features in a tile Damage a creature
map:register_incident (incidentID, actor, target, args) Registers an incident as having occured, to be processed by all other creatures who observe it
map:get_bonus (bonusType, x, y) Get a stat bonus provided by the map
map:clear_caches () Clear all map caches


Methods

map:init (width, height, gridOnly)
Initiates a map. Don't call this explicitly, it's called when you create a new map with Map(50,50).

Parameters:

  • width Number. The width of the map
  • height Number. The height of the map
  • gridOnly Boolean. If set to true, then extra tables (eg creatures, lights, pathfinders) will not be created for the map (optional)

Returns:

    Map. The map itself.
map:clear (open, clearAll)
Completely clear everything from a map.

Parameters:

  • open Boolean. If True, make the whole map open floor. Otherwise, fill it with walls. Optional
  • clearAll Boolean. If True, also clear out the various sub-tables of the map
map:isClear (x, y, ctype, ignoreCreats, ignore_safety, projectile, ignoreAttackableFeatures)
Checks whether a map tile is clear

Parameters:

  • x Number. The x-coordinate to check
  • y Number. The y-coordinate to check
  • ctype String. The creature type to use when checking if the tile is passable (optional)
  • ignoreCreats Boolean. Whether to ignore creatures when considering a tile clear (optional)
  • ignore_safety Boolean. Whether to ignore dangerous but transversable features (optional)
  • projectile Boolean. Whether to consider the tile free for a projectile vs a creature.
  • ignoreAttackableFeatures Boolean. Whether to ignore attackable features when considering a tile clear (optional)

Returns:

    Boolean. Whether the tile is clear
map:isEmpty (x, y, ignoreCreats, lookAtBaseTile)
Checks whether a map tile is totally empty (not just open for movement)

Parameters:

  • x Number. The x-coordinate to check
  • y Number. The y-coordinate to check
  • ignoreCreats Boolean. Whether to ignore creatures when considering a tile empty (optional)
  • lookAtBaseTile Boolean. Whether to count the base tile being a feature as "not empty" (optional)

Returns:

    Boolean. Whether the tile is clear
map:isWall (x, y)
Determines if a tile is a wall

Parameters:

  • x Number. The x-coordinate to check
  • y Number. The y-coordinate to check

Returns:

    boolean. Whether or not it is a wall tile
map:isFloor (x, y)
Determines if a tile's base is a floor. Does NOT check if the space is actually open

Parameters:

  • x Number. The x-coordinate to check
  • y Number. The y-coordinate to check

Returns:

    boolean. Whether or not it is a floor tile
map:tile_has_tag (x, y, tag)
Checks if the tile_info of a tile has a certain tag set, or if any of the features in that tile have that tag set

Parameters:

  • x Number. The x-coordinate to check
  • y Number. The y-coordinate to check
  • tag String. The tag to look for

Returns:

  1. boolean. Whether or not it has the tag
  2. Feature. The feature that has the tag, if applicable
map:get_contents (x, y)
Gets contents of a map tile

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate

Returns:

    Table. A table of all the contents of the tile
map:can_enter (x, y, creature, fromX, fromY)
Run the terrain can_enter() callbacks for the creature's location

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • creature Creature. The creature entering the tile
  • fromX Number. The x-coordinate the creature is leaving (optional)
  • fromY Number. The y-coordinate the creature is leaving (optional)

Returns:

    Boolean. Whether or not the tile can be entered
map:enter (x, y, creature, fromX, fromY)
Run the terrain enter() callbacks for the creature's location

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • creature Creature. The creature entering the tile
  • fromX Number. The x-coordinate the creature is leaving (optional)
  • fromY Number. The y-coordinate the creature is leaving (optional)

Returns:

    Boolean. Whether or not the tile can be entered
map:can_see_through (x, y, args)
Determines if a given tile blocks vision

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • args Unused for now, leave blank.

Returns:

    Boolean. Whether or not the tile blocks vision
map:get_tile_creature (x, y, get_attackable_features, ignoreNoDraw)
Gets what creature (if any) is on a tile

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • get_attackable_features Boolean. Whether to include attackable features (optional, defaults to false)
  • ignoreNoDraw Boolean. Whether creatures that have noDraw set will be included (optional, defaults to false)

Returns:

    Entity or Boolean. Will be FALSE if there's nothing there.
map:get_tile_features (x, y)
Gets a list of all features (if any) on a tile.

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate

Returns:

    A table of features (may be empty)
map:tile_has_feature (x, y, id)
Check if a tile has a specific feature

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • id String. The ID of the feature to check for.

Returns:

    Boolean. Whether or not the tile has this feature
map:get_blocking_feature (x, y)
Returns the first feature that blocks movement

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate

Returns:

    Boolean. Whether or not the tile has this feature
map:get_tile_items (x, y, getAdjacent, ignoreContainers)
Gets a list of all items (if any) on a tile.

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • getAdjacent Boolean. Whether to also look at adjacent tiles (optional, defaults to false)
  • ignoreContainers Boolean. Whether to ignore containers

Returns:

    A table of items (may be empty)
map:tile_has_item (x, y, id)
Check if a tile has an item on it

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • id String. The ID of the item to check for.

Returns:

    Item or false. The item, if it has it, otherwise false
map:get_tile_actions (x, y, user, noAdjacent, noCreature)
Gets a list of all feature actions (if any) available at and around a tile.

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • user Creature. The user looking for actions. Optional, defaults to player
  • noAdjacent Boolean. Whether to count adjacent tiles. Optional, defaults to false (ie adjacent tiles are counted)
  • noCreature Boolean. If true, creature actions (such as speaking) don't count

Returns:

    A table of items (may be empty)
map:is_line (startX, startY, endX, endY, pass_through_walls, ctype, ignoreCreats, ignoreSafety, ignoreAttackableFeatures)
Determines if you can draw a straight line between two tiles.

Parameters:

  • startX Number. The x-coordinate of the first tile
  • startY Number. The y-coordinate of the first tile
  • endX Number. The x-coordinate of the second tile
  • endY Number. The y-coordinate of the second tile
  • pass_through_walls Boolean. Whether to ignore walls that block the line (optional)
  • ctype String. The creature path type (eg flyer) (optional)
  • ignoreCreats Boolean. Whether to ignore creatures that block the line (optional)
  • ignoreSafety Boolean. Whether to ignore unsafe but transversable tiles that block the line (optional)
  • ignoreAttackableFeatures Boolean. Whether to ignore attackable features when considering a tile clear (optional)

Returns:

    Boolean. Whether or not you can draw the line.
map:get_line (startX, startY, endX, endY, pass_through_walls, ctype, ignoreCreats, ignoreSafety, ignoreAttackableFeatures)
Gets a line between two tiles, stopping when you encounter an obstacle.

Parameters:

  • startX Number. The x-coordinate of the first tile
  • startY Number. The y-coordinate of the first tile
  • endX Number. The x-coordinate of the second tile
  • endY Number. The y-coordinate of the second tile
  • pass_through_walls Boolean. Ignore walls that block the line (optional)
  • ctype String. The creature path type (eg flyer) (optional)
  • ignoreCreats Boolean. Ignore creatures that block the line (optional)
  • ignoreSafety Boolean. Ignore unsafe but transversable tiles that block the line (optional)
  • ignoreAttackableFeatures Boolean. Whether to ignore attackable features when considering a tile clear (optional)

Returns:

    A table full of tile values.
map:get_tile_effects (x, y)
Gets all effects (if any) on a tile.

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate

Returns:

    A table of effects(may be empty)
map:tile_has_effect (x, y, id)
Check if a tile has a specific effect on it

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • id String. The ID of the effect to check for.

Returns:

    Boolean. Whether or not the tile has this effect
map:add_creature (creature, x, y, ignoreFunc)
Add a creature to a tile

Parameters:

  • creature Creature. A specific creature object, NOT its ID. Usually a new creature, called using Creature('creatureID')
  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • ignoreFunc Boolean. Whether to ignore the creature's new() function (optional)

Returns:

    Creature. The creature placed
map:add_feature (feature, x, y, args)
Add a feature to a tile

Parameters:

  • feature Feature. A specific feature object, NOT its ID. Usually a new feature, called using Feature('featureID')
  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • args Anything. Arguments to pass to the feature's placed() code

Returns:

    Feature. The feature added
map:add_effect (effect, x, y, args)
Add an effect to a tile

Parameters:

  • effect Effect. A specific effect object, NOT its ID. Usually a new effect, called using Effect('effectID')
  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • args Anything. Arguments to pass to the feature's placed() code

Returns:

    Effect. The effect added
map:add_item (item, x, y, ignoreFunc)
Add an item to a tile

Parameters:

  • item Item. A specific item object, NOT its ID. Usually a new item, called using Item('itemID')
  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • ignoreFunc Boolean. Whether to ignore the item's new() function (optional)
map:change_tile (feature, x, y)
Set a map tile to be a certain feature

Parameters:

  • feature Feature or String. A specific feature object, NOT its ID. Usually a new feature, called using Feature('featureID'). OR text representing floor (.) or wall (#)
  • x Number. The x-coordinate
  • y Number. The y-coordinate

Returns:

    Feature or String. The feature added, or the string the tile was turned into.
map:findPath (fromX, fromY, toX, toY, cType, terrainLimit)
Find a path between two points

Parameters:

  • fromX Number. The x-coordinate, tile 1
  • fromY Number. The y-coordinate, tile 1
  • toX Number. The x-coordinate, tile 2
  • toY Number. The y-coordinate, tile 2
  • cType String. The creature path type (eg flyer) (optional)
  • terrainLimit String. Limit pathfinding to tiles with a specific feature ID (optional)

Returns:

    A table of tile entries, or FALSE if there is no path.
map:touching (fromX, fromY, toX, toY)
Check if two tiles are touching

Parameters:

  • fromX Number. The x-coordinate, tile 1
  • fromY Number. The y-coordinate, tile 1
  • toX Number. The x-coordinate, tile 2
  • toY Number. The y-coordinate, tile 2

Returns:

    Boolean. If the tiles are touching.
map:swap (creature1, creature2)
Swap the positions of two creatures.

Parameters:

  • creature1 Creature. The first creature
  • creature2 Creature. The second creature
map:refresh_pathfinder (cType, terrainLimit, ignoreSafety)
Refresh a pathfinder on the map

Parameters:

  • cType String. The creature path type (eg flyer). (optional) Special values: "walls" paths through walls only "alltiles" completely open "roomwalls" avoids rooms and digs through walls
  • terrainLimit String. If you want to limit the pathfinder to a specific feature ID (optional)
  • ignoreSafety Boolean. Whether to ignore hazards (optional)
map:clear_all_pathfinders ()
Delete all the pathfinders from the map
map:is_passable_for (x, y, cType, include_effects, ignore_safety, ignoreAttackableFeatures)
Checks if a tile is passable for a certain creature

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • cType String. The creature path type (eg flyer) (optional)
  • include_effects Boolean. Whether to include effects in the passable check (optional)
  • ignore_safety Boolean. Whether to ignore dangerous but transversable tiles (optional)
  • ignoreAttackableFeatures Boolean. Whether to ignore attackable features when considering a tile clear (optional)

Returns:

    Boolean. If it's passable.
map:get_tile_hazards (x, y, ctype, include_effects)
Gets the potential hazards on a tile

Parameters:

  • x
  • y
  • ctype
  • include_effects
map:refresh_images ()
Refresh all the tile images on the map
map:refresh_tile_image (x, y, contentsOnly)
Refresh a specific tile's tile image

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
  • contentsOnly Boolean. If true, don't refresh the base tile image, just the contents
map:in_map (x, yNumber., exclude_borders)
Checks if a tile is within the map boundaries

Parameters:

  • x Number. The x-coordinate
  • yNumber. The y-coordinate
  • exclude_borders Boolean. Whether or not to exclude the tiles on the border of the map
map:refresh_lightMap (true)
Refresh the light map of the map. Called every turn.

Parameters:

  • true /false clear. Whether to clear all the lights
map:refresh_light (light, forceRefresh)
Refresh the light map based on a light-emitting entity's light.

Parameters:

  • light Entity. The light source to refresh
  • forceRefresh Boolean. Whether to force the light to refresh its lit tiles
map:is_lit (x, y)
Checks if a tile is lit.

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate

Returns:

    Boolean. If the tile is lit.
map:clear_tile (x, y)
Delete everything from a tile

Parameters:

  • x Number. The x-coordinate
  • y Number. The y-coordinate
map:reveal ()
Mark every tile on the map as "seen" (the whole map will be revealed, but won't see creatures and effects outside of LOS)
map:get_creature_list (self, force, allowAll)
Get a list of possible creatures to spawn on this map. Stores the list, so when this is called in the future it just returns the list.

Parameters:

  • self Map. The map to check
  • force Boolean. Whether to force recalculation of the creature list (otherwise will return the stored list if it's already been calculated)
  • allowAll Boolean. If True, creatures with the specialOnly flag can still be chosen based on their tags/factions/types. If not, they won't be chosen (unless already listed specifically in the map/branch lists)

Returns:

    Table or nil. Either a table of creature IDs, or nil if there are no possible creatures
map:get_item_list (self, force, allowAll)
Get a list of possible items to spawn on the given map

Parameters:

  • self Map. The map to check
  • force Boolean. Whether or not to forcibly re-calculate it, rather than returning the pre-calculated value
  • allowAll Boolean. If True, creatures with the specialOnly flag can still be chosen based on their tags/factions/types. If not, they won't be chosen (unless already listed specifically in the map/branch lists)

Returns:

    Table or nil. Either a table of item IDs, or nil if there are no possible items
map:get_store_list (self, force)
Get a list of possible stores to spawn on the given map.

Parameters:

  • self Map. The map to check
  • force Boolean. Whether or not to forcibly re-calculate it, rather than returning the pre-calculated value

Returns:

    Table or nil. Either a table of faction IDs, or nil if there are no possible stores
map:get_faction_list (self, force)
Get a list of possible factions to spawn on the given map

Parameters:

  • self Map. The map to check
  • force Boolean. Whether or not to forcibly re-calculate it, rather than returning the pre-calculated value

Returns:

    Table or nil. Either a table of faction IDs, or nil if there are no possible factions
map:get_room_list (self, force)
Get a list of possible room decorators to spawn on the given map

Parameters:

  • self Map. The map to check
  • force Boolean. Whether or not to forcibly re-calculate it, rather than returning the pre-calculated value

Returns:

    Table or nil. Either a table of room decorator IDs, or nil if there are no possible rooms
map:populate_creatures (creatTotal, forceGeneric)
Randomly add creatures to the map

Parameters:

  • creatTotal Number. The number of creatures to add. Optional, if blank will generate enough to meet the necessary density
  • forceGeneric Boolean. Whether to ignore any special populate_creatures() code in the map's mapType. Optional
map:populate_items (itemTotal, forceGeneric)
Randomly add items to the map

Parameters:

  • itemTotal Number. The number of items to add. Optional, if blank will generate enough to meet the necessary density
  • forceGeneric Boolean. Whether to ignore any special populate_items() code in the map's mapType. Optional
map:populate_stores (forceGeneric)
Randomly add a store to the map. This only adds one store to the map

Parameters:

  • forceGeneric Boolean. Whether to ignore any special populate_stores() code in the map's mapType. Optional
map:populate_factions (forceGeneric)
Randomly add an appropriate faction to the map. This only adds one faction to the map, and only factions that haven't previously been placed

Parameters:

  • forceGeneric Boolean. Whether to ignore any special populate_factions() code in the map's mapType. Optional
map:populate_rooms (forceGeneric)
Decorate rooms on the map

Parameters:

  • forceGeneric
map:connect_rooms (info)
Connect rooms together TODO: support custom connection code

Parameters:

  • info Table. Information to pass to the connector
map:get_connected_rooms ()
Returns a list of connected rooms

Returns:

    Table. A list of rooms connected to the 1st room in the room list
map:get_disconnected_rooms ()
Returns a list of unconnected rooms

Returns:

    Table. A list of rooms not connected to the 1st room in the room list
map:cleanup ()
Cleans up the map, removing effects with temporary durations, and entities with remove_on_cleanup=true
map:get_name (noBranch)
Gets the full name string of the map (eg The Wilds Depth 2: The Forest of Horror)

Parameters:

  • noBranch Boolean. Optional, if set to true, only returns the base name of the map without depth and branch info
map:get_min_level ()
Get the minimum creature level for this map
map:get_max_level ()
Get the maximum creature level for this map
map:get_content_tags (tagType, noBranch)
Get a map's content tags

Parameters:

  • tagType String. The type of tag
  • noBranch Boolean. If true, don't look at branch's tags
map:has_content_tag (tag, tagType)
Checks if a map has a given content tag

Parameters:

  • tag String. The tag to check for
  • tagType String. The type of tag

Returns:

    Boolean. Whether or not it has the tag.
map:has_tag (tag)
Checks if a map has a descriptive tag.

Parameters:

  • tag String. The tag to check for

Returns:

    Boolean. Whether or not it has the tag.
map:has_room (decorator)
Checks if a map has a room with the given decorator. Only returns the first one, not multiples if there are any

Parameters:

  • decorator String. The decorator ID to look for

Returns:

    Room. The first room found that matches the decorator ID
map:is_safe_to_block (startX, startY, safeType)
Determines if a tile is safe to block. Useful in map generators for placing decorations

Parameters:

  • startX Number. The X-coordinate we're looking at
  • startY Number. The Y-coordinate we're looking at
  • safeType Text. Determines what counts as safe to block. "wall": next to wall only, "noWalls": not next to wall, "wallsCorners": open walls and corners only, "corners": corners only

Returns:

    Boolean. Whether the tile is safe to block or not.
map:damage_all (x, y, amt, attacker, damage_type, args, armor_piercing, noSound, item, ignoreWeakness, attackerSafe, tweak, conditions, source_name, creatureSafe)
Applies damage to all creates and features in a tile Damage a creature

Parameters:

  • x Number. The x-coordinate.
  • y Number. The y-coordinate.
  • amt Number. The damage to deal.
  • attacker Entity. The source of the damage.
  • damage_type String. The damage type of the attack. (optional)
  • args Table. A table of other arguments. All the below arguments are options to include.
  • armor_piercing Boolean, or Number. If set to true, it ignores all armor. If set to a number, ignores that much armor. (optional)
  • noSound Boolean. If set to true, no damage type sound will be played. (optional)
  • item Item. The weapon used to do the damage. (optional)
  • ignoreWeakness Boolean. If true, don't apply weakness
  • attackerSafe Boolean. If true, do not harm the attacker.
  • tweak Boolean. If true, tweak the damage number.
  • conditions Table. A table of conditions to possible inflict, in the same format as hitConditions elsewhere.
  • source_name String. The name to display for the source of the damage.
  • creatureSafe Boolean. If true, don't damage creatures

Returns:

    Table. A table of all damaged entities and the damage done to them.
map:register_incident (incidentID, actor, target, args)
Registers an incident as having occured, to be processed by all other creatures who observe it

Parameters:

  • incidentID String. The incident type
  • actor Entity. The creature (or other entity) that caused the incident. Optional
  • target Entity. The entity (or coordinates), that was the target of the incident. Optional
  • args Table. Other information to use when processing this incident
map:get_bonus (bonusType, x, y)
Get a stat bonus provided by the map

Parameters:

  • bonusType String. The type of bonus
  • x Number. The x-coordinate of the asker. Used to look at the room they're in's bonus
  • y Number. The y-coordinate of the asker. Used to look at the room they're in's bonus
map:clear_caches ()
Clear all map caches
generated by LDoc 1.5.0 Last updated 2025-05-24 09:49:55