This commit is contained in:
Your Name 2026-08-07 03:22:28 -04:00
parent f8e3d78332
commit b9b0726506
6 changed files with 140 additions and 81 deletions

View file

@ -33,6 +33,7 @@ local editorRoomName = nil
local roomNameField = nil
local editorStatus = nil
local clearSaveConfirmationExpires = 0
local clearSaveConfirmationScope = nil
local worldSeedConfirmationExpires = 0
local worldMode = "place"
local worldRoomButtons = {}
@ -129,7 +130,8 @@ local function saveRoomFromEditor()
return
end
if not currentRoom:saveToSource(name) then
local savePlayerPositions = love.keyboard.isDown("lshift", "rshift")
if not currentRoom:saveToSource(name, savePlayerPositions, oldName) then
editorStatus = "Could not save '" .. name .. "'."
return
end
@ -146,20 +148,28 @@ local function saveRoomFromEditor()
editorRoomName = name
roomNameField:editText(name)
activeField = nil
editorStatus = "Saved source level '" .. name .. ".'"
editorStatus = "Saved source level '" .. name .. "'" .. (savePlayerPositions and " with player positions." or ".")
end
local function clearRuntimeSaves()
local now = love.timer.getTime()
if now > clearSaveConfirmationExpires then
local clearAll = love.keyboard.isDown("lshift", "rshift")
local roomName = currentRoom.name
local scope = clearAll and "all" or roomName
if now > clearSaveConfirmationExpires or clearSaveConfirmationScope ~= scope then
clearSaveConfirmationExpires = now + 3
editorStatus = "Click the clear-save icon again within 3 seconds to erase runtime saves."
clearSaveConfirmationScope = scope
if clearAll then
editorStatus = "Shift-click the clear-save icon again within 3 seconds to erase runtime saves for every room."
else
editorStatus = "Click the clear-save icon again within 3 seconds to erase the runtime save for '" .. (roomName or "this room") .. "'."
end
return
end
local removed = clearRuntimeSaveData()
local removed = clearRuntimeSaveData(clearAll and nil or roomName)
clearSaveConfirmationExpires = 0
local roomName = currentRoom.name
clearSaveConfirmationScope = nil
if roomName then
currentRoom = Room:new{ name = roomName }
setEditorRoomName(currentRoom.name)
@ -521,6 +531,7 @@ local function openWorldRoom(cellX, cellY)
currentRoom = Room:new{ name = name }
editorStatus = "Editing '" .. name .. ".'"
end
gameWorld:setLastRoom(currentRoom.name)
setEditorRoomName(currentRoom.name)
assetsView()
end