From 69d4f869f6f60b6de57a01a8ae3a0b03d640391f Mon Sep 17 00:00:00 2001 From: OgelGames Date: Sat, 23 Oct 2021 17:13:12 +1100 Subject: [PATCH 1/4] Remove depends.txt files --- concrete/depends.txt | 4 ---- concrete/mod.conf | 4 ++-- extranodes/depends.txt | 9 --------- technic_cnc/depends.txt | 3 --- technic_worldgen/depends.txt | 9 --------- technic_worldgen/mod.conf | 2 +- wrench/depends.txt | 6 ------ wrench/mod.conf | 2 +- 8 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 concrete/depends.txt delete mode 100644 extranodes/depends.txt delete mode 100644 technic_cnc/depends.txt delete mode 100644 technic_worldgen/depends.txt delete mode 100644 wrench/depends.txt diff --git a/concrete/depends.txt b/concrete/depends.txt deleted file mode 100644 index 5ca909cc..00000000 --- a/concrete/depends.txt +++ /dev/null @@ -1,4 +0,0 @@ -default -basic_materials -intllib? -moreblocks? diff --git a/concrete/mod.conf b/concrete/mod.conf index 506f9061..65d92b32 100644 --- a/concrete/mod.conf +++ b/concrete/mod.conf @@ -1,3 +1,3 @@ name = concrete -depends = default -optional_depends = basic_materials, intllib, moreblocks +depends = default, basic_materials, technic +optional_depends = intllib, moreblocks diff --git a/extranodes/depends.txt b/extranodes/depends.txt deleted file mode 100644 index 0279a18a..00000000 --- a/extranodes/depends.txt +++ /dev/null @@ -1,9 +0,0 @@ -default -technic_worldgen -basic_materials -concrete -unifieddyes? -intllib? -moreblocks? -steel? -streetsmod? diff --git a/technic_cnc/depends.txt b/technic_cnc/depends.txt deleted file mode 100644 index bdaa161a..00000000 --- a/technic_cnc/depends.txt +++ /dev/null @@ -1,3 +0,0 @@ -default -basic_materials -technic? diff --git a/technic_worldgen/depends.txt b/technic_worldgen/depends.txt deleted file mode 100644 index 6a92b7de..00000000 --- a/technic_worldgen/depends.txt +++ /dev/null @@ -1,9 +0,0 @@ -default -basic_materials -intllib? -mg? -doors? -farming? -glooptest? -mesecons_doors? -vessels? diff --git a/technic_worldgen/mod.conf b/technic_worldgen/mod.conf index 49988f52..4cd10336 100644 --- a/technic_worldgen/mod.conf +++ b/technic_worldgen/mod.conf @@ -1,3 +1,3 @@ name = technic_worldgen -depends = default, basic_materials +depends = default optional_depends = intllib, mg, doors, farming, glooptest, mesecons_doors, vessels diff --git a/wrench/depends.txt b/wrench/depends.txt deleted file mode 100644 index 25c52566..00000000 --- a/wrench/depends.txt +++ /dev/null @@ -1,6 +0,0 @@ -default -technic? -technic_chests? -technic_worldgen? -intllib? -drawers? diff --git a/wrench/mod.conf b/wrench/mod.conf index a18b4f75..9a743664 100644 --- a/wrench/mod.conf +++ b/wrench/mod.conf @@ -1,3 +1,3 @@ name = wrench depends = default -optional_depends = technic, technic_chests, technic_worldgen, intllib +optional_depends = technic, technic_chests, technic_worldgen, intllib, drawers From f26c8b62f2fd323430f8252f8559ad930b8664aa Mon Sep 17 00:00:00 2001 From: OgelGames Date: Mon, 1 Nov 2021 18:11:00 +1100 Subject: [PATCH 2/4] Fix dependencies removed dependency on `screwdriver` and added `moreores` dependency --- generate-mtinfo.sh | 1 + integration-test.sh | 1 + technic/machines/other/constructor.lua | 6 +++++- technic/machines/register/battery_box.lua | 6 +++++- technic/machines/register/cables.lua | 4 ++-- technic/mod.conf | 4 ++-- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/generate-mtinfo.sh b/generate-mtinfo.sh index 2dcb31a2..eb5bed1e 100755 --- a/generate-mtinfo.sh +++ b/generate-mtinfo.sh @@ -12,6 +12,7 @@ git clone --depth=1 https://gitlab.com/VanessaE/basic_materials.git ${WORLDMODS_ git clone --depth=1 https://gitlab.com/VanessaE/pipeworks.git ${WORLDMODS_DIR}/pipeworks git clone --depth=1 https://gitlab.com/VanessaE/unifieddyes.git ${WORLDMODS_DIR}/unifieddyes git clone --depth=1 https://github.com/minetest-mods/moreblocks.git ${WORLDMODS_DIR}/moreblocks +git clone --depth 1 https://github.com/minetest-mods/moreores.git ${WORLDMODS_DIR}/moreores git clone --depth=1 https://github.com/BuckarooBanzay/mtinfo.git ${WORLDMODS_DIR}/mtinfo cp . ${WORLDMODS_DIR}/technic -R diff --git a/integration-test.sh b/integration-test.sh index 598bcc47..105c112b 100755 --- a/integration-test.sh +++ b/integration-test.sh @@ -15,6 +15,7 @@ rm -rf ${WORLDDIR} mkdir -p ${WORLDMODDIR} git clone --depth 1 https://gitlab.com/VanessaE/basic_materials.git ${WORLDMODDIR}/basic_materials git clone --depth 1 https://gitlab.com/VanessaE/pipeworks.git ${WORLDMODDIR}/pipeworks +git clone --depth 1 https://github.com/minetest-mods/moreores.git ${WORLDMODDIR}/moreores chmod 777 ${MTDIR} -R docker run --rm -i \ diff --git a/technic/machines/other/constructor.lua b/technic/machines/other/constructor.lua index 630a6ce5..17531258 100644 --- a/technic/machines/other/constructor.lua +++ b/technic/machines/other/constructor.lua @@ -182,7 +182,11 @@ local function make_constructor(mark, length) allow_metadata_inventory_put = allow_inventory_put, allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_move = technic.machine_inventory_move, - on_rotate = screwdriver.rotate_simple + on_rotate = function(pos, node, user, mode, new_param2) + if mode ~= 1 then + return false + end + end, }) minetest.register_node("technic:constructor_mk"..mark.."_on", { diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index e3e6dbe8..fae00d4a 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -373,7 +373,11 @@ function technic.register_battery_box(data) technic_run = run, on_timer = on_timer, on_rightclick = function(pos) update_node(pos, true) end, - on_rotate = screwdriver.rotate_simple, + on_rotate = function(pos, node, user, mode, new_param2) + if mode ~= 1 then + return false + end + end, after_place_node = data.tube and pipeworks.after_place, after_dig_node = technic.machine_after_dig_node, on_receive_fields = function(pos, formname, fields, player) diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index f01630f5..8c979dde 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -304,9 +304,9 @@ function technic.register_cable(tier, size, description, prefix, override_cable, end def.on_rotate = function(pos, node, user, mode, new_param2) local dir = 0 - if mode == screwdriver.ROTATE_FACE then -- left-click + if mode == 1 then -- left-click dir = 1 - elseif mode == screwdriver.ROTATE_AXIS then -- right-click + elseif mode == 2 then -- right-click dir = -1 end local num = tonumber(node.name:sub(-1)) diff --git a/technic/mod.conf b/technic/mod.conf index 337fac24..0552771c 100644 --- a/technic/mod.conf +++ b/technic/mod.conf @@ -1,3 +1,3 @@ name = technic -depends = default, pipeworks, technic_worldgen, basic_materials -optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, monitoring, craftguide,i3 +depends = default, pipeworks, technic_worldgen, basic_materials, moreores +optional_depends = bucket, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, monitoring, craftguide, i3 From f18b9f10762aca1606ce56874decec8391ff98f8 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Mon, 1 Nov 2021 18:11:34 +1100 Subject: [PATCH 3/4] Split CNC materials into separate files --- technic_cnc/init.lua | 2 +- technic_cnc/materials.lua | 415 --------------------- technic_cnc/materials/bakedclay.lua | 23 ++ technic_cnc/materials/basic_materials.lua | 23 ++ technic_cnc/materials/default.lua | 256 +++++++++++++ technic_cnc/materials/ethereal.lua | 65 ++++ technic_cnc/materials/init.lua | 18 + technic_cnc/materials/moreblocks.lua | 50 +++ technic_cnc/materials/technic_worldgen.lua | 44 +++ 9 files changed, 480 insertions(+), 416 deletions(-) delete mode 100644 technic_cnc/materials.lua create mode 100644 technic_cnc/materials/bakedclay.lua create mode 100644 technic_cnc/materials/basic_materials.lua create mode 100644 technic_cnc/materials/default.lua create mode 100644 technic_cnc/materials/ethereal.lua create mode 100644 technic_cnc/materials/init.lua create mode 100644 technic_cnc/materials/moreblocks.lua create mode 100644 technic_cnc/materials/technic_worldgen.lua diff --git a/technic_cnc/init.lua b/technic_cnc/init.lua index 87320bf8..83e4df0b 100644 --- a/technic_cnc/init.lua +++ b/technic_cnc/init.lua @@ -35,5 +35,5 @@ if use_pipeworks then technic_cnc.pipeworks = dofile(technic_cnc.modpath.."/pipe technic_cnc.formspec = dofile(technic_cnc.modpath .. "/formspec.lua") dofile(technic_cnc.modpath .. "/programs.lua") dofile(technic_cnc.modpath .. "/api.lua") -dofile(technic_cnc.modpath .. "/materials.lua") +dofile(technic_cnc.modpath .. "/materials/init.lua") dofile(technic_cnc.modpath .. "/cnc.lua") diff --git a/technic_cnc/materials.lua b/technic_cnc/materials.lua deleted file mode 100644 index 7ee0d2a0..00000000 --- a/technic_cnc/materials.lua +++ /dev/null @@ -1,415 +0,0 @@ --- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS: ------------------------------------------------------------ - -local S = technic_cnc.getter - --- DIRT -------- -technic_cnc.register_all("default:dirt", - {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, - {"default_dirt.png"}, - S("Dirt")) --- (DIRT WITH) GRASS --------------------- -technic_cnc.register_all("default:dirt_with_grass", - {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, - {"default_grass.png"}, - S("Grassy dirt")) --- WOOD -------- -technic_cnc.register_all("default:wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_wood.png"}, - S("Wooden")) - -technic_cnc.register_all("default:junglewood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_junglewood.png"}, - S("Junglewood")) - -technic_cnc.register_all("default:pine_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_pine_wood.png"}, - S("Pine")) - -technic_cnc.register_all("default:acacia_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_acacia_wood.png"}, - S("Acacia")) - -technic_cnc.register_all("default:aspen_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_aspen_wood.png"}, - S("Aspen")) - --- STONE --------- -technic_cnc.register_all("default:stone", - {cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_stone.png"}, - S("Stone")) - -technic_cnc.register_all("default:stonebrick", - {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_stone_brick.png"}, - S("Stone Brick")) - -technic_cnc.register_all("default:stone_block", - {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_stone_block.png"}, - S("Stone Block")) - - -technic_cnc.register_all("default:desert_stone", - {cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_desert_stone.png"}, - S("Desert Stone")) - -technic_cnc.register_all("default:desert_stonebrick", - {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_desert_stone_brick.png"}, - S("Desert Stone Brick")) - -technic_cnc.register_all("default:desert_stone_block", - {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_desert_stone_block.png"}, - S("Desert Stone Block")) - --- COBBLE ---------- -technic_cnc.register_all("default:cobble", - {cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_cobble.png"}, - S("Cobble")) - -technic_cnc.register_all("default:mossycobble", - {cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_mossycobble.png"}, - S("Mossy Cobblestone")) - -technic_cnc.register_all("default:desert_cobble", - {cracky=3, stone=1, not_in_creative_inventory=1}, - {"default_desert_cobble.png"}, - S("Desert Cobble")) - --- BRICK --------- -technic_cnc.register_all("default:brick", - {cracky=3, not_in_creative_inventory=1}, - {"default_brick.png"}, - S("Brick")) - --- SANDSTONE ------------- -technic_cnc.register_all("default:sandstone", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_sandstone.png"}, - S("Sandstone")) - -technic_cnc.register_all("default:sandstonebrick", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_sandstone_brick.png"}, - S("Sandstone Brick")) - -technic_cnc.register_all("default:sandstone_block", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_sandstone_block.png"}, - S("Sandstone Block")) - - -technic_cnc.register_all("default:desert_sandstone", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_desert_sandstone.png"}, - S("Desert Sandstone")) - -technic_cnc.register_all("default:desert_sandstone_brick", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_desert_sandstone_brick.png"}, - S("Desert Sandstone Brick")) - -technic_cnc.register_all("default:desert_sandstone_block", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_desert_sandstone_block.png"}, - S("Desert Sandstone Block")) - - -technic_cnc.register_all("default:silver_sandstone", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_silver_sandstone.png"}, - S("Silver Sandstone")) - -technic_cnc.register_all("default:silver_sandstone_brick", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_silver_sandstone_brick.png"}, - S("Silver Sandstone Brick")) - -technic_cnc.register_all("default:silver_sandstone_block", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_silver_sandstone_block.png"}, - S("Silver Sandstone Block")) - - - - --- LEAVES ---------- -technic_cnc.register_all("default:leaves", - {snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, - {"default_leaves.png"}, - S("Leaves")) - --- TREE -------- -technic_cnc.register_all("default:tree", - {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, - {"default_tree.png"}, - S("Tree")) - --- ICE -------- -technic_cnc.register_all("default:ice", - {cracky=3, puts_out_fire=1, cools_lava=1, not_in_creative_inventory=1}, - {"default_ice.png"}, - S("Ice")) - - --- OBSIDIAN ------------ -technic_cnc.register_all("default:obsidian_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_obsidian_block.png"}, - S("Obsidian")) - - --- WROUGHT IRON ---------------- -technic_cnc.register_all("default:steelblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_wrought_iron_block.png"}, - S("Wrought Iron")) - --- Bronze --------- -technic_cnc.register_all("default:bronzeblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_bronze_block.png"}, - S("Bronze")) - --- Zinc --------- -technic_cnc.register_all("technic:zinc_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_zinc_block.png"}, - S("Zinc")) - -local steeltex = "default_steel_block.png" -local steelname = "Steel" - --- Cast Iron ------------- -technic_cnc.register_all("technic:cast_iron_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_cast_iron_block.png"}, - S("Cast Iron")) - -if minetest.get_modpath("technic") then - steeltex = "technic_wrought_iron_block.png" - steelname = "Wrought Iron" - - -- Stainless Steel - -------- - technic_cnc.register_all("technic:stainless_steel_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_stainless_steel_block.png"}, - S("Stainless Steel")) - - -- Marble - ------------ - technic_cnc.register_all("technic:marble", - {cracky=3, not_in_creative_inventory=1}, - {"technic_marble.png"}, - S("Marble")) - - -- Granite - ------------ - technic_cnc.register_all("technic:granite", - {cracky=1, not_in_creative_inventory=1}, - {"technic_granite.png"}, - S("Granite")) - - -- Blast-resistant concrete - --------------------------- - - technic_cnc.register_all("technic:blast_resistant_concrete", - {cracky=2, level=2, not_in_creative_inventory=1}, - {"technic_blast_resistant_concrete_block.png"}, - S("Blast-resistant concrete")) -end - -technic_cnc.register_all("default:steelblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {steeltex}, - S(steelname)) - --- CONCRETE AND CEMENT ----------------------- - -technic_cnc.register_all("basic_materials:concrete_block", - {cracky=2, level=2, not_in_creative_inventory=1}, - {"basic_materials_concrete_block.png"}, - S("Concrete")) - -technic_cnc.register_all("basic_materials:cement_block", - {cracky=2, level=2, not_in_creative_inventory=1}, - {"basic_materials_cement_block.png"}, - S("Cement")) - -technic_cnc.register_all("basic_materials:brass_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"basic_materials_brass_block.png"}, - S("Brass block")) --- Brass --------- -technic_cnc.register_all("technic:brass_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"basic_materials_brass_block.png"}, - S("Brass")) - --- Copper ---------- -technic_cnc.register_all("default:copperblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_copper_block.png"}, - S("Copper")) - --- Tin ------- -technic_cnc.register_all("default:tinblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_tin_block.png"}, - S("Tin")) - --- Gold -------- -technic_cnc.register_all("default:goldblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_gold_block.png"}, - S("Gold")) - - - - -if minetest.get_modpath("ethereal") then - -- Glostone - ------------ - technic_cnc.register_all("ethereal:glostone", - {cracky=1, not_in_creative_inventory=1, light_source=13}, - {"ethereal_glostone.png"}, - S("Glo Stone")) - - -- Crystal block - ---------------- - technic_cnc.register_all("ethereal:crystal_block", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"ethereal_crystal_block.png"}, - S("Crystal")) - - -- Misc. Wood types - ------------------- - technic_cnc.register_all("ethereal:banana_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"ethereal_banana_wood.png"}, - S("Banana Wood")) - - technic_cnc.register_all("ethereal:birch_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"moretrees_birch_wood.png"}, - S("Birch Wood")) - - technic_cnc.register_all("ethereal:frost_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"ethereal_frost_wood.png"}, - S("Frost Wood")) - - technic_cnc.register_all("ethereal:palm_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"moretrees_palm_wood.png"}, - S("Palm Wood")) - - technic_cnc.register_all("ethereal:willow_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"ethereal_willow_wood.png"}, - S("Willow Wood")) - - technic_cnc.register_all("ethereal:yellow_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"ethereal_yellow_wood.png"}, - S("Healing Tree Wood")) - - technic_cnc.register_all("ethereal:redwood_wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"ethereal_redwood_wood.png"}, - S("Redwood")) -end - - -if minetest.get_modpath("moreblocks") then - -- Tiles - ------------ - technic_cnc.register_all("moreblocks:stone_tile", - {stone=1, cracky=3, not_in_creative_inventory=1}, - {"moreblocks_stone_tile.png"}, - S("Stone Tile")) - - technic_cnc.register_all("moreblocks:split_stone_tile", - {stone=1, cracky=3, not_in_creative_inventory=1}, - {"moreblocks_split_stone_tile.png"}, - S("Split Stone Tile")) - - technic_cnc.register_all("moreblocks:checker_stone_tile", - {stone=1, cracky=3, not_in_creative_inventory=1}, - {"moreblocks_checker_stone_tile.png"}, - S("Checker Stone Tile")) - - technic_cnc.register_all("moreblocks:cactus_checker", - {stone=1, cracky=3, not_in_creative_inventory=1}, - {"moreblocks_cactus_checker.png"}, - S("Cactus Checker")) - - -- Bricks - ------------ - technic_cnc.register_all("moreblocks:cactus_brick", - {cracky=3, not_in_creative_inventory=1}, - {"moreblocks_cactus_brick.png"}, - S("Cactus Brick")) - - technic_cnc.register_all("moreblocks:grey_bricks", - {cracky=3, not_in_creative_inventory=1}, - {"moreblocks_grey_bricks.png"}, - S("Grey Bricks")) - - -- Metals - ------------ - technic_cnc.register_all("moreblocks:copperpatina", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"moreblocks_copperpatina.png"}, - S("Copper Patina")) - - -- Clay - ------------ - technic_cnc.register_all("bakedclay:red", - {cracky=3, not_in_creative_inventory=1}, - {"baked_clay_red.png"}, - S("Red Clay")) - - technic_cnc.register_all("bakedclay:orange", - {cracky=3, not_in_creative_inventory=1}, - {"baked_clay_orange.png"}, - S("Orange Clay")) - - technic_cnc.register_all("bakedclay:grey", - {cracky=3, not_in_creative_inventory=1}, - {"baked_clay_grey.png"}, - S("Grey Clay")) - -end diff --git a/technic_cnc/materials/bakedclay.lua b/technic_cnc/materials/bakedclay.lua new file mode 100644 index 00000000..a1016b57 --- /dev/null +++ b/technic_cnc/materials/bakedclay.lua @@ -0,0 +1,23 @@ + +local S = technic_cnc.getter + +technic_cnc.register_all( + "bakedclay:red", + {cracky = 3, not_in_creative_inventory = 1}, + {"baked_clay_red.png"}, + S("Red Clay") +) + +technic_cnc.register_all( + "bakedclay:orange", + {cracky = 3, not_in_creative_inventory = 1}, + {"baked_clay_orange.png"}, + S("Orange Clay") +) + +technic_cnc.register_all( + "bakedclay:grey", + {cracky = 3, not_in_creative_inventory = 1}, + {"baked_clay_grey.png"}, + S("Grey Clay") +) diff --git a/technic_cnc/materials/basic_materials.lua b/technic_cnc/materials/basic_materials.lua new file mode 100644 index 00000000..af945d3c --- /dev/null +++ b/technic_cnc/materials/basic_materials.lua @@ -0,0 +1,23 @@ + +local S = technic_cnc.getter + +technic_cnc.register_all( + "basic_materials:concrete_block", + {cracky = 2, level = 2, not_in_creative_inventory = 1}, + {"basic_materials_concrete_block.png"}, + S("Concrete") +) + +technic_cnc.register_all( + "basic_materials:cement_block", + {cracky = 2, level = 2, not_in_creative_inventory = 1}, + {"basic_materials_cement_block.png"}, + S("Cement") +) + +technic_cnc.register_all( + "basic_materials:brass_block", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"basic_materials_brass_block.png"}, + S("Brass block") +) diff --git a/technic_cnc/materials/default.lua b/technic_cnc/materials/default.lua new file mode 100644 index 00000000..b3b58b28 --- /dev/null +++ b/technic_cnc/materials/default.lua @@ -0,0 +1,256 @@ + +local S = technic_cnc.getter + +technic_cnc.register_all( + "default:dirt", + {snappy = 2,choppy = 2,oddly_breakable_by_hand = 3,not_in_creative_inventory = 1}, + {"default_dirt.png"}, + S("Dirt") +) + +technic_cnc.register_all( + "default:dirt_with_grass", + {snappy = 2,choppy = 2,oddly_breakable_by_hand = 3,not_in_creative_inventory = 1}, + {"default_grass.png"}, + S("Grassy dirt") +) + +technic_cnc.register_all( + "default:wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"default_wood.png"}, + S("Wooden") +) + +technic_cnc.register_all( + "default:junglewood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"default_junglewood.png"}, + S("Junglewood") +) + +technic_cnc.register_all( + "default:pine_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"default_pine_wood.png"}, + S("Pine") +) + +technic_cnc.register_all( + "default:acacia_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"default_acacia_wood.png"}, + S("Acacia") +) + +technic_cnc.register_all( + "default:aspen_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"default_aspen_wood.png"}, + S("Aspen") +) + +technic_cnc.register_all( + "default:stone", + {cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_stone.png"}, + S("Stone") +) + +technic_cnc.register_all( + "default:stonebrick", + {crumbly = 2, cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_stone_brick.png"}, + S("Stone Brick") +) + +technic_cnc.register_all( + "default:stone_block", + {crumbly = 2, cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_stone_block.png"}, + S("Stone Block") +) + +technic_cnc.register_all( + "default:desert_stone", + {cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_desert_stone.png"}, + S("Desert Stone") +) + +technic_cnc.register_all( + "default:desert_stonebrick", + {crumbly = 2, cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_desert_stone_brick.png"}, + S("Desert Stone Brick") +) + +technic_cnc.register_all( + "default:desert_stone_block", + {crumbly = 2, cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_desert_stone_block.png"}, + S("Desert Stone Block") +) + +technic_cnc.register_all( + "default:cobble", + {cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_cobble.png"}, + S("Cobble") +) + +technic_cnc.register_all( + "default:mossycobble", + {cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_mossycobble.png"}, + S("Mossy Cobblestone") +) + +technic_cnc.register_all( + "default:desert_cobble", + {cracky = 3, stone = 1, not_in_creative_inventory = 1}, + {"default_desert_cobble.png"}, + S("Desert Cobble") +) + +technic_cnc.register_all( + "default:brick", + {cracky = 3, not_in_creative_inventory = 1}, + {"default_brick.png"}, + S("Brick") +) + +technic_cnc.register_all( + "default:sandstone", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_sandstone.png"}, + S("Sandstone") +) + +technic_cnc.register_all( + "default:sandstonebrick", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_sandstone_brick.png"}, + S("Sandstone Brick") +) + +technic_cnc.register_all( + "default:sandstone_block", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_sandstone_block.png"}, + S("Sandstone Block") +) + +technic_cnc.register_all( + "default:desert_sandstone", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_desert_sandstone.png"}, + S("Desert Sandstone") +) + +technic_cnc.register_all( + "default:desert_sandstone_brick", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_desert_sandstone_brick.png"}, + S("Desert Sandstone Brick") +) + +technic_cnc.register_all( + "default:desert_sandstone_block", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_desert_sandstone_block.png"}, + S("Desert Sandstone Block") +) + +technic_cnc.register_all( + "default:silver_sandstone", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_silver_sandstone.png"}, + S("Silver Sandstone") +) + +technic_cnc.register_all( + "default:silver_sandstone_brick", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_silver_sandstone_brick.png"}, + S("Silver Sandstone Brick") +) + +technic_cnc.register_all( + "default:silver_sandstone_block", + {crumbly = 2, cracky = 3, not_in_creative_inventory = 1}, + {"default_silver_sandstone_block.png"}, + S("Silver Sandstone Block") +) + +technic_cnc.register_all( + "default:leaves", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1}, + {"default_leaves.png"}, + S("Leaves") +) + +technic_cnc.register_all( + "default:tree", + {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, not_in_creative_inventory = 1}, + {"default_tree.png"}, + S("Tree") +) + +technic_cnc.register_all( + "default:ice", + {cracky = 3, puts_out_fire = 1, cools_lava = 1, not_in_creative_inventory = 1}, + {"default_ice.png"}, + S("Ice") +) + +technic_cnc.register_all( + "default:obsidian_block", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"default_obsidian_block.png"}, + S("Obsidian") +) + +technic_cnc.register_all( + "default:bronzeblock", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"default_bronze_block.png"}, + S("Bronze") +) + +technic_cnc.register_all( + "default:copperblock", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"default_copper_block.png"}, + S("Copper") +) + +technic_cnc.register_all( + "default:tinblock", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"default_tin_block.png"}, + S("Tin") +) + +technic_cnc.register_all( + "default:goldblock", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"default_gold_block.png"}, + S("Gold") +) + +if minetest.get_modpath("technic_worldgen") then + technic_cnc.register_all( + "default:steelblock", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"technic_wrought_iron_block.png"}, + S("Wrought Iron") + ) +else + technic_cnc.register_all( + "default:steelblock", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"default_steel_block.png"}, + S("Steel") + ) +end diff --git a/technic_cnc/materials/ethereal.lua b/technic_cnc/materials/ethereal.lua new file mode 100644 index 00000000..fb8fc413 --- /dev/null +++ b/technic_cnc/materials/ethereal.lua @@ -0,0 +1,65 @@ + +local S = technic_cnc.getter + +technic_cnc.register_all( + "ethereal:glostone", + {cracky = 1, not_in_creative_inventory = 1, light_source = 13}, + {"ethereal_glostone.png"}, + S("Glo Stone") +) + +technic_cnc.register_all( + "ethereal:crystal_block", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"ethereal_crystal_block.png"}, + S("Crystal") +) + +technic_cnc.register_all( + "ethereal:banana_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"ethereal_banana_wood.png"}, + S("Banana Wood") +) + +technic_cnc.register_all( + "ethereal:birch_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"moretrees_birch_wood.png"}, + S("Birch Wood") +) + +technic_cnc.register_all( + "ethereal:frost_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"ethereal_frost_wood.png"}, + S("Frost Wood") +) + +technic_cnc.register_all( + "ethereal:palm_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"moretrees_palm_wood.png"}, + S("Palm Wood") +) + +technic_cnc.register_all( + "ethereal:willow_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"ethereal_willow_wood.png"}, + S("Willow Wood") +) + +technic_cnc.register_all( + "ethereal:yellow_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"ethereal_yellow_wood.png"}, + S("Healing Tree Wood") +) + +technic_cnc.register_all( + "ethereal:redwood_wood", + {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, + {"ethereal_redwood_wood.png"}, + S("Redwood") +) diff --git a/technic_cnc/materials/init.lua b/technic_cnc/materials/init.lua new file mode 100644 index 00000000..a2def07c --- /dev/null +++ b/technic_cnc/materials/init.lua @@ -0,0 +1,18 @@ + +local path = technic_cnc.modpath .. "/materials/" + +dofile(path .. "default.lua") +dofile(path .. "basic_materials.lua") + +local optional_mods = { + "bakedclay", + "ethereal", + "moreblocks", + "technic_worldgen", +} + +for _, mod in pairs(optional_mods) do + if minetest.get_modpath(mod) then + dofile(path .. mod .. ".lua") + end +end diff --git a/technic_cnc/materials/moreblocks.lua b/technic_cnc/materials/moreblocks.lua new file mode 100644 index 00000000..093e6b07 --- /dev/null +++ b/technic_cnc/materials/moreblocks.lua @@ -0,0 +1,50 @@ + +local S = technic_cnc.getter + +technic_cnc.register_all( + "moreblocks:stone_tile", + {stone = 1, cracky = 3, not_in_creative_inventory = 1}, + {"moreblocks_stone_tile.png"}, + S("Stone Tile")) + +technic_cnc.register_all( + "moreblocks:split_stone_tile", + {stone = 1, cracky = 3, not_in_creative_inventory = 1}, + {"moreblocks_split_stone_tile.png"}, + S("Split Stone Tile") +) + +technic_cnc.register_all( + "moreblocks:checker_stone_tile", + {stone = 1, cracky = 3, not_in_creative_inventory = 1}, + {"moreblocks_checker_stone_tile.png"}, + S("Checker Stone Tile") +) + +technic_cnc.register_all( + "moreblocks:cactus_checker", + {stone = 1, cracky = 3, not_in_creative_inventory = 1}, + {"moreblocks_cactus_checker.png"}, + S("Cactus Checker") +) + +technic_cnc.register_all( + "moreblocks:cactus_brick", + {cracky = 3, not_in_creative_inventory = 1}, + {"moreblocks_cactus_brick.png"}, + S("Cactus Brick") +) + +technic_cnc.register_all( + "moreblocks:grey_bricks", + {cracky = 3, not_in_creative_inventory = 1}, + {"moreblocks_grey_bricks.png"}, + S("Grey Bricks") +) + +technic_cnc.register_all( + "moreblocks:copperpatina", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"moreblocks_copperpatina.png"}, + S("Copper Patina") +) diff --git a/technic_cnc/materials/technic_worldgen.lua b/technic_cnc/materials/technic_worldgen.lua new file mode 100644 index 00000000..0d6f7ae9 --- /dev/null +++ b/technic_cnc/materials/technic_worldgen.lua @@ -0,0 +1,44 @@ + +local S = technic_cnc.getter + +technic_cnc.register_all( + "technic:zinc_block", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"technic_zinc_block.png"}, + S("Zinc") +) + +technic_cnc.register_all( + "technic:cast_iron_block", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"technic_cast_iron_block.png"}, + S("Cast Iron") +) + +technic_cnc.register_all( + "technic:stainless_steel_block", + {cracky = 1, level = 2, not_in_creative_inventory = 1}, + {"technic_stainless_steel_block.png"}, + S("Stainless Steel") +) + +technic_cnc.register_all( + "technic:marble", + {cracky = 3, not_in_creative_inventory = 1}, + {"technic_marble.png"}, + S("Marble") +) + +technic_cnc.register_all( + "technic:granite", + {cracky = 1, not_in_creative_inventory = 1}, + {"technic_granite.png"}, + S("Granite") +) + +technic_cnc.register_all( + "technic:blast_resistant_concrete", + {cracky = 2, level = 2, not_in_creative_inventory = 1}, + {"technic_blast_resistant_concrete_block.png"}, + S("Blast-resistant concrete") +) From 9ceb4e64581a60b6c092f9e988292b665d719236 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Mon, 1 Nov 2021 18:14:41 +1100 Subject: [PATCH 4/4] Improve steel to iron overrides reduces optional dependencies and extends to support as many items as possible --- technic_worldgen/crafts.lua | 119 +++++++++++---------------------- technic_worldgen/init.lua | 10 ++- technic_worldgen/mod.conf | 2 +- technic_worldgen/nodes.lua | 119 +++++++-------------------------- technic_worldgen/overrides.lua | 83 +++++++++++++++++++++++ 5 files changed, 157 insertions(+), 176 deletions(-) create mode 100644 technic_worldgen/overrides.lua diff --git a/technic_worldgen/crafts.lua b/technic_worldgen/crafts.lua index 71294cfb..2a677d92 100644 --- a/technic_worldgen/crafts.lua +++ b/technic_worldgen/crafts.lua @@ -5,12 +5,11 @@ minetest.register_craftitem(":technic:uranium_lump", { description = S("Uranium Lump"), inventory_image = "technic_uranium_lump.png", }) -minetest.register_alias("technic:uranium", "technic:uranium_lump") minetest.register_craftitem(":technic:uranium_ingot", { description = S("Uranium Ingot"), inventory_image = "technic_uranium_ingot.png", - groups = {uranium_ingot=1}, + groups = {uranium_ingot = 1}, }) minetest.register_craftitem(":technic:chromium_lump", { @@ -48,14 +47,6 @@ minetest.register_craftitem(":technic:sulfur_lump", { inventory_image = "technic_sulfur_lump.png", }) -minetest.register_alias("technic:wrought_iron_ingot", "default:steel_ingot") - -minetest.override_item("default:steel_ingot", { - description = S("Wrought Iron Ingot"), - -- make the color of the ingot a bit darker to separate it better from tin - inventory_image = "technic_wrought_iron_ingot.png^[multiply:#bbbbbbff", -}) - minetest.register_craftitem(":technic:cast_iron_ingot", { description = S("Cast Iron Ingot"), inventory_image = "technic_cast_iron_ingot.png", @@ -71,7 +62,21 @@ minetest.register_craftitem(":technic:stainless_steel_ingot", { inventory_image = "technic_stainless_steel_ingot.png", }) -local function register_block(block, ingot) +local blocks = { + "uranium", + "chromium", + "zinc", + "lead", + "cast_iron", + "carbon_steel", + "stainless_steel", + "sulfur", +} + +for _, name in pairs(blocks) do + local block = "technic:"..name.."_block" + local ingot = "technic:"..name.."_ingot" + minetest.register_craft({ output = block, recipe = { @@ -83,112 +88,66 @@ local function register_block(block, ingot) minetest.register_craft({ output = ingot.." 9", - recipe = { - {block} - } + recipe = {{block}} }) end -register_block("technic:uranium_block", "technic:uranium_ingot") -register_block("technic:chromium_block", "technic:chromium_ingot") -register_block("technic:zinc_block", "technic:zinc_ingot") -register_block("technic:lead_block", "technic:lead_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") -register_block("technic:sulfur_block", "technic:sulfur_lump") - minetest.register_craft({ - type = 'cooking', + type = "cooking", recipe = "technic:zinc_lump", output = "technic:zinc_ingot", }) minetest.register_craft({ - type = 'cooking', + type = "cooking", recipe = "technic:chromium_lump", output = "technic:chromium_ingot", }) minetest.register_craft({ - type = 'cooking', + type = "cooking", recipe = "technic:uranium_lump", output = "technic:uranium_ingot", }) minetest.register_craft({ - type = 'cooking', + type = "cooking", recipe = "technic:lead_lump", output = "technic:lead_ingot", }) - minetest.register_craft({ - type = 'cooking', - recipe = minetest.registered_aliases["technic:wrought_iron_ingot"], + type = "cooking", + recipe = "default:steel_ingot", output = "technic:cast_iron_ingot", }) minetest.register_craft({ - type = 'cooking', + type = "cooking", recipe = "technic:cast_iron_ingot", cooktime = 2, output = "technic:wrought_iron_ingot", }) minetest.register_craft({ - type = 'cooking', + type = "cooking", recipe = "technic:carbon_steel_ingot", cooktime = 2, output = "technic:wrought_iron_ingot", }) -local function for_each_registered_item(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 - local really_register_tool = minetest.register_tool - minetest.register_tool = function(name, def) - really_register_tool(name, def) - action(string.gsub(name, "^:", "")) - 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 - -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", - "glooptest:hammer_steel", - "glooptest:handsaw_steel", - "glooptest:reinforced_crystal_glass", - "mesecons_doors:op_door_steel", - "mesecons_doors:sig_door_steel", - "vessels:steel_bottle", -}) do - steel_to_iron[i] = true -end +minetest.register_craft({ + output = "technic:marble_bricks 4", + recipe = { + {"technic:marble","technic:marble"}, + {"technic:marble","technic:marble"} + } +}) -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) +minetest.register_craft({ + output = "technic:granite_bricks 4", + recipe = { + {"technic:granite","technic:granite"}, + {"technic:granite","technic:granite"} + } +}) diff --git a/technic_worldgen/init.lua b/technic_worldgen/init.lua index 2f369200..0f262963 100644 --- a/technic_worldgen/init.lua +++ b/technic_worldgen/init.lua @@ -1,3 +1,4 @@ + local modpath = minetest.get_modpath("technic_worldgen") technic = rawget(_G, "technic") or {} @@ -9,12 +10,13 @@ dofile(modpath.."/config.lua") dofile(modpath.."/nodes.lua") dofile(modpath.."/oregen.lua") dofile(modpath.."/crafts.lua") +dofile(modpath.."/overrides.lua") -- Rubber trees, moretrees also supplies these if not minetest.get_modpath("moretrees") then dofile(modpath.."/rubber.lua") else - -- older versions of technic provided rubber trees regardless + -- Older versions of technic provided rubber trees regardless minetest.register_alias("technic:rubber_sapling", "moretrees:rubber_tree_sapling") minetest.register_alias("technic:rubber_tree_empty", "moretrees:rubber_tree_trunk_empty") end @@ -24,3 +26,9 @@ if minetest.get_modpath("mg") then dofile(modpath.."/mg.lua") end +minetest.register_alias("technic:wrought_iron_ingot", "default:steel_ingot") +minetest.register_alias("technic:uranium", "technic:uranium_lump") +minetest.register_alias("technic:wrought_iron_block", "default:steelblock") +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") diff --git a/technic_worldgen/mod.conf b/technic_worldgen/mod.conf index 4cd10336..0c980ec3 100644 --- a/technic_worldgen/mod.conf +++ b/technic_worldgen/mod.conf @@ -1,3 +1,3 @@ name = technic_worldgen depends = default -optional_depends = intllib, mg, doors, farming, glooptest, mesecons_doors, vessels +optional_depends = intllib, mg diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index 2d9de46f..493c1356 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -1,54 +1,54 @@ local S = technic.worldgen.gettext -minetest.register_node( ":technic:mineral_uranium", { +minetest.register_node(":technic:mineral_uranium", { description = S("Uranium Ore"), - tiles = { "default_stone.png^technic_mineral_uranium.png" }, + tiles = {"default_stone.png^technic_mineral_uranium.png"}, is_ground_content = true, groups = {cracky=3, radioactive=1}, sounds = default.node_sound_stone_defaults(), drop = "technic:uranium_lump", }) -minetest.register_node( ":technic:mineral_chromium", { +minetest.register_node(":technic:mineral_chromium", { description = S("Chromium Ore"), - tiles = { "default_stone.png^technic_mineral_chromium.png" }, + tiles = {"default_stone.png^technic_mineral_chromium.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), drop = "technic:chromium_lump", }) -minetest.register_node( ":technic:mineral_zinc", { +minetest.register_node(":technic:mineral_zinc", { description = S("Zinc Ore"), - tiles = { "default_stone.png^technic_mineral_zinc.png" }, + tiles = {"default_stone.png^technic_mineral_zinc.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), drop = "technic:zinc_lump", }) -minetest.register_node( ":technic:mineral_lead", { +minetest.register_node(":technic:mineral_lead", { description = S("Lead Ore"), - tiles = { "default_stone.png^technic_mineral_lead.png" }, + tiles = {"default_stone.png^technic_mineral_lead.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), drop = "technic:lead_lump", }) -minetest.register_node( ":technic:mineral_sulfur", { +minetest.register_node(":technic:mineral_sulfur", { description = S("Sulfur Ore"), - tiles = { "default_stone.png^technic_mineral_sulfur.png" }, + tiles = {"default_stone.png^technic_mineral_sulfur.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), drop = "technic:sulfur_lump", }) -minetest.register_node( ":technic:granite", { +minetest.register_node(":technic:granite", { description = S("Granite"), - tiles = { "technic_granite.png" }, + tiles = {"technic_granite.png"}, is_ground_content = true, groups = {cracky=1}, sounds = default.node_sound_stone_defaults(), @@ -56,23 +56,23 @@ minetest.register_node( ":technic:granite", { minetest.register_node(":technic:granite_bricks", { description = S("Granite Bricks"), - tiles = { "technic_granite_bricks.png" }, + tiles = {"technic_granite_bricks.png"}, is_ground_content = true, groups = {cracky=1}, sounds = default.node_sound_stone_defaults(), }) -minetest.register_node( ":technic:marble", { +minetest.register_node(":technic:marble", { description = S("Marble"), - tiles = { "technic_marble.png" }, + tiles = {"technic_marble.png"}, is_ground_content = true, groups = {cracky=3, marble=1}, sounds = default.node_sound_stone_defaults(), }) -minetest.register_node( ":technic:marble_bricks", { +minetest.register_node(":technic:marble_bricks", { description = S("Marble Bricks"), - tiles = { "technic_marble_bricks.png" }, + tiles = {"technic_marble_bricks.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), @@ -80,7 +80,7 @@ minetest.register_node( ":technic:marble_bricks", { minetest.register_node(":technic:uranium_block", { description = S("Uranium Block"), - tiles = { "technic_uranium_block.png" }, + tiles = {"technic_uranium_block.png"}, is_ground_content = true, groups = {uranium_block=1, cracky=1, level=2, radioactive=2}, sounds = default.node_sound_stone_defaults() @@ -88,7 +88,7 @@ minetest.register_node(":technic:uranium_block", { minetest.register_node(":technic:chromium_block", { description = S("Chromium Block"), - tiles = { "technic_chromium_block.png" }, + tiles = {"technic_chromium_block.png"}, is_ground_content = true, groups = {cracky=1, level=2}, sounds = default.node_sound_stone_defaults() @@ -96,7 +96,7 @@ minetest.register_node(":technic:chromium_block", { minetest.register_node(":technic:zinc_block", { description = S("Zinc Block"), - tiles = { "technic_zinc_block.png" }, + tiles = {"technic_zinc_block.png"}, is_ground_content = true, groups = {cracky=1, level=2}, sounds = default.node_sound_stone_defaults() @@ -104,22 +104,15 @@ minetest.register_node(":technic:zinc_block", { minetest.register_node(":technic:lead_block", { description = S("Lead Block"), - tiles = { "technic_lead_block.png" }, + tiles = {"technic_lead_block.png"}, is_ground_content = true, groups = {cracky=1, level=2}, 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" }, + tiles = {"technic_cast_iron_block.png"}, is_ground_content = true, groups = {cracky=1, level=2}, sounds = default.node_sound_stone_defaults() @@ -127,7 +120,7 @@ minetest.register_node(":technic:cast_iron_block", { minetest.register_node(":technic:carbon_steel_block", { description = S("Carbon Steel Block"), - tiles = { "technic_carbon_steel_block.png" }, + tiles = {"technic_carbon_steel_block.png"}, is_ground_content = true, groups = {cracky=1, level=2}, sounds = default.node_sound_stone_defaults() @@ -135,7 +128,7 @@ minetest.register_node(":technic:carbon_steel_block", { minetest.register_node(":technic:stainless_steel_block", { description = S("Stainless Steel Block"), - tiles = { "technic_stainless_steel_block.png" }, + tiles = {"technic_stainless_steel_block.png"}, is_ground_content = true, groups = {cracky=1, level=2}, sounds = default.node_sound_stone_defaults() @@ -143,70 +136,8 @@ minetest.register_node(":technic:stainless_steel_block", { minetest.register_node(":technic:sulfur_block", { description = S("Sulfur Block"), - tiles = { "technic_sulfur_block.png" }, + tiles = {"technic_sulfur_block.png"}, is_ground_content = true, groups = {cracky = 3}, sounds = default.node_sound_stone_defaults() }) - -minetest.register_craft({ - output = 'technic:marble_bricks 4', - recipe = { - {'technic:marble','technic:marble'}, - {'technic:marble','technic:marble'} - } -}) - -minetest.register_craft({ - output = 'technic:granite_bricks 4', - recipe = { - {'technic:granite','technic:granite'}, - {'technic:granite','technic:granite'} - } -}) - -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 really_register_node = minetest.register_node - minetest.register_node = function(name, def) - really_register_node(name, def) - action(name:gsub("^:", ""), def) - end - for name, def in pairs(minetest.registered_nodes) do - action(name, def) - end -end - -for_each_registered_node(function(node_name, node_def) - if node_name ~= "default:steelblock" and - node_name:find("steelblock", 1, true) and - node_def.description:find("Steel", 1, true) then - minetest.override_item(node_name, { - description = node_def.description:gsub("Steel", S("Wrought Iron")), - }) - end - local tiles = node_def.tiles or node_def.tile_images - 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) - diff --git a/technic_worldgen/overrides.lua b/technic_worldgen/overrides.lua new file mode 100644 index 00000000..4d380083 --- /dev/null +++ b/technic_worldgen/overrides.lua @@ -0,0 +1,83 @@ + +local S = technic.worldgen.gettext + +minetest.override_item("default:steel_ingot", { + description = S("Wrought Iron Ingot"), + -- Make the color of the ingot a bit darker to separate it better from tin + inventory_image = "technic_wrought_iron_ingot.png^[multiply:#bbbbbbff", +}) + +-- Override description and textures of "steel" items + +local excluded_words = { + "[Cc]arbon", + "[Ss]tainless", + "[Ff]lint", +} + +local function is_steel(name, desc) + name = name:gsub(".+:(.+)", "%1") -- Ignore mod name + if name:match("[Ss]teel") or desc:match("[Ss]teel") then + for _, word in pairs(excluded_words) do + if name:match(word) or desc:match(word) then + return false + end + end + return true + end +end + +local function edit_desc(desc, old, new) + desc = desc:gsub(old, S(new)) + desc = desc:gsub(old:lower(), S(new:lower())) + return desc +end + +local function replace_texture(tile) + local new_tile + if type(tile) == "string" then + new_tile = tile:gsub("default_steel_block.png", "technic_wrought_iron_block.png") + else + new_tile = {} + for k, v in pairs(tile) do + if k == "name" then + new_tile[k] = v:gsub("default_steel_block.png", "technic_wrought_iron_block.png") + else + new_tile[k] = v + end + end + end + return new_tile +end + +local function do_override(name, def) + local desc = def.description + if not is_steel(name, desc) then + return + end + local override = {} + if name:find("steelblock") then + override.description = edit_desc(desc, "Steel", "Wrought Iron") + else + override.description = edit_desc(desc, "Steel", "Iron") + end + if def.tiles then + override.tiles = {} + for _, tile in ipairs(def.tiles) do + table.insert(override.tiles, replace_texture(tile)) + end + end + if def.inventory_image then + override.inventory_image = replace_texture(def.inventory_image) + end + if def.wield_image then + override.wield_image = replace_texture(def.wield_image) + end + minetest.override_item(name, override) +end + +minetest.register_on_mods_loaded(function() + for name, def in pairs(minetest.registered_items) do + do_override(name, def) + end +end)