Module ...
Defines a zone: a set of levels, with depth, npcs, objects, level generator, ...
Functions
_M:addEntity (level, e, typ, x, y, no_added) | Do the various stuff needed to setup an entity on the level Grids do not really need that, this is mostly done for traps, objects and actors This will do all the correct initializations and setup required |
_M:checkFilter (e, filter, type) | Checks an entity against a filter |
_M:computeRarities (type, list, level, filter, add_level, rarity_field) | Parses the npc/objects list and compute rarities for random generation ONLY entities with a rarity properties will be considered. This means that to get a never-random entity you simply do not put a rarity property on it. |
_M:filterToString (filter) | Return a string describing the filter |
_M:finishEntity (level, type, e, ego_filter) | Finishes generating an entity |
_M:generateEgoEntities (level, type, etype, e_egos, e___CLASSNAME) | Compute posible egos for this list |
_M:getEgosList (level, type, group, class) | Gets the possible egos |
_M:getLevel (game, lev, old_lev, no_close) | Asks the zone to generate a level of level "lev" |
_M:init (short_name, dynamic) | Loads a zone definition |
_M:leave () | Leaves a zone Saves the zone to a .teaz file if requested with persistent="zone" flag |
_M:leaveLevel (no_close, lev, old_lev) | Leave the level, forgetting uniques and such |
_M:loadBaseLists () | Loads basic entities lists |
_M:loaded () | If we are loaded we need a new uid |
_M:makeEntity (level, type, filter, force_level, prob_filter) | Picks and resolve an entity |
_M:makeEntityByName (level, type, name, force_unique) | Find a given entity and resolve it |
_M:onLoadZoneFile (basedir) | Called when the zone file is loaded Does nothing, overload it |
_M:pickEntity (list) | Picks an entity from a computed probability list |
_M:setup (t) | Setup classes to use for level generation Static method |
_M:updateBaseLevel () | Computes the current base level based on the zone infos |
Functions
- _M:addEntity (level, e, typ, x, y, no_added)
-
Do the various stuff needed to setup an entity on the level Grids do not really need that, this is mostly done for traps, objects and actors
This will do all the correct initializations and setup requiredParameters
- level: the level on which to add the entity
- e: the entity to add
- typ: the type of entity, one of "actor", "object", "trap" or "terrain"
- x: the coordinates where to add it. This CAN be null in which case it wont be added to the map
- y: the coordinates where to add it. This CAN be null in which case it wont be added to the map
- no_added:
- _M:checkFilter (e, filter, type)
-
Checks an entity against a filter
Parameters
- e:
- filter:
- type:
- _M:computeRarities (type, list, level, filter, add_level, rarity_field)
-
Parses the npc/objects list and compute rarities for random generation ONLY entities with a rarity properties will be considered.
This means that to get a never-random entity you simply do not put a rarity property on it.Parameters
- type:
- list:
- level:
- filter:
- add_level:
- rarity_field:
- _M:filterToString (filter)
-
Return a string describing the filter
Parameters
- filter:
- _M:finishEntity (level, type, e, ego_filter)
-
Finishes generating an entity
Parameters
- level:
- type:
- e:
- ego_filter:
- _M:generateEgoEntities (level, type, etype, e_egos, e___CLASSNAME)
-
Compute posible egos for this list
Parameters
- level:
- type:
- etype:
- e_egos:
- e___CLASSNAME:
- _M:getEgosList (level, type, group, class)
-
Gets the possible egos
Parameters
- level:
- type:
- group:
- class:
- _M:getLevel (game, lev, old_lev, no_close)
-
Asks the zone to generate a level of level "lev"
Parameters
- game:
- lev: the level (from 1 to zone.max_level)
- old_lev:
- no_close:
Return value:
a Level object - _M:init (short_name, dynamic)
-
Loads a zone definition
Parameters
- short_name: the short name of the zone to load, if should correspond to a directory in your module data/zones/short_name/ with a zone.lua, npcs.lua, grids.lua and objects.lua files inside
- dynamic:
- _M:leave ()
- Leaves a zone Saves the zone to a .teaz file if requested with persistent="zone" flag
- _M:leaveLevel (no_close, lev, old_lev)
-
Leave the level, forgetting uniques and such
Parameters
- no_close:
- lev:
- old_lev:
- _M:loadBaseLists ()
- Loads basic entities lists
- _M:loaded ()
- If we are loaded we need a new uid
- _M:makeEntity (level, type, filter, force_level, prob_filter)
-
Picks and resolve an entity
Parameters
- level: a Level object to generate for
- type: one of "object" "terrain" "actor" "trap"
- filter: a filter table
- force_level: if not nil forces the current level for resolvers to this one
- prob_filter: if true a new probability list based on this filter will be generated, ensuring to find objects better but at a slightly slower cost (maybe)
Return value:
the fully resolved entity, ready to be used on a level. Or nil if a filter was given an nothing found - _M:makeEntityByName (level, type, name, force_unique)
-
Find a given entity and resolve it
Parameters
- level:
- type:
- name:
- force_unique:
Return value:
the fully resolved entity, ready to be used on a level. Or nil if a filter was given an nothing found - _M:onLoadZoneFile (basedir)
-
Called when the zone file is loaded Does nothing, overload it
Parameters
- basedir:
- _M:pickEntity (list)
-
Picks an entity from a computed probability list
Parameters
- list:
- _M:setup (t)
-
Setup classes to use for level generation Static method
Parameters
- t: table that contains the name of the classes to use
Usage:
Required fields: npc_class (default engine.Actor) grid_class (default engine.Grid) object_class (default engine.Object) - _M:updateBaseLevel ()
- Computes the current base level based on the zone infos