kts.WipeDungeon – clear the dungeon map
kts.WipeDungeon()
This completely resets the dungeon map (deleting everything in the dungeon) and also sets the global variable kts.DUNGEON_ERROR
to nil
.
None.
None.
This cannot be called in-game, it is only used during the dungeon generation process.
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.