This commit is contained in:
David Vogel 2022-07-23 10:57:25 +02:00
parent 2acc4e7e93
commit 508771c347
3 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@ local EntityAPI = dofile_once("mods/noita-mapcap/files/libraries/noita-api/entit
local Hilbert = dofile_once("mods/noita-mapcap/files/libraries/hilbert-curve.lua")
---@type JSONLib
local json = dofile_once("mods/noita-mapcap/files/libraries/json.lua")
local JSON = dofile_once("mods/noita-mapcap/files/libraries/json.lua")
CAPTURE_PIXEL_SIZE = 1 -- Screen to virtual pixel ratio.
CAPTURE_GRID_SIZE = 512 -- in virtual (world) pixels. There will always be exactly 4 images overlapping if the virtual resolution is 1024x1024.
@ -93,11 +93,11 @@ local function captureEntities(entityFile, x, y, radius)
-- Well, as long as it does not crash between write and flush.
if entityFile:seek("end") == 0 then
-- First line.
entityFile:write("[\n\t", json.Marshal(rootEntity), "\n", "]")
entityFile:write("[\n\t", JSON.Marshal(rootEntity), "\n", "]")
else
-- Following lines.
entityFile:seek("end", -2) -- Seek a few bytes back, so we can overwrite some stuff.
entityFile:write(",\n\t", json.Marshal(rootEntity), "\n", "]")
entityFile:write(",\n\t", JSON.Marshal(rootEntity), "\n", "]")
end
-- Prevent recapturing.

View File

@ -10,7 +10,7 @@
-- It would be optimal to generate this API wrapper automatically...
---@type JSONLib
local json = dofile_once("mods/noita-mapcap/files/libraries/json.lua")
local JSON = dofile_once("mods/noita-mapcap/files/libraries/json.lua")
-------------
-- Classes --
@ -183,7 +183,7 @@ function NoitaComponent:MarshalJSON()
--objectMembers = component:ObjectGetMembers
}
return json.Marshal(resultObject)
return JSON.Marshal(resultObject)
end
return ComponentAPI

View File

@ -16,7 +16,7 @@ local ComponentAPI = dofile_once("mods/noita-mapcap/files/libraries/noita-api/co
local Vec2 = dofile_once("mods/noita-mapcap/files/libraries/vec2.lua")
---@type JSONLib
local json = dofile_once("mods/noita-mapcap/files/libraries/json.lua")
local JSON = dofile_once("mods/noita-mapcap/files/libraries/json.lua")
-------------
-- Classes --
@ -371,7 +371,7 @@ function NoitaEntity:MarshalJSON()
result.transform.x, result.transform.y, result.transform.rotation, result.transform.scaleX, result.transform.scaleY = self:GetTransform()
return json.Marshal(result)
return JSON.Marshal(result)
end
return EntityAPI