Class engine.Level
Define a level
Methods
engine.Level:init (level, map)
Initializes the level with a "level" and a map
engine.Level:addSublevel (name, level)
Adds a sublevel
engine.Level:removeSublevel (name)
Removes a sublevel
engine.Level:selectSublevel (name)
Activate the given sublevel to become the new main one
engine.Level:addEntity (e, after, no_error)
Adds an entity to the level Only entities that need to act need to be added.
engine.Level:removeEntity (e, force)
Removes an entity from the level
engine.Level:hasEntity (e)
Is the entity on the level?
engine.Level:findEntity (filter)
Find an entity
engine.Level:save ()
Serialization
engine.Level:setEntitiesList (type, list, permanent)
Setup an entity list for the level, this allows the Zone to pick objects/actors/...
engine.Level:getEntitiesList (type)
Gets an entity list for the level, this allows the Zone to pick objects/actors/...
engine.Level:removed ()
Removed, so we remove all entities
engine.Level:decay (what, check)
Decay the level Decaying means we look on the map for the given type of entities and if we are allowed to we delete them
engine.Level:pickSpot (filter)
Pick a random spot matching the given filter
engine.Level:pickSpotRemove (filter)
Pick a random spot matching the given filter and remove it
engine.Level:pickSpotFrom (filter, spots)
Pick a random spot matching the given filter
engine.Level:pickSpotRemoveFrom (filter, spots)
Pick a random spot matching the given filter and remove it
Methods
- engine.Level:init (level, map)
-
Initializes the level with a "level" and a map
Parameters:
- level
- map
- engine.Level:addSublevel (name, level)
-
Adds a sublevel
Parameters:
- name
- level
- engine.Level:removeSublevel (name)
-
Removes a sublevel
Parameters:
- name
- engine.Level:selectSublevel (name)
-
Activate the given sublevel to become the new main one
Parameters:
- name
- engine.Level:addEntity (e, after, no_error)
-
Adds an entity to the level
Only entities that need to act need to be added. Terrain features do not need this usually
Parameters:
- e
- after
- no_error
- engine.Level:removeEntity (e, force)
-
Removes an entity from the level
Parameters:
- e
- force
- engine.Level:hasEntity (e)
-
Is the entity on the level?
Parameters:
- e
- engine.Level:findEntity (filter)
-
Find an entity
Parameters:
- filter
- engine.Level:save ()
- Serialization
- engine.Level:setEntitiesList (type, list, permanent)
-
Setup an entity list for the level, this allows the Zone to pick objects/actors/...
Parameters:
- type
- list
- permanent
- engine.Level:getEntitiesList (type)
-
Gets an entity list for the level, this allows the Zone to pick objects/actors/...
Parameters:
- type
- engine.Level:removed ()
- Removed, so we remove all entities
- engine.Level:decay (what, check)
-
Decay the level
Decaying means we look on the map for the given type of entities and if we are allowed to we delete them
Parameters:
- what what Map feature to decay (ACTOR, OBJECT, ...)
- check either a boolean or a function, if true the given entity will be decayed
Returns:
- the number of decayed entities
- the total number of such entities remaining
- engine.Level:pickSpot (filter)
-
Pick a random spot matching the given filter
Parameters:
- filter
- engine.Level:pickSpotRemove (filter)
-
Pick a random spot matching the given filter and remove it
Parameters:
- filter
- engine.Level:pickSpotFrom (filter, spots)
-
Pick a random spot matching the given filter
Parameters:
- filter
- spots
- engine.Level:pickSpotRemoveFrom (filter, spots)
-
Pick a random spot matching the given filter and remove it
Parameters:
- filter
- spots