mirror of
https://github.com/minetest-mods/technic.git
synced 2025-01-11 18:50:19 +01:00
Allow disabling the steel->wrought iron overrides
This commit is contained in:
parent
43acec2900
commit
a9ad38d095
@ -6,6 +6,7 @@ local defaults = {
|
|||||||
enable_granite_generation = "true",
|
enable_granite_generation = "true",
|
||||||
enable_marble_generation = "true",
|
enable_marble_generation = "true",
|
||||||
enable_rubber_tree_generation = "true",
|
enable_rubber_tree_generation = "true",
|
||||||
|
enable_steel_override = "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(defaults) do
|
for k, v in pairs(defaults) do
|
||||||
|
@ -166,27 +166,29 @@ local function for_each_registered_item(action)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local steel_to_iron = {}
|
if technic.config:get_bool("enable_steel_override") then
|
||||||
for _, i in ipairs({
|
local steel_to_iron = {}
|
||||||
"default:axe_steel",
|
for _, i in ipairs({
|
||||||
"default:pick_steel",
|
"default:axe_steel",
|
||||||
"default:shovel_steel",
|
"default:pick_steel",
|
||||||
"default:sword_steel",
|
"default:shovel_steel",
|
||||||
"doors:door_steel",
|
"default:sword_steel",
|
||||||
"farming:hoe_steel",
|
"doors:door_steel",
|
||||||
"glooptest:hammer_steel",
|
"farming:hoe_steel",
|
||||||
"glooptest:handsaw_steel",
|
"glooptest:hammer_steel",
|
||||||
"glooptest:reinforced_crystal_glass",
|
"glooptest:handsaw_steel",
|
||||||
"mesecons_doors:op_door_steel",
|
"glooptest:reinforced_crystal_glass",
|
||||||
"mesecons_doors:sig_door_steel",
|
"mesecons_doors:op_door_steel",
|
||||||
"vessels:steel_bottle",
|
"mesecons_doors:sig_door_steel",
|
||||||
}) do
|
"vessels:steel_bottle",
|
||||||
steel_to_iron[i] = true
|
}) do
|
||||||
end
|
steel_to_iron[i] = true
|
||||||
|
|
||||||
for_each_registered_item(function(item_name)
|
|
||||||
local item_def = minetest.registered_items[item_name]
|
|
||||||
if steel_to_iron[item_name] and string.find(item_def.description, "Steel") then
|
|
||||||
minetest.override_item(item_name, { description = string.gsub(item_def.description, "Steel", S("Iron")) })
|
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
for_each_registered_item(function(item_name)
|
||||||
|
local item_def = minetest.registered_items[item_name]
|
||||||
|
if steel_to_iron[item_name] and string.find(item_def.description, "Steel") then
|
||||||
|
minetest.override_item(item_name, { description = string.gsub(item_def.description, "Steel", S("Iron")) })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
@ -104,11 +104,6 @@ minetest.register_node(":technic:lead_block", {
|
|||||||
|
|
||||||
minetest.register_alias("technic:wrought_iron_block", "default:steelblock")
|
minetest.register_alias("technic:wrought_iron_block", "default:steelblock")
|
||||||
|
|
||||||
minetest.override_item("default:steelblock", {
|
|
||||||
description = S("Wrought Iron Block"),
|
|
||||||
tiles = { "technic_wrought_iron_block.png" },
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node(":technic:cast_iron_block", {
|
minetest.register_node(":technic:cast_iron_block", {
|
||||||
description = S("Cast Iron Block"),
|
description = S("Cast Iron Block"),
|
||||||
tiles = { "technic_cast_iron_block.png" },
|
tiles = { "technic_cast_iron_block.png" },
|
||||||
@ -156,33 +151,40 @@ local function for_each_registered_node(action)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for_each_registered_node(function(node_name, node_def)
|
if technic.config:get_bool("enable_steel_override") then
|
||||||
if node_name ~= "default:steelblock" and
|
minetest.override_item("default:steelblock", {
|
||||||
node_name:find("steelblock", 1, true) and
|
description = S("Wrought Iron Block"),
|
||||||
node_def.description:find("Steel", 1, true) then
|
tiles = { "technic_wrought_iron_block.png" },
|
||||||
minetest.override_item(node_name, {
|
})
|
||||||
description = node_def.description:gsub("Steel", S("Wrought Iron")),
|
|
||||||
})
|
for_each_registered_node(function(node_name, node_def)
|
||||||
end
|
if node_name ~= "default:steelblock" and
|
||||||
local tiles = node_def.tiles or node_def.tile_images
|
node_name:find("steelblock", 1, true) and
|
||||||
if tiles then
|
node_def.description:find("Steel", 1, true) then
|
||||||
local new_tiles = {}
|
|
||||||
local do_override = false
|
|
||||||
if type(tiles) == "string" then
|
|
||||||
tiles = {tiles}
|
|
||||||
end
|
|
||||||
for i, t in ipairs(tiles) do
|
|
||||||
if type(t) == "string" and t == "default_steel_block.png" then
|
|
||||||
do_override = true
|
|
||||||
t = "technic_wrought_iron_block.png"
|
|
||||||
end
|
|
||||||
table.insert(new_tiles, t)
|
|
||||||
end
|
|
||||||
if do_override then
|
|
||||||
minetest.override_item(node_name, {
|
minetest.override_item(node_name, {
|
||||||
tiles = new_tiles
|
description = node_def.description:gsub("Steel", S("Wrought Iron")),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
local tiles = node_def.tiles or node_def.tile_images
|
||||||
end)
|
if tiles then
|
||||||
|
local new_tiles = {}
|
||||||
|
local do_override = false
|
||||||
|
if type(tiles) == "string" then
|
||||||
|
tiles = {tiles}
|
||||||
|
end
|
||||||
|
for i, t in ipairs(tiles) do
|
||||||
|
if type(t) == "string" and t == "default_steel_block.png" then
|
||||||
|
do_override = true
|
||||||
|
t = "technic_wrought_iron_block.png"
|
||||||
|
end
|
||||||
|
table.insert(new_tiles, t)
|
||||||
|
end
|
||||||
|
if do_override then
|
||||||
|
minetest.override_item(node_name, {
|
||||||
|
tiles = new_tiles
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user