Skip to content

Commit

Permalink
Simplified the progress steps for scmap write
Browse files Browse the repository at this point in the history
There was a total count error somewhere, and I do not care to fix it 
especially given this almost never renders in time anymore given how 
optimised it is.
  • Loading branch information
The-Balthazar committed Jul 17, 2024
1 parent 90738aa commit 18d8f5b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils/scmap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -639,38 +639,39 @@ end

function scmapUtils.exportScmapData(data, folder)
local channel = folder
love.thread.getChannel(folder):push(13 + (data.normapMap and 1 or 0) + (data.arbitrary and #data.arbitrary or 0))
love.thread.getChannel(folder):push(4)
if folder then love.filesystem.createDirectory(folder) end
folder = (folder and folder..'/' or '')
for k, v in pairs(data) do
if type(v)=='table' and v.__format then
love.thread.getChannel(channel):push("Writing "..k)
love.filesystem.write(folder..k..'.'..v.__format, v[1])
data[k] = nil
love.thread.getChannel(channel):push(-1)
end
end
love.thread.getChannel(channel):push(-1)

for i, foldername in ipairs{'arbitrary', 'utilityTextures'} do
if data[foldername] then
love.filesystem.createDirectory(folder..foldername)
for i, file in ipairs(data[foldername]) do
local filename = file.__filename or ('_utilityc%d.%s'):format(i-1, file.__format)
love.thread.getChannel(channel):push("Writing "..filename)
love.filesystem.write(folder..foldername..'/'..filename, file[1])
love.thread.getChannel(channel):push(-1)
end
data[foldername] = nil
end
end
love.thread.getChannel(channel):push("Writing data.lua")
love.thread.getChannel(channel):push(-1)

love.thread.getChannel(channel):push("Writing data.lua")
for i, set in ipairs{'waveGenerators', 'decals', 'props'} do
if data[set] and #data[set]>100 then
love.filesystem.write(folder..set..'.lua', table.serialize(data[set]))
data[set] = nil
love.thread.getChannel(channel):push(-1)
end
end
love.thread.getChannel(channel):push(-1)

love.filesystem.write(folder..'data.lua', table.serialize(data))
love.thread.getChannel(channel):push("Done")
Expand Down

0 comments on commit 18d8f5b

Please sign in to comment.