orzelek wrote: ↑Fri Mar 01, 2019 6:04 pm
It's not only limited to mod ores.
I seen iron or copper do this - I think they might have underflow/overflow kind of error somewhere in the code that gets triggered when you use minimum frequency.
When I looked at how probability is defined in data stage (expression tree with 100+ elements) I did not try to look into it further
Yeah I tried that myself in hopes of figuring out where I was wrong and it just made me more confused. I tried looking at the Demo-resource-autoplace aswelll but that too weren't very concrete at what settings it wanted to be fed. The demo resources also used a function inside the Demo-resource-autoplace and I dont know how to use that function myself
Code: Select all
utoplace = resource_autoplace.resource_autoplace_settings{
name = resource_parameters.name,
order = resource_parameters.order,
base_density = autoplace_parameters.base_density,
has_starting_area_placement = true,
resource_index = resource_autoplace.get_next_resource_index(),
regular_rq_factor_multiplier = autoplace_parameters.regular_rq_factor_multiplier;
starting_rq_factor_multiplier = autoplace_parameters.starting_rq_factor_multiplier;
}
and looking at how the uraninium is setup, it too uses that function inside the Demo-....
Code: Select all
autoplace = resource_autoplace.resource_autoplace_settings{
name = "uranium-ore",
order = "c",
base_density = 0.9,
base_spots_per_km2 = 1.25,
has_starting_area_placement = false,
random_spot_size_minimum = 2,
random_spot_size_maximum = 4,
resource_index = resource_autoplace.get_next_resource_index(),
regular_rq_factor_multiplier = 1
is there a way for me to use the resource_autoplace.resource_autoplace_settings outside of the core files? I tried including it but since it was in a different "mod" it didnt work
Edit: I tried to work my way down the tree and modifying the values that had a name
Code: Select all
local obj = util.table.deepcopy(data.raw["resource"]["copper-ore"])
local ap = obj.autoplace
ap.control = base.name
local settingsProb = ap.probability_expression.arguments[1].expression.arguments[1].arguments[1].arguments.basement_value.arguments[1].arguments[2].arguments[2].arguments[1].arguments[1].arguments[1].arguments[2].arguments[1].arguments[1].arguments[1].arguments[1].arguments[2]
settingsProb.arguments[1].expression_id = "variable:control-setting:"..base.name..":frequency:multiplier"
settingsProb.arguments[1].variable_name = "control-setting:"..base.name..":frequency:multiplier"
settingsProb.arguments[2].expression_id = "variable:control-setting:"..base.name..":size:multiplier"
settingsProb.arguments[2].variable_name = "control-setting:"..base.name..":size:multiplier"
local settingsRich = ap.richness_expression.arguments[2].arguments[2]
settingsRich.expression_id = "variable:control-setting:"..base.name..":richness:multiplier"
But now ingame it just replaces the copper ore so it seems just changing the name of these settings didnt fix it
Edit2:
I tried working with the vanille oregen by importing the class they used;
Code: Select all
local resource_autoplace = require("__base__/prototypes/entity/demo-resource-autoplace")
obj.autoplace = resource_autoplace.resource_autoplace_settings{
name = base.name,
order = "b",
base_density = base.base_density,
--base_spots_per_km2 = base.base_spots_per_km2,
has_starting_area_placement = base.starting_area,
--random_spot_size_minimum = base.random_spot_size_minimum,
--random_spot_size_maximum = base.random_spot_size_maximum,
resource_index = resource_autoplace.get_next_resource_index(),
regular_rq_factor_multiplier = base.regular_rq_factor_multiplier,
starting_rq_factor_multiplier = (base.starting_rq_factor_multiplier or 0)
}
with the some ores, all using the same settings as the iron does in the demo
Code: Select all
{
base_density = 10,
regular_rq_factor_multiplier = 1.10,
sta
but now I am even more confuse because the spawner is being all wierd and only making mixed patches;
all those highligthed ones are Gold+Coal patches, there is not a single seperate one of those, but as you can see the other ores work ish. But for some reason there is no Copper outside the spawn anymore... But if i take the slider up 1 tick in frq to 133% it starts spawning again.
Edit4: I managed to fix the the coal+gold always spawning together....but now lead and coal allways spawn together...
Edit5: I figured out why the resources spawned on top of eachother, or atleast I suspect what the issue was, inside the demo-resource they use the resource_autoplace.get_next_resource_index() to get the next index of the ore, so in vanille it would be 1(iron),2(copper),3(Coal),4(stone),5(oil) and 6(uranium). What I think is happening is that since the counter variable is a local it starts at 0 again when my mod commes and uses the same resource_autoplace.get_next_resource_index(), so that my resources get the same index and thus collide in the spawning. I fiex that by just manually setting in a new number
now they spawn as expected, evenly spread and not ontop of eachother