Page 1 of 1

Autoplace help

Posted: Mon Feb 15, 2016 7:25 am
by GotLag
I've got a mod that adds a resource (rare earth) that can be (with some effort) crafted into artifacts, for people like myself who play on peaceful mode. Currently I've got a low and sparse spawn rate, which I arrived through making a series of trial-and-error changes to the autoplace controls.

Is there a way I can make these deposits spawn only where alien bases do?

Secondly, if I set the rare earth frequency to be higher than that of the alien bases, is it possible to end up with rare earth deposit at each alien base, plus a few rare earth deposits on their own?

I've tried reading the wiki article on autoplace but I'm not really getting it at all.

Re: Autoplace help

Posted: Mon Feb 15, 2016 3:56 pm
by SirRichie
Hi and welcome

autoplace is a really tricky concept.
The good (and bad) news is: you do not need to master autoplace, to do what you want. Because you cannot model spatial relationships with autoplace.

That being said, here is what you can do:
You can hook into the chunk_generated event and then analyze the newly generated chunk for any biter bases (find_entities_filtered). If there are bases, you can generate a patch of your ore. If you need some randomly placed chunks in addition, you can just do so as well (map_gen_settings are available as a property of the surface).

You can use RSO's code or my code from Train Outposts as a reference for above mechanism (I'd claim that my code is much more structured and readable, but I may be biased ;) ).