Page 1 of 1
Changing what deposits drop
Posted: Sat Aug 20, 2016 11:53 pm
by FlyingPotato
Alright, so I've scoured everywhere searching for an answer, as well as tried some things on my own, but nothing seems to work properly.
Is there a way to make the ore deposits that are already in the base game drop an item other than the original iron/copper ores?
Re: Changing what deposits drop
Posted: Sun Aug 21, 2016 12:33 am
by aubergine18
Yes, just change 'result' property of a resource prototype:
Code: Select all
data:extend{
{
type = "resource",
name = 'copper-ore',
icon = "__base__/graphics/icons/copper-ore.png",
flags = {"placeable-neutral"},
order="a-b-a",
minable =
{
hardness = 0.9,
mining_particle = "copper-ore-particle",
mining_time = 2,
result = 'copper-ore' <---------------------- THIS
},
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
autoplace = autoplace_settings('copper-ore', 0.02),
stage_counts = {1000, 600, 400, 200, 100, 50, 20, 1},
stages =
{
sheet =
{
filename = "__base__/graphics/entity/copper-ore/copper-ore.png",
priority = "extra-high",
width = 38,
height = 38,
frame_count = 4,
variation_count = 8
}
},
map_color = {r=0.803, g=0.388, b=0.215}
}
}
Re: Changing what deposits drop
Posted: Sun Aug 21, 2016 1:31 am
by FlyingPotato
Alright, so that worked... sort of. I just straight copied and pasted that into my code, and then changed the result to "iron-ore" just for testing. When I ran factorio, I got the error that calling autoplace_settings was a nil value (or something similar) so I added the autoplace_settings from the demo-recipies prototype in the entities. Now my code is this:
Code: Select all
local function autoplace_settings(name, coverage)
local ret = {
control = name,
sharpness = 1,
richness_multiplier = 1500,
richness_multiplier_distance_bonus = 20,
richness_base = 500,
coverage = coverage,
peaks = {
{
noise_layer = name,
noise_octaves_difference = -1.5,
noise_persistence = 0.3,
},
}
}
end
data:extend{
{
type = "resource",
name = 'copper-ore',
icon = "__base__/graphics/icons/copper-ore.png",
flags = {"placeable-neutral"},
order="a-b-a",
minable =
{
hardness = 0.9,
mining_particle = "copper-ore-particle",
mining_time = 2,
result = 'iron-ore' --<---------------------- THIS
},
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
autoplace = autoplace_settings('copper-ore', 0.02),
stage_counts = {1000, 600, 400, 200, 100, 50, 20, 1},
stages =
{
sheet =
{
filename = "__base__/graphics/entity/copper-ore/copper-ore.png",
priority = "extra-high",
width = 38,
height = 38,
frame_count = 4,
variation_count = 8
}
},
map_color = {r=0.803, g=0.388, b=0.215}
}
}
Now copper ore deposits from my old saves give iron ore. However, copper ore deposits aren't showing up on new worlds at all.
Re: Changing what deposits drop
Posted: Sun Aug 21, 2016 2:03 am
by FlyingPotato
Nevermind, I realized I hadn't copied the whole autoplace_settings function. Works perfectly now, thank you!
Re: Changing what deposits drop
Posted: Sun Aug 21, 2016 9:07 am
by prg
Instead of duplicating all of that code you could just leave the existing prototype definition as it is and only change the one thing you care about.
Code: Select all
data.raw.resource["copper-ore"].minable.result = "iron-ore"