From 80933ad1e36d8ecf60d8e654f4d5609601fe5ba2 Mon Sep 17 00:00:00 2001 From: MrPingu07 Date: Fri, 7 Aug 2026 04:40:14 -0300 Subject: [PATCH] feat(VoxelGrid): add BTL-OFF rung to V-GRID setting V-GRID now cycles OFF / ON / BTL-OFF. BTL-OFF keeps the wireframe off during battles while leaving it available in the overworld. ON preserves the original behaviour (wireframe forced on in battles regardless of the row). --- README.md | 2 +- lib/BattleScene.lua | 4 ++++ lib/VoxelGrid.lua | 13 ++++++++++--- main.lua | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cf80fe6..c01d274 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ menu. | --- | --- | | `3`, or the **VOXEL** options row | OFF → 15 → 35 → 50 → 75 → 1ST → 3RD → OFF (camera pitch) | | `SELECT` (pad / touch) | the same step as `3` — for the machines with no number row | -| `5`, or the **V-GRID** options row | OFF / ON — a one-pixel wireframe on every voxel | +| `5`, or the **V-GRID** options row | OFF / ON / BTL-OFF — a one-pixel wireframe on every voxel; BTL-OFF disables it during battles | | `6`, or the **T-SHIFT** options row | OFF → 1 → 2 → 3 → OFF (miniature blur) | | `7`, or the **V-CURVE** options row | OFF → 1 → 2 → 3 → 4 → 5 — bend the world over the horizon; 5 is a half sphere | | the **RENDER DIST** options row | FIT / WIDE / WIDER / WIDEST / OFF — how much of the map the camera bothers to draw. **FIT** is exactly the ground on screen and no more: the trapezoid a tilted camera really frames, which reaches well north of you and flares wide out there — not the square the flat game shows. A connected map falling entirely outside it is skipped before it is drawn, terrain, water, grass and shadows together, which is most of the frame's geometry at the high rungs. Below about 63° that is all the row does and the picture is untouched; at **75** the camera sees to the horizon, so something has to name a distance — FIT is the closest, the wider rungs push the world's edge out, **OFF** stops cutting. Not on **1ST** or **3RD**: you are standing in the world there, and the box opens out and away as the camera dives in. **FULL** sets it to FIT | diff --git a/lib/BattleScene.lua b/lib/BattleScene.lua index e2ceba2..680f5fb 100644 --- a/lib/BattleScene.lua +++ b/lib/BattleScene.lua @@ -643,6 +643,10 @@ function BattleScene.render(state, arena, textures, token) -- the world (see VoxelGrid): the arena is drawn a unit per voxel like -- everything else, so the seams follow the one toggle and a player who -- turned them off does not get them back for the length of a fight. + local gridWas = VoxelGrid.override + if VoxelGrid.battleForced() then + VoxelGrid.override = true + end local out = nil local ok, err = pcall(function() -- its own canvas slot: this renders at the window's pixel size and the diff --git a/lib/VoxelGrid.lua b/lib/VoxelGrid.lua index fdaf68c..46dec5d 100644 --- a/lib/VoxelGrid.lua +++ b/lib/VoxelGrid.lua @@ -59,7 +59,7 @@ end -- where it persists and the rows that cycle it (see ModSetting) VoxelGrid.setting = ModSetting.new(VoxelGrid.KEY, VoxelGrid.LABEL, - { false, true }, { "OFF", "ON" }) + { false, true, "btloff" }, { "OFF", "ON", "BTL-OFF" }) -- The row is the whole answer, everywhere: free-roam and the battle arena -- alike. The battle used to force the seams on regardless -- a fight is a @@ -68,7 +68,14 @@ VoxelGrid.setting = ModSetting.new(VoxelGrid.KEY, VoxelGrid.LABEL, -- whole mod, and a mode that came back for every fight read as the row not -- working rather than as a deliberate framing. function VoxelGrid.enabled() - return VoxelGrid.setting:get() and true or false + if VoxelGrid.override ~= nil then return VoxelGrid.override end + local v = VoxelGrid.setting:get() + if v == "btloff" then return false end + return v and true or false +end + +function VoxelGrid.battleForced() + return VoxelGrid.setting:get() ~= "btloff" end function VoxelGrid.set(enabled, game) @@ -80,7 +87,7 @@ function VoxelGrid.toggle(game) end function VoxelGrid.sync(value) - VoxelGrid.setting:sync(value and true or false) + VoxelGrid.setting:sync(value) end function VoxelGrid.row() diff --git a/main.lua b/main.lua index 2cb7903..144d03f 100644 --- a/main.lua +++ b/main.lua @@ -474,7 +474,7 @@ end -- its own: 3D WORLD is exactly the rows WITHOUT it, so that whole -- category empties out under FULL and takes itself off the menu. local SETTINGS = { - -- ------- the top-level menu -- settings that are about the GAME + -- ------- the top-level menu -- settings that are about the GAME -- -- SettingsMenu.ROOT as a `cat` puts a row on the DRAMATIC SHAPE screen -- itself rather than inside one of the four categories, which is right @@ -490,7 +490,7 @@ local SETTINGS = { cat = SettingsMenu.ROOT, full = true }, -- ------- 3D WORLD -- the diorama's own knobs, every one of them FULL's - { VoxelGrid.setting, "One-pixel wireframe along every voxel edge.", + { VoxelGrid.setting, "One-pixel wireframe along every voxel edge. BTL-OFF disables it during battles.", cat = "world" }, { WorldCurve.setting, "Bends the world down over the horizon, until a town sits on top of its "