diff --git a/Loenn/consts/loenn_version.lua b/Loenn/consts/loenn_version.lua index 094d60b..ed8ce42 100644 --- a/Loenn/consts/loenn_version.lua +++ b/Loenn/consts/loenn_version.lua @@ -1 +1 @@ -return require("utils.version_parser")("0.8.0") +return require("utils.version_parser")("0.9.0") diff --git a/Loenn/consts/version.lua b/Loenn/consts/version.lua index 5555d12..079c240 100644 --- a/Loenn/consts/version.lua +++ b/Loenn/consts/version.lua @@ -1 +1 @@ -return require("utils.version_parser")("1.5.0") +return require("utils.version_parser")("1.6.0") diff --git a/Loenn/libraries/modules.lua b/Loenn/libraries/modules.lua index 6988c6e..588bbf3 100644 --- a/Loenn/libraries/modules.lua +++ b/Loenn/libraries/modules.lua @@ -2,7 +2,6 @@ local modules = { { name = "coords_view" }, -- { name = "texture_browser" }, { name = "keyboard_pan" }, - { name = "room_mover" }, { name = "snap_to_grid" }, { name = "styleground_preview" }, { name = "teleporter" } diff --git a/Loenn/modules/room_mover/main.lua b/Loenn/modules/room_mover/main.lua deleted file mode 100644 index ae7b87b..0000000 --- a/Loenn/modules/room_mover/main.lua +++ /dev/null @@ -1,10 +0,0 @@ -local mods = require("mods") - -local room_mover_module = {} - -function room_mover_module.loadTool() - room_mover_module.tool = mods.requireFromPlugin("modules.room_mover.tool") - return room_mover_module.tool -end - -return room_mover_module diff --git a/Loenn/modules/room_mover/settings.lua b/Loenn/modules/room_mover/settings.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Loenn/modules/room_mover/tool.lua b/Loenn/modules/room_mover/tool.lua deleted file mode 100644 index 1f7200c..0000000 --- a/Loenn/modules/room_mover/tool.lua +++ /dev/null @@ -1,181 +0,0 @@ -local utils = require("utils") -local state = require("loaded_state") -local configs = require("configs") -local history = require("history") -local snapshot = require("structs.snapshot") -local viewportHandler = require("viewport_handler") - ---- - -local tool = { - _type = "tool", - name = "anotherloennplugin_room_mover", - group = "placement_end", - layer = "anotherloennplugin_move_rooms", - validLayers = { - "anotherloennplugin_move_rooms" - } -} - -local moving = {} -- list of { room, orig_x, orig_y } -local startX, startY = 0, 0 -local currentX, currentY = 0, 0 - ---- - -local function moveRoom(room, orig_x, orig_y, dx, dy) - room.x = math.floor((orig_x + dx) / 8) * 8 - room.y = math.floor((orig_y + dy) / 8) * 8 - - return (room.x ~= orig_x) or (room.y ~= orig_y) -end - ---- - -local function cancel(rooms) - local any = (#rooms > 0) - - for i, v in ipairs(rooms) do - local room, orig_x, orig_y = unpack(v) - room.x, room.y = orig_x, orig_y - rooms[i] = nil - end - - return any -end - ---- - -function tool.mousepressed(x, y, button, _istouch, _presses) - if button ~= configs.editor.toolActionButton then - return - end - - currentX, currentY = viewportHandler.getMapCoordinates(x, y) - - if #moving > 0 then - cancel(moving) - end - - local sel, selType = state.getSelectedItem() - - if selType == "room" then - -- moving one room - - if currentX < sel.x or currentX >= sel.x + sel.width or - currentY < sel.y or currentY >= sel.y + sel.height then - return false - end - - table.insert(moving, {sel, sel.x, sel.y}) - elseif selType == "table" then - -- moving several things, hopefully all of which are rooms - local hovered = false - - for subsel, subselType in pairs(sel) do - if subselType == "room" then - if currentX >= subsel.x and currentX < subsel.x + subsel.width and - currentY >= subsel.y and currentY < subsel.y + subsel.height then - hovered = true - end - - table.insert(moving, {subsel, subsel.x, subsel.y}) - else - cancel(moving) - return false - end - end - - if not hovered then - cancel(moving) - return false - end - else - return false - end - - if #moving > 0 then - startX, startY = currentX, currentY - return true - else - return false - end -end - -function tool.mousereleased(x, y, button, _istouch, _presses) - if button ~= configs.editor.toolActionButton then - return - end - - currentX, currentY = viewportHandler.getMapCoordinates(x, y) - local dx, dy = currentX - startX, currentY - startY - - if #moving == 0 then - return false - end - - local data = { - rooms = {}, -- map of { room.name = { orig_x, orig_y } } - dx = dx, dy = dy - } - for i, v in ipairs(moving) do - local room, orig_x, orig_y = unpack(v) - data.rooms[room.name] = {orig_x, orig_y} - end - - local function backward(data) - for _, room in ipairs(state.map.rooms) do - if data.rooms[room.name] then - room.x, room.y = unpack(data.rooms[room.name]) - end - end - end - - local function forward(data) - local dx, dy = data.dx, data.dy - - for _, room in ipairs(state.map.rooms) do - if data.rooms[room.name] then - local orig_x, orig_y = unpack(data.rooms[room.name]) - moveRoom(room, orig_x, orig_y, dx, dy) - end - end - end - - local modified = false - - for i, v in ipairs(moving) do - local room, orig_x, orig_y = unpack(v) - modified = moveRoom(room, orig_x, orig_y, dx, dy) or modified - moving[i] = nil - end - - if not modified then return false end - - history.addSnapshot(snapshot.create("Room move", data, backward, forward)) - return true -end - -function tool.mousemoved(x, y, _dx, _dy, _istouch) - currentX, currentY = viewportHandler.getMapCoordinates(x, y) - local dx, dy = currentX - startX, currentY - startY - - if #moving == 0 then - return false - end - - for i, v in pairs(moving) do - local room, orig_x, orig_y = unpack(v) - moveRoom(room, orig_x, orig_y, dx, dy) - end - - return true -end - -function tool.editorMapTargetChanged() - cancel(moving) -end - ---- - -return tool diff --git a/README.md b/README.md index d815c0f..6af5bfb 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ This plugin adds: - a **styleground preview** that lets you see what your parallaxes will look like - keybinds to **snap selected objects to a customisable grid** (ctrl + shift + arrow keys / shift + S by default), and to **view that grid** (ctrl + shift + G) - keybinds to **pan the view**, defaulting to alt + WASD -- a tool to **move rooms** (even several at a time) - a tool to **teleport the player** using Everest's DebugRC interface - a **coordinate viewer** (` by default) - scripts (for use with [Lönn Scripts](https://gamebanana.com/tools/8050)) to: @@ -13,12 +12,8 @@ This plugin adds: - **convert fillers into filler rooms**, for easier editing - **fix lightbeams placed in Ahorn** -It also supports the following experimental add-ons, which you should **only put in your mods folder if you're actively using them**, and **could break even unrelated plugins very easily (!)**: -- a **brush mask**, in the edit menu, which lets you make tools only replace either air or ground, rather than both, available [here](https://github.com/microlith57/AnotherLoennPlugin/releases/tag/brushmask-v1.0.0) -- a **colourgrade preview**, available [here](https://github.com/microlith57/AnotherLoennPlugin/releases/tag/colorgrading-v1.0.0) - These features can be configured; see [the wiki](https://github.com/microlith57/AnotherLoennPlugin/wiki) for information. -Note that this will intentionally stop working for newer Lönn (major) versions than it is updated for (currently v0.8.x, so it won't work for v0.9.x), to make sure it doesn't break things. +Note that this will intentionally stop working for newer Lönn (major) versions than it is updated for (currently v0.9.x, so it won't work for v0.10.x / v1.x), to make sure it doesn't break things. Some code in this repository is derived from [Lönn](https://github.com/CelestialCartographers/Loenn) under the MIT License. diff --git a/everest.yaml b/everest.yaml index f8f93eb..2dea425 100644 --- a/everest.yaml +++ b/everest.yaml @@ -1,5 +1,5 @@ - Name: AnotherLoennPlugin - Version: 1.5.0 + Version: 1.6.0 OptionalDependencies: - Name: LoennScripts Version: 1.0.8 \ No newline at end of file