kts.WipeDungeon

Name

kts.WipeDungeon – clear the dungeon map

Synopsis

kts.WipeDungeon()

Description

This completely resets the dungeon map (deleting everything in the dungeon) and also sets the global variable kts.DUNGEON_ERROR to nil.

Return Value

None.

Errors

None.

Notes

This cannot be called in-game, it is only used during the dungeon generation process.

Examples

To see how this is used in the standard Knights Lua files, consult dungeon_setup.lua.

The basic idea is that the Lua code tries, up to 25 times, to generate a random dungeon. Because dungeon generation is random, it might fail (one possible reason is that not enough entry points for the knights were generated). If failure does occur, the Lua code calls kts.WipeDungeon() to erase the previous dungeon, and then tries again. If dungeon generation keeps failing, the code will try to expand the dungeon to a larger layout, or eventually, give up completely.