Resource Spawner Overhaul

by orzelek

Makes resources more sparse than base game. You will need to use trains much earlier to get resources. Game will be more difficult especially with higher enemy settings.

Tweaks
24 days ago
0.14 - 2.0
145K
Environment

b 2.0 - Totally breaks factorissimo

a month ago

Greetings,

I am the author of Factorissimo3
I have received the following bug report.

https://github.com/notnotmelon/factorissimo-2-notnotmelon/issues/91

It seems in 2.0 RSO does not respect the following codes

if remote.interfaces["RSO"] then -- RSO compatibility
remote.call("RSO", "ignoreSurface", surface_name)
end

a month ago
(updated a month ago)

Ignoring of surface seems to work correctly but you need to ignore it before you create it.
And currently surface creation event is coming before your ignore surface call:

  29.590 Script @__rso-mod__/control.lua:2003: Creating surface nauvis-factory-floor
  29.590 Script @__rso-mod__/control.lua:2004: nil
  29.594 Script @__rso-mod__/control.lua:1061: Starting area spawn for nauvis-factory-floor
  29.709 Script @__rso-mod__/control.lua:2126: Ignoring surface nauvis-factory-floor
  29.710 Script @__rso-mod__/control.lua:2126: Ignoring surface nauvis-factory-floor
  30.989 Script @__rso-mod__/control.lua:2003: Creating surface factory-travel-surface
  30.990 Script @__rso-mod__/control.lua:2004: {
  ["nauvis-factory-floor"] = true
}

And also factory travel surface is not ignored which will also trigger starting area generation on it.

a month ago

Thanks for this post. I fixed the same issue in Vehicle Wagon by adding the remote call before the create_surface function call.

Though I do wonder why RSO does not detect the absence of defined starting areas in order to avoid crashing outright.

a month ago

How would I detect the absence of starting areas because I'm not sure?
RSO currently manages starting areas on it's own and it has no means of knowing that newly created surface shouldn't have a default one I think.

a month ago

On RSO control.lua line 1828, you read the list of starting_points out of surface.map_gen_settings. This list is sometimes nil or empty, so lines 1829-1830 check for that and only add to surfaceData.starting_areas if the map_gen_settings.starting_points exist.

On line 1061, the line that is crashing assumes that the given index of starting_areas exists, but starting_areas might be an empty array. I would suggest that you add a check to make sure that surfaceData.starting_areas[index] exists before attempting to use it, and maybe print a warning message if it doesn't rather than crash the game. It's still good for other mods to use the interface to disable the RSO logic completely, but this would fail more gracefully.

a month ago

Thanks, I'll fix it at some point when I'm around that code.

New response