Very minor modification to resource-autoplace.lua

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Very minor modification to resource-autoplace.lua

Post 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.
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Very minor modification to resource-autoplace.lua

Post 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.
I have mods! I guess!
Link
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Very minor modification to resource-autoplace.lua

Post by Deadlock989 »

Actually, scratch this request - I need more tweaks than this, so probably time to bite the bullet and write my own.
Post Reply

Return to “Modding interface requests”