Autoplace help

Place to get help with not working mods / modding interface.
Post Reply
GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Autoplace help

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

SirRichie
Fast Inserter
Fast Inserter
Posts: 244
Joined: Wed Feb 25, 2015 4:50 pm
Contact:

Re: Autoplace help

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

Post Reply

Return to “Modding help”