From 132c7e80d4b44e5b4439ce746a70bd5c75da8a09 Mon Sep 17 00:00:00 2001 From: adrido Date: Sat, 14 Jan 2017 07:51:10 +0100 Subject: [PATCH] Add better xdecor support --- building.lua | 12 ++++++++++-- furniture.lua | 22 +++++++++++----------- nodes.lua | 12 ++++++------ stairs_functions.lua | 29 +++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 19 deletions(-) diff --git a/building.lua b/building.lua index a0adf90..804709f 100644 --- a/building.lua +++ b/building.lua @@ -16,6 +16,14 @@ function darkage.register_reinforce(name, craftItem, nodedef) assert(type(nodedef.tiles)=="table","ERRROR: nodedef.tiles have to be a table") assert(nodedef.tiles[1], "ERROR: "..dump(nodedef.tiles).." requires at least 1 entry") + + if nodedef.groups then + nodedef.groups["not_cuttable"] = 1; + else + nodedef.groups = {}; + nodedef.groups["not_cuttable"] = 1; + end + local modname = minetest.get_current_modname(); local tname = string.gsub(name:lower()," ", "_"); -- Technical name @@ -169,7 +177,7 @@ minetest.register_node("darkage:glass", { use_texture_alpha=true, paramtype = "light", sunlight_propagates = true, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, + groups = {cracky = 3, oddly_breakable_by_hand = 3, not_cuttable=1}, sounds = default.node_sound_glass_defaults(), }) @@ -181,7 +189,7 @@ minetest.register_node("darkage:glow_glass", { paramtype = "light", sunlight_propagates = true, light_source = default.LIGHT_MAX-1, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, + groups = {cracky = 3, oddly_breakable_by_hand = 3, not_cuttable=1}, sounds = default.node_sound_glass_defaults(), }) diff --git a/furniture.lua b/furniture.lua index f603334..02e4fe4 100644 --- a/furniture.lua +++ b/furniture.lua @@ -15,9 +15,11 @@ minetest.register_node("darkage:chain", { --wall_bottom = = --wall_side = = }, - groups = {snappy=1,cracky=2,oddly_breakable_by_hand=2}, + groups = {snappy=1, cracky=2, oddly_breakable_by_hand=2, not_cuttable=1}, legacy_wallmounted = true }) + + local box_formspec = [[ size[8,9] list[context;main;0,0.3;8,4;] @@ -27,12 +29,10 @@ local box_formspec = [[ listring[current_player;main] ]].. darkage.formbg - - minetest.register_node("darkage:box", { description = "Box", tiles = { "darkage_box_top.png","darkage_box_top.png","darkage_box.png"}, - groups = { snappy = 3 }, + groups = { snappy = 3, not_cuttable=1 }, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -77,7 +77,7 @@ minetest.register_node("darkage:wood_shelves", { tiles = { "darkage_shelves.png","darkage_shelves.png","darkage_shelves.png", "darkage_shelves.png","darkage_shelves.png","darkage_shelves_front.png"}, paramtype2 = "facedir", - groups = { snappy = 3 }, + groups = { snappy = 3, not_cuttable=1 }, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -123,7 +123,7 @@ minetest.register_node("darkage:iron_bars", { is_ground_content = false, paramtype = "light", sunlight_propagates = true, - groups = {cracky=3}, + groups = {cracky=3 , not_cuttable=1}, sounds = default.node_sound_stone_defaults() }) @@ -133,7 +133,7 @@ minetest.register_node("darkage:lamp", { paramtype = "light", sunlight_propagates = true, light_source = default.LIGHT_MAX-1, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,flammable=1}, + groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3, flammable=1 , not_cuttable=1}, sounds = default.node_sound_glass_defaults(), }) @@ -146,7 +146,7 @@ minetest.register_node("darkage:iron_grille", { is_ground_content = false, paramtype = "light", sunlight_propagates = true, - groups = {cracky=3}, + groups = {cracky=3 , not_cuttable=1}, sounds = default.node_sound_stone_defaults() }) @@ -159,7 +159,7 @@ minetest.register_node("darkage:wood_bars", { is_ground_content = false, paramtype = "light", sunlight_propagates = true, - groups = {snappy=1,choppy=2}, + groups = {snappy=1, choppy=2, not_cuttable=1}, sounds = default.node_sound_stone_defaults() }) @@ -172,7 +172,7 @@ minetest.register_node("darkage:wood_grille", { is_ground_content = false, paramtype = "light", sunlight_propagates = true, - groups = {snappy=1,choppy=2}, + groups = {snappy=1, choppy=2, not_cuttable=1}, sounds = default.node_sound_stone_defaults() }) @@ -185,7 +185,7 @@ minetest.register_node("darkage:wood_frame", { is_ground_content = false, paramtype = "light", sunlight_propagates = true, - groups = {snappy=1,choppy=2}, + groups = {snappy=1, choppy=2, not_cuttable=1}, sounds = default.node_sound_stone_defaults() }) diff --git a/nodes.lua b/nodes.lua index 7a862c2..ed79bbd 100644 --- a/nodes.lua +++ b/nodes.lua @@ -32,7 +32,7 @@ minetest.register_node("darkage:chalk", { tiles = {"darkage_chalk.png"}, is_ground_content = true, drop = 'darkage:chalk_powder 2', - groups = {crumbly=2,cracky=2}, + groups = {crumbly=2, cracky=2, not_cuttable=1}, sounds = default.node_sound_stone_defaults() }) @@ -44,7 +44,7 @@ minetest.register_node("darkage:cobble_with_plaster", { is_ground_content = false, paramtype2 = "facedir", drop = 'default:cobble', - groups = {cracky=3}, + groups = {cracky=3, not_cuttable=1}, sounds = default.node_sound_stone_defaults(), }) @@ -56,7 +56,7 @@ minetest.register_node("darkage:chalked_bricks_with_plaster", { is_ground_content = false, paramtype2 = "facedir", drop = 'default:cobble', - groups = {cracky=3}, + groups = {cracky=3, not_cuttable=1}, sounds = default.node_sound_stone_defaults(), }) @@ -75,7 +75,7 @@ minetest.register_node("darkage:desert_stone_with_iron", { description = "Desert Iron Ore", tiles = {"default_desert_stone.png^default_mineral_iron.png"}, is_ground_content = true, - groups = {cracky=3}, + groups = {cracky=3, not_cuttable=1}, drop = 'default:iron_lump', sounds = default.node_sound_stone_defaults(), }) @@ -84,7 +84,7 @@ minetest.register_node("darkage:darkdirt", { description = "Dark Dirt", tiles = {"darkage_darkdirt.png"}, is_ground_content = false, - groups = {crumbly=2}, + groups = {crumbly=2, not_cuttable=1}, sounds = default.node_sound_dirt_defaults(), }) @@ -387,4 +387,4 @@ minetest.register_craft({ {"darkage:chalk_powder", "darkage:chalk_powder", "darkage:chalk_powder"}, {"default:stone", "darkage:chalk_powder", "default:stone"}, } -}) \ No newline at end of file +}) diff --git a/stairs_functions.lua b/stairs_functions.lua index c832b70..9a321b3 100644 --- a/stairs_functions.lua +++ b/stairs_functions.lua @@ -37,3 +37,32 @@ else end end +--[[ +if minetest.get_modpath("xdecor") then + table.insert(workbench.custom_nodes_register, "darkage:straw_bale") -- Straw Bale seems to accidently filtered out +end +]] +-- Uncomment, to check if nodes get registered correctly +--[[ +if minetest.get_modpath("xdecor") then + darkage.isCuttable = {} + function darkage.register_stairs(nodeName) + + darkage.isCuttable[nodeName] = true; + + end + +end +]] +--place the folowing funktion inside xdecor, to check if everything works fine. +--[[ + then + if( node:split(":")[1] == "darkage" and not darkage.isCuttable[node]) then + minetest.log("error", "Error: "..node.. " should not be cuttable") + end + nodes[#nodes+1] = node + else + if( node:split(":")[1] == "darkage" and darkage.isCuttable[node]) then + minetest.log("error", "Error: "..node.. " should be cuttable") + end +]]