Page 1 of 1
Problem with mod compatibility
Posted: Tue May 28, 2019 10:41 pm
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
Re: Problem with mod compatibility
Posted: Wed May 29, 2019 8:03 am
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.
Re: Problem with mod compatibility
Posted: Wed May 29, 2019 8:42 am
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.
Re: Problem with mod compatibility
Posted: Wed May 29, 2019 5:47 pm
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.
Re: Problem with mod compatibility
Posted: Fri May 31, 2019 11:48 pm
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.