Add white room browsing mode

This commit is contained in:
Your Name 2026-08-12 02:55:29 -04:00
parent 794b4dc162
commit 3c5e6daf06
4 changed files with 45 additions and 3 deletions

View file

@ -370,6 +370,27 @@ test("co-located colours join the active player selection", function()
"separated blue player should still select by itself")
end)
test("WASD room browsing changes view without moving players", function()
local player = {x = 3, y = 4}
local roomA = {name = "a", player = {red = player}}
local roomB = {name = "b", player = {green = {x = 7, y = 8}}}
local world = setmetatable({
levels = {a = roomA, b = roomB},
roomByName = {a = {name = "a", x = 1, y = 1}, b = {name = "b", x = 2, y = 1}},
rooms = {{name = "a", x = 1, y = 1}, {name = "b", x = 2, y = 1}},
}, {__index = World})
local oldCurrentRoom, oldSetEditorRoomName = currentRoom, setEditorRoomName
currentRoom = roomA
setEditorRoomName = function() end
assertTrue(world:browseRoom(roomA, "d"))
assertTrue(currentRoom == roomB)
assertTrue(world.roomBrowseMode)
assertTrue(player.x == 3 and player.y == 4, "browsing moved the player")
currentRoom, setEditorRoomName = oldCurrentRoom, oldSetEditorRoomName
end)
test("one run cannot terminate at two different switches", function()
local second = switch("red", 1, 2)
local world, _, roomB = makeWorld(second)