I don’t understand why it’s causing such severe lag.

Place to get help with not working mods / modding interface.
Xeon257
Inserter
Inserter
Posts: 40
Joined: Wed Sep 24, 2025 6:25 pm
Contact:

I don’t understand why it’s causing such severe lag.

Post by Xeon257 »

There’s an issue during the process where the player departs from the spaceship and descends to the planet’s surface. When the player departs and the cargo pod begins to descend, the framerate drops sharply and the game stops progressing.
10-27-2025, 00-20-24.png
10-27-2025, 00-20-24.png (342.44 KiB) Viewed 131 times

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?
I am not able to write in English myself, so I am using ChatGPT for help. Please excuse any awkward phrasing.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16230
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: I don’t understand why it’s causing such severe lag.

Post by Rseding91 »

Without the "create_building" you've limited the map size to a small area - which likely has no landable space for the cargo pod and so it gets stuck trying to find a place for the cargo pod on a surface that will never have one.
If you want to get ahold of me I'm almost always on Discord.
Xeon257
Inserter
Inserter
Posts: 40
Joined: Wed Sep 24, 2025 6:25 pm
Contact:

Re: I don’t understand why it’s causing such severe lag.

Post by Xeon257 »

That’s correct. However, in the early stages of development, when I attempted to land on the lava, the landing was successful, and the player was placed in a state where they couldn’t move on the lava.

Could it be that the forced landing being successful was actually a Error?
I am not able to write in English myself, so I am using ChatGPT for help. Please excuse any awkward phrasing.
Post Reply

Return to “Modding help”