read a map's seed within a mod

This is the place to request new mods or give ideas about what could be done.
Post Reply
usafphoenix
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Sun Aug 06, 2017 9:42 am
Contact:

read a map's seed within a mod

Post 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.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: read a map's seed within a mod

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Ideas and Requests For Mods”