Problem with mod compatibility

Replaces resource spawning system, so that the distances between resources are much bigger. Railway is needed then.

Moderators: orzelek, Dark

Post Reply
Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Problem with mod compatibility

Post by Bilka »

Hey, I create a new surface in my mod that should just have normal map generation: https://mods.factorio.com/mod/NewGamePlus. In 0.16 I simply did this in my mod, but you removed the second function in 0.17.

Code: Select all

remote.call("RSO", "resetGeneration", surface)
remote.call("RSO", "regenerate", false)
After I removing that second function from my code, I don't seem to get any starting area ores. Am I doing something wrong or is that on your side?

For reference, here is the original topic: 51385
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Problem with mod compatibility

Post by orzelek »

There were quite a few changes in RSO and it doesn't work in the same way as before. Since RSO is per surface now some things work differently.

You shouldn't need any of those two interfaces now - just the addStartLocation interface to create new start location on newly created surface. It takes table with coordinates {x = 0, y = 0} and optionally a player.
It will spawn starting location on surface on which that player is present. For your usage player is needed since it's used to find out surface on which starting location should be placed.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Problem with mod compatibility

Post by Bilka »

Would it be possible for you to simply take the starting location from the surface map gen settings? It feels very redundant to call addStartLocation(player.surface.map_gen_settings.starting_points[1], player).

Two other notes: Please make addStartingLocation not print to chat. Please change

Code: Select all

if outputPlayer and outputPlayer.character then
  surface = outputPlayer.character.surface
else
to

Code: Select all

if outputPlayer then
  surface = outputPlayer.surface
else
so that players without characters still get proper map generation.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Problem with mod compatibility

Post by orzelek »

I'm actually using the first location from map settings but only for nauvis currently.
And the whole affair around not always getting the surface created event is not really helpful in trying to make a consistent implementation. I'll try to extend the support for starting areas automatic creation to all the surfaces when they are found by RSO.
And I'll fix the player/character thingy - I missed the docs part that surface is also on player itself when initially adding this support.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Problem with mod compatibility

Post by orzelek »

Fixed up version released as 5.0.9.
You'll need to call the addStartLocation explicitly due to reason given by eradicator and you in this thread:
viewtopic.php?f=25&t=71365

You should be able to go back to set of calls as it was before and it will work.
Since regenerate will regen all the surfaces RSO is aware now I'm not sure how it will affect performance - surfaces that were used before might also get regenerated. I can create second version of regeneration remote call with explicit surface specification if thats needed.

Post Reply

Return to “Resource Spawner Overhaul”