kts.GenerateLocksAndTraps

Name

kts.GenerateLocksAndTraps – set initial locks and traps

Synopsis

kts.GenerateLocksAndTraps(num_keys, pretrapped)

Description

When the dungeon is first generated (by kts.LayoutDungeon), all doors and chests are unlocked and untrapped.

The function kts.GenerateLocksAndTraps "fixes" this, by searching for all lockable tiles (doors and chests) in the dungeon, and placing either a lock or a trap (or neither) on each, according to the given settings.

The settings required are num_keys (the number of keys in the dungeon, usually between 1 and 3) and pretrapped (a boolean flag determining whether pretrapped chests are on or off).

Setting num_keys to zero is allowed; this will mean that all doors/chests are left unlocked.

Return Value

No value is returned.

Errors

Errors can be raised if the parameters do not have the correct types.

Notes

This function is usually called exactly once during game setup, at some point after kts.LayoutDungeon has been called. Normally this is done automatically as part of dungeon_setup.lua.

See Also

kts.LayoutDungeon