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

@ -663,6 +663,7 @@ function World:playerJoinCheck(room, previousPositions, newPositions)
end
function World:movePlayer(room, key)
self.roomBrowseMode = false
local directions = {
up = {x = 0, y = -1, axis = "y"}, down = {x = 0, y = 1, axis = "y"},
left = {x = -1, y = 0, axis = "x"}, right = {x = 1, y = 0, axis = "x"},
@ -714,6 +715,7 @@ function World:movePlayer(room, key)
end
function World:switchPlayerColor(room, color)
self.roomBrowseMode = false
local player = room.player[color]
if not player then
-- A colour copy can be parked in another world room. Number keys are a
@ -771,6 +773,19 @@ function World:switchPlayerColor(room, color)
return canSwitch
end
-- Developer room browser. It changes only the displayed room; players,
-- collision, and runtime save state remain untouched.
function World:browseRoom(room, key)
local exits = {a = "left", d = "right", w = "top", s = "bottom"}
local destinationName = exits[key] and self:getNeighbor(room.name, exits[key])
local destination = destinationName and self.levels[destinationName]
if not destination then return false end
currentRoom = destination
self.roomBrowseMode = true
if setEditorRoomName then setEditorRoomName(destination.name) end
return true
end
function World:tick(room)
room:tickLocal()
self:rebuildCollision()