[2.0.20] Map generator does not comply with width setting
Posted: Wed Nov 27, 2024 2:19 pm
Issue Description:
After modifying the map generation settings using the on_init event, the game generates new chunks with the size of 320x320 instead of the expected custom size (e.g., 9x9).
Steps to Reproduce:
Call the init_surface_settings function within the on_init event to modify the map generation settings, including chunk width and height.
Start a new game and observe the generated chunk size.
Expected Result:
The chunks should be generated with the custom size specified in the settings, e.g., width=9.
Actual Result:
The chunks are generated with the size of 320x320.
code
After modifying the map generation settings using the on_init event, the game generates new chunks with the size of 320x320 instead of the expected custom size (e.g., 9x9).
Steps to Reproduce:
Call the init_surface_settings function within the on_init event to modify the map generation settings, including chunk width and height.
Start a new game and observe the generated chunk size.
Expected Result:
The chunks should be generated with the custom size specified in the settings, e.g., width=9.
Actual Result:
The chunks are generated with the size of 320x320.
code
Code: Select all
local function init_surface_settings(surface)
local mgs = surface.map_gen_settings
mgs.width = 9
surface.map_gen_settings = mgs
end
script.on_init(function()
if game.surfaces then
for _, surface in pairs(game.surfaces) do
init_surface_settings(surface)
end
end
end)
script.on_event(defines.events.on_surface_created, function(event)
local surface = game.get_surface(event.surface_index)
if surface then
log("Detected new surface: " .. surface.name)
init_surface_settings(surface)
end
end)