Code: Select all
local function create_building()
local surface = game.surfaces["linox"];
surface.request_to_generate_chunks({0, 0}, 2)
surface.force_generate_chunk_requests()
local center_size = 13
local modify_tiles = {};
for xx = -center_size, center_size - 1 do
for yy = -center_size, center_size - 1 do
table.insert(modify_tiles, {
position = { x = xx, y = yy },
name = "foundation-linox"
});
end
end
surface.set_tiles(modify_tiles);
local cargo_pad = surface.find_entity("cargo-landing-pad", {0,0})
if cargo_pad == nil then
cargo_pad = surface.create_entity{
name = "cargo-landing-pad",
position = {0,0},
force = "player",
create_build_effect_smoke = false,
}
end
cargo_pad.destructible = false;
cargo_pad.minable = false;
cargo_pad.operable = false;
surface.create_entity{name = "lightning-rod", force = "neutral", position = { -13, -13 }};
surface.create_entity{name = "lightning-rod", force = "neutral", position = { -13, 12 }};
surface.create_entity{name = "lightning-rod", force = "neutral", position = { 12, -13 }};
surface.create_entity{name = "lightning-rod", force = "neutral", position = { 12, 12 }};
surface.create_entity{name = "crash-site-spaceship-wreck-medium-1",
force = "neutral", position = { -4, -7 }}.insert{name = "iron-plate", count = 100};
surface.create_entity{name = "crash-site-spaceship-wreck-medium-2",
force = "neutral", position = { -8, -4 }}.insert{name = "copper-plate", count = 100};
surface.create_entity{name = "crash-site-spaceship-wreck-medium-1",
force = "neutral", position = { -5, 9 }}.insert{name = "iron-plate", count = 100};
surface.create_entity{name = "crash-site-spaceship-wreck-medium-2",
force = "neutral", position = { 9, 3 }}.insert{name = "copper-plate", count = 100};
end
create_event_handler(defines.events.on_surface_created, function(event)
local surface = game.surfaces[event.surface_index];
if surface.name == "linox" then
local settings = surface.map_gen_settings
settings.seed = 0;
settings.width = 128;
settings.height = 128;
surface.map_gen_settings = settings;
--When I uncomment this line and call create_building(), the game runs without any issues.
--create_building()
end
end)
The details related to this issue are as follows:
1. If create_building() is not called, the planet’s surface is completely covered with lava, leaving no space for the player to walk on.
2. In the early stages of development, there were no problems when attempting to land directly on the lava.
3. Even if I force the chunks to generate beforehand, as done at the beginning of the create_building() function, the same problem still occurs.
I can’t find a convincing reason why this issue happens. Has anyone experienced a similar problem?

