Page 1 of 1

read a map's seed within a mod

Posted: Thu Sep 06, 2018 7:51 pm
by usafphoenix
Is there a way for a mod to read a map's seed for use as a variable that can make each map have slightly-different playing mechanics or rules based on a cleverly written algorithm that changes cost based upon "random seed"? while still keeping the game values persistant once the game is closed and reloaded because it's based on the map seed and not just a random value.

Re: read a map's seed within a mod

Posted: Thu Sep 06, 2018 8:07 pm
by eradicator
The map seed is available via LuaSurface.map_gen_settings.seed, but you can not base prototype values on this. So any rule you want to change dependant on map seed must be some sort of script. I.e. you can't make recipes cost 1,2,3,4 iron plates based on the map seed. At least not without pre-generating all possible permutations during startup.