mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-22 21:17:33 +00:00
Fix ctx.progressCurrent not being set
This commit is contained in:
parent
78b2812593
commit
84dba8a9fa
@ -223,7 +223,7 @@ function Capture:StartCapturingArea(topLeft, bottomRight, captureGridSize, outpu
|
|||||||
---@param ctx ProcessRunnerCtx
|
---@param ctx ProcessRunnerCtx
|
||||||
local function handleDo(ctx)
|
local function handleDo(ctx)
|
||||||
CameraAPI.SetCameraFree(true)
|
CameraAPI.SetCameraFree(true)
|
||||||
ctx.progressEnd = gridSize.x * gridSize.y
|
ctx.progressCurrent, ctx.progressEnd = 0, gridSize.x * gridSize.y
|
||||||
|
|
||||||
while t < tLimit do
|
while t < tLimit do
|
||||||
-- Prematurely stop capturing if that is requested by the context.
|
-- Prematurely stop capturing if that is requested by the context.
|
||||||
@ -461,8 +461,11 @@ end
|
|||||||
|
|
||||||
---Starts the capturing process based on user/mod settings.
|
---Starts the capturing process based on user/mod settings.
|
||||||
function Capture:StartCapturing()
|
function Capture:StartCapturing()
|
||||||
|
Message:CatchException("Capture:StartCapturing", function()
|
||||||
|
|
||||||
local mode = ModSettingGet("noita-mapcap.capture-mode")
|
local mode = ModSettingGet("noita-mapcap.capture-mode")
|
||||||
local outputPixelScale = ModSettingGet("noita-mapcap.pixel-scale")
|
local outputPixelScale = ModSettingGet("noita-mapcap.pixel-scale")
|
||||||
|
local captureGridSize = tonumber(ModSettingGet("noita-mapcap.grid-size"))
|
||||||
|
|
||||||
if mode == "live" then
|
if mode == "live" then
|
||||||
local interval = ModSettingGet("noita-mapcap.live-interval")
|
local interval = ModSettingGet("noita-mapcap.live-interval")
|
||||||
@ -470,9 +473,34 @@ function Capture:StartCapturing()
|
|||||||
local maxDistance = ModSettingGet("noita-mapcap.live-max-distance")
|
local maxDistance = ModSettingGet("noita-mapcap.live-max-distance")
|
||||||
|
|
||||||
self:StartCapturingLive(interval, minDistance, maxDistance, outputPixelScale)
|
self:StartCapturingLive(interval, minDistance, maxDistance, outputPixelScale)
|
||||||
|
elseif mode == "area" then
|
||||||
|
local area = ModSettingGet("noita-mapcap.area")
|
||||||
|
if area == "custom" then
|
||||||
|
local topLeft = Vec2(ModSettingGet("noita-mapcap.area-top-left"))
|
||||||
|
local bottomRight = Vec2(ModSettingGet("noita-mapcap.area-bottom-right"))
|
||||||
|
|
||||||
|
self:StartCapturingArea(topLeft, bottomRight, captureGridSize, outputPixelScale)
|
||||||
|
else
|
||||||
|
local predefinedArea = Config.CaptureArea[area]
|
||||||
|
if predefinedArea then
|
||||||
|
self:StartCapturingArea(predefinedArea.TopLeft, predefinedArea.BottomRight, captureGridSize, outputPixelScale)
|
||||||
|
else
|
||||||
|
Message:ShowRuntimeError("PredefinedArea", string.format("Unknown predefined capturing area %q", tostring(area)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif mode == "spiral" then
|
||||||
|
local origin = ModSettingGet("noita-mapcap.capture-mode-spiral-origin")
|
||||||
|
if origin == "custom" then
|
||||||
|
local originVec = Vec2(ModSettingGet("noita-mapcap.capture-mode-spiral-origin-vector"))
|
||||||
|
self:StartCapturingSpiral(originVec, captureGridSize, outputPixelScale)
|
||||||
|
else
|
||||||
|
Message:ShowRuntimeError("SpiralOrigin", string.format("Unknown spiral origin %q", tostring(origin)))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Message:ShowRuntimeError("StartCapturing", string.format("Unknown capturing mode %q", tostring(mode)))
|
Message:ShowRuntimeError("StartCapturing", string.format("Unknown capturing mode %q", tostring(mode)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Stops all capturing processes.
|
---Stops all capturing processes.
|
||||||
|
Loading…
Reference in New Issue
Block a user