Module ...
Represents a level map, handles display and various low level map work
Functions
| _M:addEffect (src, x, y, duration, damtype, dam, radius, dir, angle, overlay, update_fct, selffire, friendlyfire) | Adds a zone (temporary) effect | 
| _M:addEmote (e) | Adds an existing emote to the map | 
| _M:addObject (x, y, o) | Object functions | 
| _M:addParticleEmitter (e) | Adds an existing particle emitter to the map | 
| _M:addPathString (ps) | Adds a "path string" to the map "Path strings" are strings defining what terrain an actor can cross. | 
| _M:apply (x, y, v) | Sets a grid as seen and remembered Used by FOV code | 
| _M:applyESP (x, y, v) | Sets a grid as seen if ESP'ed Used by FOV code | 
| _M:applyExtraLite (x, y, v) | Sets a grid as seen, lited and remembered, if it is in the current FOV Used by FOV code | 
| _M:applyLite (x, y, v) | Sets a grid as seen, lited and remembered Used by FOV code | 
| _M:call (x, y, pos, e) | Sets/gets a value from the map It is defined as the function metamethod, so one can simply do: mymap(x, y, Map.TERRAIN) | 
| _M:centerViewAround (x, y) | Sets the current view area with the given coords at the center | 
| _M:checkAllEntities (x, y, what, ...) | Check all entities of the grid for a property until it finds one/returns one This will stop at the first entity with the given property (or if the property is a function, the return of the function that is not false/nil). | 
| _M:checkAllEntitiesNoStop (x, y, what, ...) | Check all entities of the grid for a property, discarding the results This will iterate over all entities without stopping. | 
| _M:checkEntity (x, y, pos, what, ...) | Check specified entity position of the grid for a property | 
| _M:checkMapViewBounded () | Checks the map is bound to the screen (no "empty space" if the map is big enough) | 
| _M:cleanFOV () | Cleans the FOV infos (seens table) | 
| _M:close () | Closes things in the object to allow it to be garbage collected Map objects are NOT automatically garbage collected because they contain FOV C structure, which themselves have a reference to the map. | 
| _M:display (x, y, nb_keyframe, always_show, nb_keyframes) | Displays the map on screen | 
| _M:displayEffects () | Display the overlay effects, called by self:display() | 
| _M:displayEmotes (nb_keyframes) | Display the emotes, called by self:display() | 
| _M:displayParticles (nb_keyframes) | Display the particle emitters, called by self:display() | 
| _M:getMouseTile (mx, my) | Gets the tile under the mouse | 
| _M:getScreenUpperCorner () | Get the screen offset where to start drawing (upper corner) | 
| _M:getTileToScreen (tx, ty) | Get the screen position corresponding to a tile | 
| _M:import (map, dx, dy, sx, sy, sw, sh) | Import a map into the current one | 
| _M:init (w, h) | Creates a map | 
| _M:isBound (x, y) | Checks the given coords to see if they are in bound | 
| _M:isOnScreen (x, y) | Checks the given coords to see if they are displayed on screen | 
| _M:liteAll (x, y, w, h) | Lite all grids | 
| _M:minimapDisplay (dx, dy, x, y, w, h, transp) | Displays the minimap | 
| _M:moveViewSurround (x, y, marginx, marginy) | Sets the current view area if x and y are out of bounds | 
| _M:opaque (x, y) | Sets checks if a grid lets sight pass through Used by FOV code | 
| _M:opaqueESP (x, y) | Sets checks if a grid lets ESP pass through Used by FOV ESP code | 
| _M:particleEmitter (x, y, radius, def, args) | Add a new particle emitter | 
| _M:processEffects () | Process the overlay effects, call it from your tick function | 
| _M:recreate () | Recreate the internal map using new dimensions | 
| _M:redisplay () | Redisplays the map, storing seen information | 
| _M:rememberAll (x, y, w, h) | Remember all grids | 
| _M:remove (x, y, pos) | Removes an entity | 
| _M:removeEmote (e) | Removes an emote from the map | 
| _M:removeParticleEmitter (e) | Removes a particle emitter from the map | 
| _M:resetTiles () | Create the tile repositories | 
| _M:save () | Serialization | 
| _M:setObscure (r, g, b, a) | Defines the "obscure" factor of unseen map By default it is 0.6, 0.6, 0.6, 0.6 | 
| _M:setShown (r, g, b, a) | Defines the "shown" factor of seen map By default it is 1, 1, 1, 1 | 
| _M:setViewPort (x, y, w, h, tile_w, tile_h, fontname, fontsize, allow_backcolor) | Sets the viewport size Static | 
| _M:setViewerActor (player) | Defines the actor that sees the map Usually this will be the player. | 
| _M:setViewerFaction (faction, friend, neutral, enemy) | Defines the faction of the person seeing the map Usually this will be the player's faction. | 
| _M:setZoom (zoom, tmx, tmy) | Sets zoom level | 
| _M:updateMap (x, y) | Updates the map on the given spot This updates many things, from the C map object, the FOV caches, the minimap if it exists, ... | 
Functions
- _M:addEffect (src, x, y, duration, damtype, dam, radius, dir, angle, overlay, update_fct, selffire, friendlyfire)
- 
Adds a zone (temporary) effect
Parameters- src: the source actor
- x: the epicenter coords
- y: the epicenter coords
- duration: the number of turns to persist
- damtype: the DamageType to apply
- dam:
- radius: the radius of the effect
- dir: the numpad direction of the effect, 5 for a ball effect
- angle:
- overlay: either a simple display entity to draw upon the map or a Particle class
- update_fct: optional function that will be called each time the effect is updated with the effect itself as parameter. Use it to change radius, move around ....
- selffire: percent chance to damage the source actor (default 100)
- friendlyfire: percent chance to damage friendly actors (default 100)
 
- _M:addEmote (e)
- 
Adds an existing emote to the map
Parameters- e:
 
- _M:addObject (x, y, o)
- 
Object functions  
Parameters- x:
- y:
- o:
 
- _M:addParticleEmitter (e)
- 
Adds an existing particle emitter to the map
Parameters- e:
 
- _M:addPathString (ps)
- 
Adds a "path string" to the map "Path strings" are strings defining what terrain an actor can cross. Their format is left to the module to decide (by overloading Actor:getPathString() )
 They are totally optional as they re only used to compute A* paths and the likes and even then the algorithms still work without them, only slower
 If you use them the block_move function of your Grid class must be able to handle either an actor or a "path string" as their third argumentParameters- ps:
 
- _M:apply (x, y, v)
- 
Sets a grid as seen and remembered Used by FOV code
Parameters- x:
- y:
- v:
 
- _M:applyESP (x, y, v)
- 
Sets a grid as seen if ESP'ed Used by FOV code
Parameters- x:
- y:
- v:
 
- _M:applyExtraLite (x, y, v)
- 
Sets a grid as seen, lited and remembered, if it is in the current FOV Used by FOV code
Parameters- x:
- y:
- v:
 
- _M:applyLite (x, y, v)
- 
Sets a grid as seen, lited and remembered Used by FOV code
Parameters- x:
- y:
- v:
 
- _M:call (x, y, pos, e)
- 
Sets/gets a value from the map It is defined as the function metamethod, so one can simply do: mymap(x, y, Map.TERRAIN)
Parameters- x: position
- y: position
- pos: what kind of entity to set(Map.TERRAIN, Map.OBJECT, Map.ACTOR)
- e: the entity to set, if null it will return the current one
 
- _M:centerViewAround (x, y)
- 
Sets the current view area with the given coords at the center
Parameters- x:
- y:
 
- _M:checkAllEntities (x, y, what, ...)
- 
Check all entities of the grid for a property until it finds one/returns one This will stop at the first entity with the given property (or if the property is a function, the return of the function that is not false/nil). No guaranty is given about the iteration order
Parameters- x: position
- y: position
- what: property to check
- ...:
 
- _M:checkAllEntitiesNoStop (x, y, what, ...)
- 
Check all entities of the grid for a property, discarding the results This will iterate over all entities without stopping. No guaranty is given about the iteration order
Parameters- x: position
- y: position
- what: property to check
- ...:
 Return value:a table containing all return values, indexed by the entities
- _M:checkEntity (x, y, pos, what, ...)
- 
Check specified entity position of the grid for a property
Parameters- x: position
- y: position
- pos: entity position in the grid
- what: property to check
- ...:
 
- _M:checkMapViewBounded ()
- Checks the map is bound to the screen (no "empty space" if the map is big enough)
- _M:cleanFOV ()
- Cleans the FOV infos (seens table)
- _M:close ()
- 
Closes things in the object to allow it to be garbage collected Map objects are NOT automatically garbage collected because they contain FOV C structure, which themselves have a reference to the map. Cyclic references! BAD BAD BAD !
 The closing should be handled automatically by the Zone class so no bother for authors
- _M:display (x, y, nb_keyframe, always_show, nb_keyframes)
- 
Displays the map on screen
Parameters- x: the coord where to start drawing, if null it uses self.display_x
- y: the coord where to start drawing, if null it uses self.display_y
- nb_keyframe:
- always_show: tell the map code to force display unseed entities as remembered (used for smooth FOV shading)
- nb_keyframes: the number of keyframes elapsed since last draw
 
- _M:displayEffects ()
- Display the overlay effects, called by self:display()
- _M:displayEmotes (nb_keyframes)
- 
Display the emotes, called by self:display()
Parameters- nb_keyframes:
 
- _M:displayParticles (nb_keyframes)
- 
Display the particle emitters, called by self:display()
Parameters- nb_keyframes:
 
- _M:getMouseTile (mx, my)
- 
Gets the tile under the mouse
Parameters- mx:
- my:
 
- _M:getScreenUpperCorner ()
- Get the screen offset where to start drawing (upper corner)
- _M:getTileToScreen (tx, ty)
- 
Get the screen position corresponding to a tile
Parameters- tx:
- ty:
 
- _M:import (map, dx, dy, sx, sy, sw, sh)
- 
Import a map into the current one
Parameters- map: the map to import
- dx: coordinate where to import it in the current map
- dy: coordinate where to import it in the current map
- sx: coordinate where to start importing the map, defaults to 0
- sy: coordinate where to start importing the map, defaults to 0
- sw: size of the imported map to get, defaults to map size
- sh: size of the imported map to get, defaults to map size
 
- _M:init (w, h)
- 
Creates a map
Parameters- w: width (in grids)
- h: height (in grids)
 
- _M:isBound (x, y)
- 
Checks the given coords to see if they are in bound
Parameters- x:
- y:
 
- _M:isOnScreen (x, y)
- 
Checks the given coords to see if they are displayed on screen
Parameters- x:
- y:
 
- _M:liteAll (x, y, w, h)
- 
Lite all grids
Parameters- x:
- y:
- w:
- h:
 
- _M:minimapDisplay (dx, dy, x, y, w, h, transp)
- 
Displays the minimap
Parameters- dx:
- dy:
- x:
- y:
- w:
- h:
- transp:
 Return value:a surface containing the drawn map
- _M:moveViewSurround (x, y, marginx, marginy)
- 
Sets the current view area if x and y are out of bounds
Parameters- x:
- y:
- marginx:
- marginy:
 
- _M:opaque (x, y)
- 
Sets checks if a grid lets sight pass through Used by FOV code
Parameters- x:
- y:
 
- _M:opaqueESP (x, y)
- 
Sets checks if a grid lets ESP pass through Used by FOV ESP code
Parameters- x:
- y:
 
- _M:particleEmitter (x, y, radius, def, args)
- 
Add a new particle emitter
Parameters- x:
- y:
- radius:
- def:
- args:
 
- _M:processEffects ()
- Process the overlay effects, call it from your tick function
- _M:recreate ()
- Recreate the internal map using new dimensions
- _M:redisplay ()
- Redisplays the map, storing seen information
- _M:rememberAll (x, y, w, h)
- 
Remember all grids
Parameters- x:
- y:
- w:
- h:
 
- _M:remove (x, y, pos)
- 
Removes an entity
Parameters- x: position
- y: position
- pos: what kind of entity to set(Map.TERRAIN, Map.OBJECT, Map.ACTOR)
 
- _M:removeEmote (e)
- 
Removes an emote from the map
Parameters- e:
 
- _M:removeParticleEmitter (e)
- 
Removes a particle emitter from the map
Parameters- e:
 
- _M:resetTiles ()
- Create the tile repositories
- _M:save ()
- Serialization
- _M:setObscure (r, g, b, a)
- 
Defines the "obscure" factor of unseen map By default it is 0.6, 0.6, 0.6, 0.6
Parameters- r:
- g:
- b:
- a:
 
- _M:setShown (r, g, b, a)
- 
Defines the "shown" factor of seen map By default it is 1, 1, 1, 1
Parameters- r:
- g:
- b:
- a:
 
- _M:setViewPort (x, y, w, h, tile_w, tile_h, fontname, fontsize, allow_backcolor)
- 
Sets the viewport size Static
Parameters- x: screen coordinate where the map will be displayed (this has no impact on the real display). This is used to compute mouse clicks
- y: screen coordinate where the map will be displayed (this has no impact on the real display). This is used to compute mouse clicks
- w: width
- h: height
- tile_w: width of a single tile
- tile_h: height of a single tile
- fontname: font parameters, can be nil
- fontsize: font parameters, can be nil
- allow_backcolor:
 
- _M:setViewerActor (player)
- 
Defines the actor that sees the map Usually this will be the player. This is used to determine invisibility/...
Parameters- player:
 
- _M:setViewerFaction (faction, friend, neutral, enemy)
- 
Defines the faction of the person seeing the map Usually this will be the player's faction. If you do not want to use tactical display, dont use it
Parameters- faction:
- friend:
- neutral:
- enemy:
 
- _M:setZoom (zoom, tmx, tmy)
- 
Sets zoom level
Parameters- zoom: nil to reset to default, otherwise a number to increment the zoom with
- tmx: make sure this coords are visible after zoom (can be nil)
- tmy: make sure this coords are visible after zoom (can be nil)
 
- _M:updateMap (x, y)
- 
Updates the map on the given spot This updates many things, from the C map object, the FOV caches, the minimap if it exists, ...
Parameters- x:
- y: