Simply add -i in the command line (lua -i maze.lua instead of lua maze.lua)
There are some commands you might want to use.
The currentConfig object is the active configuration. (You need to reset every objects you modify the configuration in order to apply modifications.)
Get/set the level manager configuration:
currentConfig:getLevelManagerConfig() -- If you want to get - set - reset: levelManager
levelManager:getConfig() -- Same, but recommandedGet/set whether the level manager loads the test levels:
levelManager:getConfig():doLoadTestLevels() -- Get
levelManager:getConfig().__loadTestLevels = [boolean] -- Set - reset: levelManagerGet/set the level configuration:
levelManager:getConfig():getLevelConfig() -- If you want to get - set - reset: levelManager
levelManager:getLevel(level):getLevelConfiguration() -- Almost the same
-- If a level has a non-default config, you must use the second variantGet/set the various minimap configuration:
levelManager:getConfig():getLevelConfig():doesDisplayMinimap() -- Get
levelManager:getConfig():getLevelConfig().__displayMinimap = [boolean] -- Set
levelManager:getConfig():getLevelConfig():getMapSize() -- If you want to get
levelManager:getConfig():getLevelConfig().__mapSize = {[w, h]} -- If you want to set - reset: levelManager
-- w is the width, the number of tiles per line
-- h is the height, the number of tiles per columnGet/set the map configuration:
levelManager:getConfig():getLevelConfig():doesDisplayMinimap() -- Get
levelManager:getConfig():getLevelConfig().__displayMap = [boolean] -- SetGet/set the reverseMap configuration (meaning, how much does it goes up after each command):
levelManager:getConfig():getLevelConfig():getYoffset() -- If you want to get
levelManager:getConfig():getLevelConfig().__mapOffset[2] = off -- If you want to set - reset: levelManager
-- off is the vertical offset, the number of linesGet/set the difficulty configuration:
levelManager:getConfig():getLevelConfig():getDifficulty() -- Get
levelManager:getConfig():getLevelConfig().__difficulty = [1 to 4] -- SetGet/set the log level:
currentConfig:getConsoleConfig():getLogLevel() -- Get
currentConfig:getConsoleConfig().__logLevel = [boolean] -- SetThe levelManager object refers to everything in the levels.
Reset the level manager:
levelManager:initialize()Get the active level:
levelManager:getActiveLevel()Get all loaded levels:
levelManager:getLevels()Get the active level ID:
levelManager:getLevelNumber()Set the active level ID:
levelManager:setLevelNumber([level ID])level is a level.
Set the room visibility to status:
level:setAllRoomsSeenStatusAs(status) -- where status is either true or falsePrint the map:
--[[ arguments are: is_ended, objects, doesDisplayAllMap
- is_ended is if the game is ended (in that case yes)
- objects is the Objects instance (in this case the default empty one)
- whether to display the whole map or just the minimap
]]
level:printLevelMap(true, Objects(1), true)Change room:
level:setRoom(room) -- where room is the new room numberRooms are a single array, but printing the map divide them in level:getColumnCount() columns, and the one on top left is the room number 1 and the room number 2 is in the second column.
It is possible to get a room from its (x, y) coordinates using the level:getRoomFromCoordinates(x, y) method (where (1, 1) is the top left corner). The general formula to
Simulate a move:
level:setRoom(room) -- sets the new room
--[[ arguments are: is_ended, objects
- is_ended is if the game is ended (in that case yes, but you might want to say no)
- objects is the object map (in that case, you can't have anything)
objects is an Objects instance (prefab 1)
returns an EventParsingReturn
]]
level:checkLevelEvents([is_ended], [objects])There are some other commands.
Restart the game with the current state
main()Reset the active level
gameState:onLevelInitialize()If you want to create a level, write:
level = [level]
level:setAllRoomsSeenStatusAs(false)
levelManager.__levels[levelManager:getLevelNumber()] = levelwhere [level] is your level (see docs/level.md#Creating levels).
Then write
main()to start the level testing. (This method is not recommanded.)