Zylleon / MapDesigner

Rimworld mod that allows custom maps
4 stars 4 forks source link

Potential Fix for incorrect map size in river generation #14

Closed TDarksword closed 1 year ago

TDarksword commented 2 years ago

I believe the below should fix the issues with the river position in map generation for anything other than default (250x250) map size.

It does this by creating a new variable that can be set by our code - mapgensize.

A Prefix Harmony Patch, SetMapGenSize is then run when the GenerateMap method within MapGenerator is called. This captures the map size passed to the GenerateMap method (IntVec3 variable mapSize), and then sets the public variable we created earlier to this value.

Finally within the RiverStylePatch Prefix, rather than using Find.World.info.initialMapSize, it now uses the mapgensize variable that was captured and set to get the accurate map size for what is being generated.