From 68b7bcc28e39bdf0926072b834eeeeec0ee6c721 Mon Sep 17 00:00:00 2001 From: Zefram Date: Fri, 16 May 2014 22:02:49 +0100 Subject: split default iron/steel into three metals 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. --- technic_worldgen/crafts.lua | 75 +++++++++++++++++++++ technic_worldgen/locale/de.txt | 8 +++ technic_worldgen/locale/template.txt | 8 +++ technic_worldgen/nodes.lua | 57 ++++++++++++++++ .../textures/technic_carbon_steel_block.png | Bin 0 -> 606 bytes .../textures/technic_carbon_steel_ingot.png | Bin 0 -> 312 bytes .../textures/technic_cast_iron_block.png | Bin 0 -> 606 bytes .../textures/technic_cast_iron_ingot.png | Bin 0 -> 315 bytes .../textures/technic_wrought_iron_block.png | Bin 0 -> 572 bytes .../textures/technic_wrought_iron_ingot.png | Bin 0 -> 293 bytes 10 files changed, 148 insertions(+) create mode 100644 technic_worldgen/textures/technic_carbon_steel_block.png create mode 100644 technic_worldgen/textures/technic_carbon_steel_ingot.png create mode 100644 technic_worldgen/textures/technic_cast_iron_block.png create mode 100644 technic_worldgen/textures/technic_cast_iron_ingot.png create mode 100644 technic_worldgen/textures/technic_wrought_iron_block.png create mode 100644 technic_worldgen/textures/technic_wrought_iron_ingot.png (limited to 'technic_worldgen') diff --git a/technic_worldgen/crafts.lua b/technic_worldgen/crafts.lua index fc593a6..e2d5236 100644 --- a/technic_worldgen/crafts.lua +++ b/technic_worldgen/crafts.lua @@ -34,6 +34,23 @@ minetest.register_craftitem(":technic: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", @@ -61,6 +78,8 @@ 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({ @@ -75,3 +94,59 @@ minetest.register_craft({ 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) diff --git a/technic_worldgen/locale/de.txt b/technic_worldgen/locale/de.txt index 60f3862..1dacb41 100644 --- a/technic_worldgen/locale/de.txt +++ b/technic_worldgen/locale/de.txt @@ -9,7 +9,11 @@ Chromium Ingot = Chrombarren Zinc Lump = Zinkklumpen Zinc Ingot = Zinkbarren Brass Ingot = Messingbarren +Wrought Iron Ingot = Schmiedeeisenbarren +Cast Iron Ingot = Gusseisenbarren +Carbon Steel Ingot = Kohlenstoffstahlbarren Stainless Steel Ingot = Edelstahlbarren +Iron = Eisen ## nodes.lua Uranium Ore = Uranerz @@ -21,8 +25,12 @@ Marble Bricks = Marmorziegel Uranium Block = Uranblock Chromium Block = Chromblock Zinc Block = Zinkblock +Wrought Iron Block = Schmiedeeisenblock +Cast Iron Block = Gusseisenblock +Carbon Steel Block = Kohlenstoffstahlblock Stainless Steel Block = Edelstahlblock Brass Block = Messingblock +Wrought Iron = Schmiedeeisen ## rubber.lua Rubber Tree Sapling = Gummibaumsetzling diff --git a/technic_worldgen/locale/template.txt b/technic_worldgen/locale/template.txt index f1da697..a4a6e4d 100644 --- a/technic_worldgen/locale/template.txt +++ b/technic_worldgen/locale/template.txt @@ -8,7 +8,11 @@ Chromium Ingot = Zinc Lump = Zinc Ingot = Brass Ingot = +Wrought Iron Ingot = +Cast Iron Ingot = +Carbon Steel Ingot = Stainless Steel Ingot = +Iron = ###nodes.lua Uranium Ore = @@ -20,8 +24,12 @@ Marble Bricks = Uranium Block = Chromium Block = Zinc Block = +Wrought Iron Block = +Cast Iron Block = +Carbon Steel Block = Stainless Steel Block = Brass Block = +Wrought Iron = ###rubber.lua Rubber Tree Sapling = diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index 07ec4af..12637f7 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -76,6 +76,29 @@ minetest.register_node(":technic:zinc_block", { sounds = default.node_sound_stone_defaults() }) +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", { + description = S("Cast Iron Block"), + tiles = { "technic_cast_iron_block.png" }, + is_ground_content = true, + groups = {cracky=1, level=2}, + sounds = default.node_sound_stone_defaults() +}) + +minetest.register_node(":technic:carbon_steel_block", { + description = S("Carbon Steel Block"), + tiles = { "technic_carbon_steel_block.png" }, + is_ground_content = true, + groups = {cracky=1, level=2}, + sounds = default.node_sound_stone_defaults() +}) + minetest.register_node(":technic:stainless_steel_block", { description = S("Stainless Steel Block"), tiles = { "technic_stainless_steel_block.png" }, @@ -104,3 +127,37 @@ minetest.register_alias("technic:diamond_block", "default:diamondblock") minetest.register_alias("technic:diamond", "default:diamond") minetest.register_alias("technic:mineral_diamond", "default:stone_with_diamond") +local function for_each_registered_node(action) + local already_reg = {} + for k, _ in pairs(minetest.registered_nodes) do + table.insert(already_reg, k) + end + local really_register_node = minetest.register_node + minetest.register_node = function(name, def) + really_register_node(name, def) + action(string.gsub(name, "^:", "")) + end + for _, name in ipairs(already_reg) do + action(name) + end +end + +for_each_registered_node(function(node_name) + local node_def = minetest.registered_nodes[node_name] + if node_name ~= "default:steelblock" and string.find(node_name, "steelblock") and string.find(node_def.description, "Steel") then + minetest.override_item(node_name, { description = string.gsub(node_def.description, "Steel", S("Wrought Iron")) }) + end + if node_def.tiles or node_def.tile_images then + local tn = node_def.tiles and "tiles" or "tile_images" + local tl = {} + local ca = false + for i, t in ipairs(node_def[tn]) do + if type(t) == "string" and t == "default_steel_block.png" then + ca = true + t = "technic_wrought_iron_block.png" + end + table.insert(tl, t) + end + if ca then minetest.override_item(node_name, { [tn] = tl }) end + end +end) diff --git a/technic_worldgen/textures/technic_carbon_steel_block.png b/technic_worldgen/textures/technic_carbon_steel_block.png new file mode 100644 index 0000000..f3cfdc1 Binary files /dev/null and b/technic_worldgen/textures/technic_carbon_steel_block.png differ diff --git a/technic_worldgen/textures/technic_carbon_steel_ingot.png b/technic_worldgen/textures/technic_carbon_steel_ingot.png new file mode 100644 index 0000000..0d45066 Binary files /dev/null and b/technic_worldgen/textures/technic_carbon_steel_ingot.png differ diff --git a/technic_worldgen/textures/technic_cast_iron_block.png b/technic_worldgen/textures/technic_cast_iron_block.png new file mode 100644 index 0000000..2df61e5 Binary files /dev/null and b/technic_worldgen/textures/technic_cast_iron_block.png differ diff --git a/technic_worldgen/textures/technic_cast_iron_ingot.png b/technic_worldgen/textures/technic_cast_iron_ingot.png new file mode 100644 index 0000000..692fff8 Binary files /dev/null and b/technic_worldgen/textures/technic_cast_iron_ingot.png differ diff --git a/technic_worldgen/textures/technic_wrought_iron_block.png b/technic_worldgen/textures/technic_wrought_iron_block.png new file mode 100644 index 0000000..cf6c961 Binary files /dev/null and b/technic_worldgen/textures/technic_wrought_iron_block.png differ diff --git a/technic_worldgen/textures/technic_wrought_iron_ingot.png b/technic_worldgen/textures/technic_wrought_iron_ingot.png new file mode 100644 index 0000000..b7e6d1e Binary files /dev/null and b/technic_worldgen/textures/technic_wrought_iron_ingot.png differ -- cgit v1.2.3