mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Clean up
This commit is contained in:
parent
2acc4e7e93
commit
508771c347
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user