Why is my command getting overwritten?
Posted: Thu Aug 12, 2021 7:12 pm
I'm very new to this and I was messing around with disabling hand mining. This line below worked fine:
I was then messing around with adding new ores. I used some code from the Ice Ore mod to add one and it worked fine:
However now hand mining is enabled again. I don't see why anything in this code from Ice Ore would make the other line not work. "data.raw.character.mining_categories = nil" doesn't work no matter if it goes before or after the Ice Ore code. What am I not understanding about how these interact?
Code: Select all
data.raw.character.mining_categories = nil
Code: Select all
local mod_name = "__test__"
local resource_autoplace = require("resource-autoplace")
-- Initialize the core patch sets in a predictable order
resource_autoplace.initialize_patch_set("ice-ore", true)
local name = "ice-ore"
local order = "a"
local autoplace_parameters = {
base_density = 8,
regular_rq_factor_multiplier = 1.0,
starting_rq_factor_multiplier = 1.1
}
local ice_ore = {
type = "resource",
name = "ice-ore",
icon = mod_name.."/graphics/icons/" .. name .. ".png",
icon_size = 32,
flags = {"placeable-neutral"},
order="a-b-"..order,
tree_removal_probability = 0.8,
tree_removal_max_distance = 32 * 32,
minable =
{
-- mining_particle = name .. "-particle",
mining_time = 1,
result = name
},
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
autoplace = resource_autoplace.resource_autoplace_settings{
name = name,
order = order,
base_density = 8,
has_starting_area_placement = true,
regular_rq_factor_multiplier = 1,
starting_rq_factor_multiplier = 1.1,
-- candidate_spot_count = autoplace_parameters.candidate_spot_count, -- idk, why 22 for iron ore and copper ore?
},
stage_counts = {16000, 8000, 2400, 1200, 640, 320, 160, 80},
stages =
{
sheet =
{
filename = mod_name.."/graphics/entity/" .. name .. ".png",
priority = "extra-high",
width = 64,
height = 64,
frame_count = 8,
variation_count = 8,
hr_version =
{
filename = mod_name.."/graphics/entity/" .. "hr-" .. name .. ".png",
priority = "extra-high",
width = 128,
height = 128,
frame_count = 8,
variation_count = 8,
scale = 0.5
}
}
},
map_color = {r=0.85, g=0.85, b=1}
}
data:extend(
{
{
type = "item",
name = "ice-ore",
icon = mod_name.."/graphics/icons/ice-ore.png",
icon_size = 32,
-- flags = {"goes-to-main-inventory"},
subgroup = "raw-resource",
order = "h",
stack_size = 100
},
}
)
data:extend(
{
ice_ore,
{
type = "autoplace-control",
name = name,
richness = true,
order = "i-o-"..order,
category = "resource"
},
{
type = "noise-layer",
name = name
}
}
)