From df46afacb344d9550fecf3542202f092e353c5ed Mon Sep 17 00:00:00 2001 From: Diject Date: Fri, 2 Jan 2026 20:05:50 +0300 Subject: [PATCH] Update script for tilemap generation --- files/data/scripts/map_extractor/global.lua | 41 ++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/files/data/scripts/map_extractor/global.lua b/files/data/scripts/map_extractor/global.lua index 5200ebc865..c60ad0df71 100644 --- a/files/data/scripts/map_extractor/global.lua +++ b/files/data/scripts/map_extractor/global.lua @@ -27,6 +27,41 @@ local function getCellId(cell) end +local function showCompletionMessage() + if world.isMapExtractionActive() then + async:newUnsavableSimulationTimer(0.1, showCompletionMessage) + return + end + + local pl = world.players[1] + pl:sendEvent("builtin:map_extractor:updateMenu", { + line1 = "Map extraction complete.", + line2 = "", + line3 = "", + }) +end + + +local function generateTilemap() + if world.isMapExtractionActive() then + async:newUnsavableSimulationTimer(0.1, generateTilemap) + return + end + + local pl = world.players[1] + pl:sendEvent("builtin:map_extractor:updateMenu", { + line1 = "Generating tile world map...", + line2 = "The game may freeze for a short time.", + line3 = "", + }) + + async:newUnsavableSimulationTimer(0.2, function () + world.generateTileWorldMap(util.color.rgb(0.255, 0.224, 0.180)) + showCompletionMessage() + end) +end + + local function processAndTeleport(skipExtraction) local pl = world.players[1] @@ -98,11 +133,7 @@ local function processAndTeleport(skipExtraction) until i <= 0 if i <= 0 then - pl:sendEvent("builtin:map_extractor:updateMenu", { - line1 = "Map extraction complete.", - line2 = "", - line3 = "", - }) + generateTilemap() end end