forked from minetest-mods/technic
68b7bcc28e
Override the default mod's iron/steel substance, replacing it with three metals: wrought iron (pure iron), carbon steel (iron alloyed with a little carbon), and cast iron (iron alloyed with lots of carbon). Wrought iron is easiest to refine, then cast iron, and carbon steel the most difficult, matching the historical progression. Recipes that used default steel are changed to use one of the three, the choice of alloy for each application being both somewhat realistic and also matching up with game progression. The default:steel{_ingot,block} items are identified specifically with wrought iron. This makes the default refining recipes work appropriately. Iron-using recipes defined outside technic are thus necessarily reinterpreted to use wrought iron, which is mostly appropriate. Some objects are renamed accordingly. Rather than use the default steel textures for wrought iron, with technic providing textures for the other two, technic now provides textures for all three metals. This avoids problems that would occur with texture packs that provide default_steel_{ingot,block} textures that are not intended to support this wrought-iron/carbon-steel/cast-iron distinction. A texture pack can provide a distinct set of three textures specifically for the situation where this distinction is required. Incidentally make grinding and alloy cooking recipes work correctly when ingredients are specified by alias.
153 lines
4.1 KiB
Lua
153 lines
4.1 KiB
Lua
|
|
local S = technic.worldgen.gettext
|
|
|
|
minetest.register_craftitem(":technic:uranium", {
|
|
description = S("Uranium"),
|
|
inventory_image = "technic_uranium.png",
|
|
on_place_on_ground = minetest.craftitem_place_item,
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:chromium_lump", {
|
|
description = S("Chromium Lump"),
|
|
inventory_image = "technic_chromium_lump.png",
|
|
on_place_on_ground = minetest.craftitem_place_item,
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:chromium_ingot", {
|
|
description = S("Chromium Ingot"),
|
|
inventory_image = "technic_chromium_ingot.png",
|
|
on_place_on_ground = minetest.craftitem_place_item,
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:zinc_lump", {
|
|
description = S("Zinc Lump"),
|
|
inventory_image = "technic_zinc_lump.png",
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:zinc_ingot", {
|
|
description = S("Zinc Ingot"),
|
|
inventory_image = "technic_zinc_ingot.png",
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:brass_ingot", {
|
|
description = S("Brass Ingot"),
|
|
inventory_image = "technic_brass_ingot.png",
|
|
})
|
|
|
|
minetest.register_alias("technic:wrought_iron_ingot", "default:steel_ingot")
|
|
|
|
minetest.override_item("default:steel_ingot", {
|
|
description = S("Wrought Iron Ingot"),
|
|
inventory_image = "technic_wrought_iron_ingot.png",
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:cast_iron_ingot", {
|
|
description = S("Cast Iron Ingot"),
|
|
inventory_image = "technic_cast_iron_ingot.png",
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:carbon_steel_ingot", {
|
|
description = S("Carbon Steel Ingot"),
|
|
inventory_image = "technic_carbon_steel_ingot.png",
|
|
})
|
|
|
|
minetest.register_craftitem(":technic:stainless_steel_ingot", {
|
|
description = S("Stainless Steel Ingot"),
|
|
inventory_image = "technic_stainless_steel_ingot.png",
|
|
})
|
|
|
|
local function register_block(block, ingot)
|
|
minetest.register_craft({
|
|
output = block,
|
|
recipe = {
|
|
{ingot, ingot, ingot},
|
|
{ingot, ingot, ingot},
|
|
{ingot, ingot, ingot},
|
|
}
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = ingot.." 9",
|
|
recipe = {
|
|
{block}
|
|
}
|
|
})
|
|
end
|
|
|
|
register_block("technic:uranium_block", "technic:uranium")
|
|
register_block("technic:chromium_block", "technic:chromium_ingot")
|
|
register_block("technic:zinc_block", "technic:zinc_ingot")
|
|
register_block("technic:brass_block", "technic:brass_ingot")
|
|
register_block("technic:cast_iron_block", "technic:cast_iron_ingot")
|
|
register_block("technic:carbon_steel_block", "technic:carbon_steel_ingot")
|
|
register_block("technic:stainless_steel_block", "technic:stainless_steel_ingot")
|
|
|
|
minetest.register_craft({
|
|
type = 'cooking',
|
|
recipe = "technic:zinc_lump",
|
|
output = "technic:zinc_ingot",
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = 'cooking',
|
|
recipe = "technic:chromium_lump",
|
|
output = "technic:chromium_ingot",
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = 'cooking',
|
|
recipe = minetest.registered_aliases["technic:wrought_iron_ingot"],
|
|
output = "technic:cast_iron_ingot",
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = 'cooking',
|
|
recipe = "technic:cast_iron_ingot",
|
|
cooktime = 2,
|
|
output = "technic:wrought_iron_ingot",
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = 'cooking',
|
|
recipe = "technic:carbon_steel_ingot",
|
|
cooktime = 2,
|
|
output = "technic:wrought_iron_ingot",
|
|
})
|
|
|
|
local function for_each_registered_craftitem(action)
|
|
local already_reg = {}
|
|
for k, _ in pairs(minetest.registered_items) do
|
|
table.insert(already_reg, k)
|
|
end
|
|
local really_register_craftitem = minetest.register_craftitem
|
|
minetest.register_craftitem = function(name, def)
|
|
really_register_craftitem(name, def)
|
|
action(string.gsub(name, "^:", ""))
|
|
end
|
|
for _, name in ipairs(already_reg) do
|
|
action(name)
|
|
end
|
|
end
|
|
|
|
local steel_to_iron = {}
|
|
for _, i in ipairs({
|
|
"default:axe_steel",
|
|
"default:pick_steel",
|
|
"default:shovel_steel",
|
|
"default:sword_steel",
|
|
"doors:door_steel",
|
|
"farming:hoe_steel",
|
|
"mesecons_doors:op_door_steel",
|
|
"mesecons_doors:sig_door_steel",
|
|
"vessels:steel_bottle",
|
|
}) do
|
|
steel_to_iron[i] = true
|
|
end
|
|
|
|
for_each_registered_craftitem(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)
|