This code (from my WIP mod) produced the hang/error:
Code: Select all
function SurfaceData.create(surface, pages)
pages = pages or {}
if type(surface) == "string" then
if game.surfaces[surface] ~= nil then
return false
end
local mapGenSettings = game.surfaces["nauvis"].map_gen_settings
mapGenSettings.terrain_segmentation = "none"
mapGenSettings.water = "none"
mapGenSettings.seed = 0
mapGenSettings.starting_area = "medium"
-- THIS CODE BELOW CAUSES HANG --
for name, _ in pairs(mapGenSettings.autoplace_controls) do
if pages[name] == nil then
mapGenSettings.autoplace_controls[name .. "-page"] = { frequency = "none", size = "none", richness = "none" }
else
mapGenSettings.autoplace_controls[name .. "-page"] = { frequency = "normal", size = "medium", richness = "regular" }
end
end
if pages["water-page"] ~= nil then
mapGenSettings.water = "medium"
end
if pages["no-enemies-page"] == nil then
mapGenSettings.autoplace_controls["enemy-base"] = { frequency = "normal", size = "medium", richness = "regular" }
end
surface = game.create_surface(surface, mapGenSettings)
end
local sd = {}
setmetatable(sd, SurfaceData)
sd.type = "SurfaceData"
sd.name = surface.name
sd.pages = pages
return sd
end
Code: Select all
for name, _ in pairs(mapGenSettings.autoplace_controls) do
if pages[name] == nil then
mapGenSettings.autoplace_controls[name .. "-page"] = { frequency = "none", size = "none", richness = "none" }
else
mapGenSettings.autoplace_controls[name .. "-page"] = { frequency = "normal", size = "medium", richness = "regular" }
end
end
The log file doesn't show anything, but I'll include it just in case it's needed.
Computer specs:
OS: Windows 7
Processor: Intel i3-2120
RAM: 8 GB
System Type: 64-bit