-- The save editor's whole mutable world. Ops.lua is the only module allowed -- to change the `save` sub-tree (and it always sets dirty + status together); -- everything else here is view state -- which tab, which row, which page. local State = {} function State.new() return { -- loaded content data = nil, cat = nil, -- sorted species / items / moves id lists (Catalog) events = nil, -- scraped EVENT_* / MOD_* flag names (Catalog) save = nil, path = nil, validation = nil, -- what the running game would quarantine, on a copy -- file state dirty = false, loadError = false, -- true when the save file exists but failed to decode allowSave = true, -- false while loadError, until a successful Reload _quitArmed = false, _openArmed = false, -- Which game this save belongs to, so the title bar can show the RED / -- BLUE chip and the launcher can hand the editor the right slot. Set by -- App.load's opts; nil in a bare `love . --editor` run. version = nil, slotId = nil, -- Hosted inside the launcher process (Edit on a save row) rather than a -- standalone `--editor` window: Close returns to the launcher instead of -- quitting, and App calls onClose() to do it. embedded = false, onClose = nil, -- chrome tab = "party", -- party|boxes|items|events|map|dex status = "", armed = nil, -- id of the destructive button awaiting confirmation armedAt = nil, -- when it was armed (Ops.ARM_SECONDS to commit) -- party / inspector selectedParty = 1, editingMon = nil, -- reference into party or a box -- boxes selectedBox = 1, selectedBoxSlot = 1, -- items itemQuery = "", selectedItemId = nil, selectedBagId = nil, selectedPcId = nil, bagOffset = 0, pcOffset = 0, -- events eventsTab = "flags", eventFilter = "", eventsOffset = 0, -- dex dexOffset = 0, -- map mapId = nil, mapQuery = "", mapListOffset = 0, mapCamX = 0, mapCamY = 0, mapZoom = 2, mapClickCell = nil, } end function State.markDirty(s) s.dirty = true end return State