Everything on Nauvis


Moves all resources to Nauvis. Removes other planets.

Tweaks
8 months ago
2.0
6.10K
Factorio: Space Age Icon Space Age Mod
Enemies Environment Mining Fluids

b Crash on creating new surface

10 months ago
(updated 10 months ago)

Hi! I've received a bug report that occurs when my mod is trying to create a surface. My function basically does the following:

minime_surfaces.create_surface = function(surface_name, flags)
  local surface = game.get_surface(surface_name)
  if not (surface and surface.valid) then
    local params = {
      width = 1,
      height = 1,
      peaceful_mode = true
    }
    surface = game.create_surface(surface_name, params) -- Crashing line
    …
  end
  …
end

Apparently, if your mod is active, my mod will crash with this message:

Error while running event minime::on_init()
Unknown variable: control:fulgora_islands:frequency
stack traceback:
    [C]: in function 'create_surface'
    __minime__/scripts/surfaces.lua:112: in function 'create_surface'
    __minime__/control.lua:274: in function 'init'
    __minime__/control.lua:382: in function <__minime__/control.lua:378>

Grepping through your mod for fulgora_islands, I've found the following in line 100 of prototypes/remove-planets.lua:

data.raw["autoplace-control"]["fulgora_islands"] = nil

As I'm not really familiar with autoplace-control stuff and do not have SA, I can't debug this myself. But it seems quite likely that removing data.raw["autoplace-control"]["fulgora_islands"] would be the core reason for the reported crash. Could you look into the issue, please?

10 months ago

My mod is not compatible with other planets. It kinda destroys surfaces of the other planets so i deleted gleba, vulcanus, fulgora and aquilo.

9 months ago

Well, I guess I could adjust my MapGenSettings to this:

local map_gen_settings = {
  width = 1,
  height = 1,
  autoplace_controls = {},
  autoplace_settings = {},
  default_enable_all_autoplace_controls = false,
  …
}

As far as I can see, that should fix the crash. Yet, I think it's bad style to delete default prototypes outright. It seems that fulgora_islands is a default variable (when SA is active) that is automatically used by the game when a surface is created. Thus, removing it will result in crashes – it's probably safer to reset its values. Not sure, perhaps it would even be sufficient to set the autoplace-controls to {} instead of nil.

I suppose not-not-melon's Factorissimo 3 will crash just like my mod when one of its buildings is placed (only width and height are set in its MapGenSettings), and I bet there are many more mods that create surfaces in a lazy way. If it would be possible to clear instead of delete the SA default autoplace-controls, that would avoid a major incompatibility. Alternatively (and provided my new map_gen_settings really fix the crash), a hint for modders in the FAQ section might be a good idea. :-)

9 months ago

I have planned a similar solution for fixing those crashes, but it requiers some refactoring. For right now I am invested into my other mods. Thank you for the report and fixing the issue on your side :)

New response