Page 1 of 1

Very minor modification to resource-autoplace.lua

Posted: Mon Mar 02, 2020 1:33 pm
by Deadlock989
Requesting that line 98 of the resource-autoplace.lua library function is changed from:

Code: Select all

local frequency_multiplier = control_setting.frequency_multiplier
to:

Code: Select all

local frequency_multiplier = control_setting.frequency_multiplier * (params.frequency_multiplier or 1) 
This allows us to pass in a parameter modifying the relative frequency of specific ore patches without having to mess around with density, spots, all that black magic that's hard to understand. It will have no effect at all unless any mod starts specifying that parameter.

There are other parameters which do affect frequency but very chaotically, and I needed a way to influence patch frequency of a specific resource in the exact same way as the frequency slider in the map generation settings.

I can copy this library but it would lag behind any other changes made in the base game.

Re: Very minor modification to resource-autoplace.lua

Posted: Mon Mar 02, 2020 3:07 pm
by Honktown
The autoplace equations are directly accessible in data.raw, so as long as resources are determined by the data phase and not faffing about in control, it's doable. Just wrap the whole PFE in a multiplication by a variable, but it'd be easy to break if the variable wasn't defined. Think I accidentally deleted my expression to lisp-like decoder so I don't have an example of how the autoplace calculates things :( . Basically it's just a push-button calculator, so if you know what the commands are and what they do/don't take, it's not hard to make modifications, just tedious.

Re: Very minor modification to resource-autoplace.lua

Posted: Mon Mar 02, 2020 8:34 pm
by Deadlock989
Actually, scratch this request - I need more tweaks than this, so probably time to bite the bullet and write my own.