From 72609865e7e0def066c960e451dda8d809fd3c6f Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 18 May 2021 21:41:55 +0200 Subject: [PATCH] Add moreblocks/stairsplus support --- init.lua | 6 +-- items/basalt.lua | 77 -------------------------------------- items/moreblocks.lua | 89 ++++++++++++++++++++++++++++++++++++++++++++ items/redstone.lua | 34 ----------------- mod.conf | 2 +- recipe_checker.lua | 6 ++- 6 files changed, 96 insertions(+), 118 deletions(-) create mode 100644 items/moreblocks.lua diff --git a/init.lua b/init.lua index 9b5ffeb..8cd95f7 100644 --- a/init.lua +++ b/init.lua @@ -335,10 +335,8 @@ dofile(MP.."/items/redstone.lua") dofile(MP.."/items/cement.lua") dofile(MP.."/items/cracking.lua") dofile(MP.."/items/ceramic.lua") - -if techage.basalt_stone_enabled then - dofile(MP.."/items/basalt.lua") -end +dofile(MP.."/items/basalt.lua") +dofile(MP.."/items/moreblocks.lua") -- Carts dofile(MP.."/carts/tank_cart.lua") diff --git a/items/basalt.lua b/items/basalt.lua index e65d9a7..61ef2b4 100644 --- a/items/basalt.lua +++ b/items/basalt.lua @@ -33,17 +33,6 @@ minetest.register_node("techage:basalt_stone", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "basalt_stone", - "techage:basalt_stone", - {cracky = 3, stone = 1}, - {"default_stone.png^[brighten"}, - "Basalt Stone Stair", - "Basalt Stone Slab", - default.node_sound_stone_defaults(), - false -) - minetest.register_node("techage:basalt_cobble", { description = S("Basalt Cobble"), tiles = {"default_cobble.png^[brighten"}, @@ -51,17 +40,6 @@ minetest.register_node("techage:basalt_cobble", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "basalt_cobble", - "techage:basalt_cobble", - {cracky = 3, stone = 2}, - {"default_cobble.png^[brighten"}, - "Basalt Cobble Stair", - "Basalt Cobble Slab", - default.node_sound_stone_defaults(), - false -) - minetest.register_node("techage:basalt_stone_brick", { description = S("Basalt Stone Brick"), paramtype2 = "facedir", @@ -72,17 +50,6 @@ minetest.register_node("techage:basalt_stone_brick", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "basalt_stone_brick", - "techage:basalt_stone_brick", - {cracky = 2, stone = 1}, - {"default_stone_brick.png^[brighten"}, - "Basalt Brick Stair", - "Basalt Brick Slab", - default.node_sound_stone_defaults(), - false -) - minetest.register_node("techage:basalt_stone_block", { description = S("Basalt Stone Block"), tiles = {"default_stone_block.png^[brighten"}, @@ -91,17 +58,6 @@ minetest.register_node("techage:basalt_stone_block", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "basalt_stone_block", - "techage:basalt_stone_block", - {cracky = 2, stone = 1}, - {"default_stone_block.png^[brighten"}, - "Basalt Stone Block Stair", - "Basalt Stone Block Slab", - default.node_sound_stone_defaults(), - false -) - minetest.register_node("techage:basalt_gravel", { description = S("Basalt Gravel"), tiles = {"default_gravel.png^[brighten"}, @@ -109,17 +65,6 @@ minetest.register_node("techage:basalt_gravel", { sounds = default.node_sound_gravel_defaults(), }) -stairs.register_stair_and_slab( - "sieved_basalt_gravel", - "techage:sieved_basalt_gravel", - {crumbly = 2, falling_node = 1}, - {"default_gravel.png^[brighten"}, - "Basalt Gravel Stair", - "Basalt Gravel Slab", - default.node_sound_gravel_defaults(), - false -) - minetest.register_node("techage:sieved_basalt_gravel", { description = S("Sieved Basalt Gravel"), tiles = {"default_gravel.png^[brighten"}, @@ -140,17 +85,6 @@ minetest.register_node("techage:basalt_glass", { sounds = default.node_sound_glass_defaults(), }) -stairs.register_stair_and_slab( - "basalt_glass", - "techage:basalt_glass", - {cracky = 3, oddly_breakable_by_hand = 3}, - {"techage_basalt_glass.png"}, - "Basalt Glass Stair", - "Basalt Glass Slab", - default.node_sound_glass_defaults(), - false -) - minetest.register_node("techage:basalt_glass2", { description = S("Basalt Glass 2"), drawtype = "glasslike_framed_optional", @@ -164,17 +98,6 @@ minetest.register_node("techage:basalt_glass2", { sounds = default.node_sound_glass_defaults(), }) -stairs.register_stair_and_slab( - "basalt_glass2", - "techage:basalt_glass2", - {cracky = 3, oddly_breakable_by_hand = 3}, - {"techage_basalt_glass2.png"}, - "Basalt Glass 2 Stair", - "Basalt Glass 2 Slab", - default.node_sound_glass_defaults(), - false -) - minetest.register_node("techage:basalt_glass_thin", { description = S("Basalt Glass Thin"), drawtype = "nodebox", diff --git a/items/moreblocks.lua b/items/moreblocks.lua new file mode 100644 index 0000000..5056ace --- /dev/null +++ b/items/moreblocks.lua @@ -0,0 +1,89 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2020-2021 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + techage node registrations + +]]-- + +local function register_alias(name) + minetest.register_alias("stairs:slab_" ..name, "techage:slab_" ..name) + minetest.register_alias("stairs:slab_" ..name.. "_inverted", "techage:slab_" ..name.. "_inverted") + minetest.register_alias("stairs:slab_" ..name.. "_wall", "techage:slab_" ..name.. "_wall") + minetest.register_alias("stairs:slab_" ..name.. "_quarter", "techage:slab_" ..name.. "_quarter") + minetest.register_alias("stairs:slab_" ..name.. "_quarter_inverted", "techage:slab_" ..name.. "_quarter_inverted") + minetest.register_alias("stairs:slab_" ..name.. "_quarter_wall", "techage:slab_" ..name.. "_quarter_wall") + minetest.register_alias("stairs:slab_" ..name.. "_three_quarter", "techage:slab_" ..name.. "_three_quarter") + minetest.register_alias("stairs:slab_" ..name.. "_three_quarter_inverted", "techage:slab_" ..name.. "_three_quarter_inverted") + minetest.register_alias("stairs:slab_" ..name.. "_three_quarter_wall", "techage:slab_" ..name.. "_three_quarter_wall") + minetest.register_alias("stairs:stair_" ..name, "techage:stair_" ..name) + minetest.register_alias("stairs:stair_" ..name.. "_inverted", "techage:stair_" ..name.. "_inverted") + minetest.register_alias("stairs:stair_" ..name.. "_wall", "techage:stair_" ..name.. "_wall") + minetest.register_alias("stairs:stair_" ..name.. "_wall_half", "techage:stair_" ..name.. "_wall_half") + minetest.register_alias("stairs:stair_" ..name.. "_wall_half_inverted", "techage:stair_" ..name.. "_wall_half_inverted") + minetest.register_alias("stairs:stair_" ..name.. "_half", "techage:stair_" ..name.. "_half") + minetest.register_alias("stairs:stair_" ..name.. "_half_inverted", "techage:stair_" ..name.. "_half_inverted") + minetest.register_alias("stairs:stair_" ..name.. "_right_half", "techage:stair_" ..name.. "_right_half") + minetest.register_alias("stairs:stair_" ..name.. "_right_half_inverted", "techage:stair_" ..name.. "_right_half_inverted") + minetest.register_alias("stairs:stair_" ..name.. "_wall_half", "techage:stair_" ..name.. "_wall_half") + minetest.register_alias("stairs:stair_" ..name.. "_wall_half_inverted", "techage:stair_" ..name.. "_wall_half_inverted") + minetest.register_alias("stairs:stair_" ..name.. "_inner", "techage:stair_" ..name.. "_inner") + minetest.register_alias("stairs:stair_" ..name.. "_inner_inverted", "techage:stair_" ..name.. "_inner_inverted") + minetest.register_alias("stairs:stair_" ..name.. "_outer", "techage:stair_" ..name.. "_outer") + minetest.register_alias("stairs:stair_" ..name.. "_outer_inverted", "techage:stair_" ..name.. "_outer_inverted") +end + +local NodeNames = { + "techage:red_stone", + "techage:red_stone_block", + "techage:red_stone_brick", + + "techage:basalt_cobble", + "techage:basalt_stone", + "techage:basalt_stone_block", + "techage:basalt_stone_brick", + "techage:sieved_basalt_gravel", + + "techage:basalt_glass", + "techage:basalt_glass2", + "techage:bauxite_stone", + "techage:bauxite_cobble", +} + +if(minetest.get_modpath("moreblocks")) then + for _,name in ipairs(NodeNames) do + local ndef = minetest.registered_nodes[name] + if ndef then + ndef = table.copy(ndef) + local subname = string.split(name, ":")[2] + ndef.sunlight_propagates = true + ndef.groups.not_in_creative_inventory = 1 + stairsplus:register_all("techage", subname, name, ndef) + register_alias(subname) + end + end +else + for _,name in ipairs(NodeNames) do + local ndef = minetest.registered_nodes[name] + if ndef then + local subname = string.split(name, ":")[2] + stairs.register_stair_and_slab( + subname, + name, + ndef.groups, + ndef.tiles, + ndef.description.." Stair", + ndef.description.." Slab", + ndef.sound, + false + ) + register_alias(subname) + end + end +end diff --git a/items/redstone.lua b/items/redstone.lua index edce07f..d1d2950 100644 --- a/items/redstone.lua +++ b/items/redstone.lua @@ -22,17 +22,6 @@ minetest.register_node("techage:red_stone", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "red_stone", - "techage:red_stone", - {cracky = 3, stone = 1}, - {"default_stone.png^[colorize:#ff4538:110"}, - "Red Stone Stair", - "Red Stone Slab", - default.node_sound_stone_defaults(), - false -) - minetest.register_node("techage:red_stone_brick", { description = S("Red Stone Brick"), paramtype2 = "facedir", @@ -43,17 +32,6 @@ minetest.register_node("techage:red_stone_brick", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "red_stone_brick", - "techage:red_stone_brick", - {cracky = 2, stone = 1}, - {"default_stone_brick.png^[colorize:#ff4538:110"}, - "Red Brick Stair", - "Red Brick Slab", - default.node_sound_stone_defaults(), - false -) - minetest.register_node("techage:red_stone_block", { description = S("Red Stone Block"), tiles = {"default_stone_block.png^[colorize:#ff4538:110"}, @@ -62,18 +40,6 @@ minetest.register_node("techage:red_stone_block", { sounds = default.node_sound_stone_defaults(), }) -stairs.register_stair_and_slab( - "red_stone_block", - "techage:red_stone_block", - {cracky = 2, stone = 1}, - {"default_stone_block.png^[colorize:#ff4538:110"}, - "Red Stone Block Stair", - "Red Stone Block Slab", - default.node_sound_stone_defaults(), - false -) - - minetest.register_craft({ output = "techage:red_stone_brick 4", recipe = { diff --git a/mod.conf b/mod.conf index ea1e24d..e0c393c 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = techage depends = default,doors,flowers,tubelib2,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua -optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay +optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay,moreblocks description = Techage, go through 4 tech ages in search of wealth and power! diff --git a/recipe_checker.lua b/recipe_checker.lua index f8ee53a..204b1fa 100644 --- a/recipe_checker.lua +++ b/recipe_checker.lua @@ -22,8 +22,10 @@ minetest.after(1, function() --print(dump(recipe.items)) local key = recipe_key(recipe.items) if Recipes[key] then - local text = Recipes[key].." and "..name.." have the same incredients" - minetest.log("error", text) + if not string.find(name, "slab") and not string.find(name, "stair") then + local text = Recipes[key].." and "..name.." have the same incredients" + minetest.log("error", text) + end end Recipes[key] = name end