Add better xdecor support

This commit is contained in:
adrido 2017-01-14 07:51:10 +01:00
parent 842968d9eb
commit 132c7e80d4
4 changed files with 56 additions and 19 deletions

View File

@ -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(),
})

View File

@ -15,9 +15,11 @@ minetest.register_node("darkage:chain", {
--wall_bottom = = <default>
--wall_side = = <default>
},
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()
})

View File

@ -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"},
}
})
})

View File

@ -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
]]