Module ...

Defines a zone: a set of levels, with depth, nps, objects, level generator, ...

Functions

_M:addEntity (level, e, typ, x, y) 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 corect initializations and setup required
_M:checkFilter (e, filter) Checks an entity against a filter
_M:computeRarities (type, list, level, filter) 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:finishEntity (level, type, e, ego_chance) Finishes generating an entity
_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 persistant="zone" flag
_M:leaveLevel (no_close, lev, old_lev) Leave the level, forgetting uniques and such
_M:makeEntity (level, type, filter, force_level) Picks and resolve an entity
_M:makeEntityByName (level, type, name) Find a given entity and resolve it
_M:pickEntity (list) Picks an entity from a computed probability list
_M:setup (t) Setup classes to use for level generation Static method


Functions

_M:addEntity (level, e, typ, x, y)
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 corect initializations and setup required

Parameters

  • 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
_M:checkFilter (e, filter)
Checks an entity against a filter

Parameters

  • e:
  • filter:
_M:computeRarities (type, list, level, filter)
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:
_M:finishEntity (level, type, e, ego_chance)
Finishes generating an entity

Parameters

  • level:
  • type:
  • e:
  • ego_chance:
_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 persistant="zone" flag
_M:leaveLevel (no_close, lev, old_lev)
Leave the level, forgetting uniques and such

Parameters

  • no_close:
  • lev:
  • old_lev:
_M:makeEntity (level, type, filter, force_level)
Picks and resolve an entity

Parameters

  • level:
  • type:
  • filter:
  • force_level:

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)
Find a given entity and resolve it

Parameters

  • level:
  • type:
  • name:

Return value:

the fully resolved entity, ready to be used on a level. Or nil if a filter was given an nothing found
_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)

Valid XHTML 1.0!