In the previous version, in worldgen_main.lua, the following codes are used when generation fails.
collectgarbage("collect") WorldSim:ResetAll()
According to my experiments, the WorldSim:ResetAll() does not reset all internal states as previous version.
Steps to Reproduce
You can modify the function `LoadParametersAndGenerate` in worldgen_main.lua with the following to verify:
local function table_to_json_string(tbl) local result = "{" for k, v in pairs(tbl) do if type(v) == "table" then result = result .. '"' .. k .. '":' .. table_to_json_string(v) .. "," else if type(v) == "string" then v = '"' .. v .. '"' elseif type(v) == "function" then v = '"function"' end result = result .. '"' .. k .. '":' .. tostring(v) .. "," end end -- remove trailing comma and close table if result ~= "{" then result = result:sub(1, -2) end result = result .. "}" return result end local function table_to_json_file(tbl, filename) local json_string = table_to_json_string(tbl) local file = io.open(filename, "w") if file then file:write(json_string) file:close() else error("Could not open file for writing: " .. filename) end end local function LoadParametersAndGenerate(debug) local world_gen_data = nil assert(GEN_PARAMETERS ~= nil, "Parameters were not provided to worldgen!") world_gen_data = json.decode(GEN_PARAMETERS) SetDLCEnabled(world_gen_data.DLCEnabled) local generated_data = GenerateNew(debug, world_gen_data) table_to_json_file(generated_data, "generated_data_official1.json") collectgarbage("collect") WorldSim:ResetAll() local generated_data = GenerateNew(debug, world_gen_data) table_to_json_file(generated_data, "generated_data_official2.json") return generated_data end
The data in generated_data_official1.json is different from generated_data_official1.json. However, in the previous version, they are identical except for the field "session_identifier".
-
5
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now