]> git.lizzy.rs Git - xdecor.git/blobdiff - nodes.lua
Add some helpers (just in case)
[xdecor.git] / nodes.lua
index f9afb97f817f3391350a57b9fe9819035869e30b..53537c4256036d0f7c76d0e8239c4668ea57de3c 100644 (file)
--- a/nodes.lua
+++ b/nodes.lua
@@ -106,6 +106,8 @@ xpanes.register_pane("chainlink", {
        }
 })
 
+-- The following nodedef is licensed under WTFPL for granting a possible re-use
+-- in Minetest Game (https://github.com/minetest/minetest_game). 
 xdecor.register("cobweb", {
        description = "Cobweb",
        drawtype = "plantlike",
@@ -170,6 +172,12 @@ xdecor.register("crate", {
        sounds = default.node_sound_wood_defaults()
 })
 
+xdecor.register("cushion_block", {
+       tiles = {"xdecor_cushion.png"},
+       groups = {snappy=3, flammable=3, fall_damage_add_percent=-75, not_in_creative_inventory=1},
+       drop = "xdecor:cushion 2"
+})
+
 local function door_access(door)
        return door:find("prison")
 end
@@ -281,13 +289,17 @@ xdecor.register("lantern", {
        }
 })
 
-xdecor.register("lightbox", {
-       description = "Light Box",
-       tiles = {"xdecor_lightbox.png"},
-       groups = {cracky=3, choppy=3, oddly_breakable_by_hand=2},
-       light_source = 13,
-       sounds = default.node_sound_glass_defaults()
-})
+for _, l in pairs({"iron", "wooden"}) do
+       xdecor.register(l.."_lightbox", {
+               description = l:gsub("^%l", string.upper).." Light Box",
+               tiles = {"xdecor_"..l.."_lightbox.png"},
+               groups = {cracky=3, choppy=3, oddly_breakable_by_hand=2},
+               light_source = 13,
+               sounds = default.node_sound_glass_defaults()
+       })
+end
+
+minetest.register_alias("xdecor:lightbox", "xdecor:wooden_lightbox")
 
 xdecor.register("packed_ice", {
        drawtype = "normal",
@@ -340,7 +352,9 @@ xdecor.register("painting_1", {
        },
        on_construct = function(pos)
                local node = minetest.get_node(pos)
-               minetest.set_node(pos, {name="xdecor:painting_"..math.random(1,4), param2=node.param2})
+               local random = math.random(4)
+               if random == 1 then return end
+               minetest.set_node(pos, {name="xdecor:painting_"..random, param2=node.param2})
        end
 })
 
@@ -412,13 +426,12 @@ xdecor.register("stonepath", {
        on_rotate = screwdriver.rotate_simple,
        sounds = default.node_sound_stone_defaults(),
        sunlight_propagates = true,
-       node_box = {
-               type = "fixed",
-               fixed = {{0, -0.5, 0, 0.375, -0.47, 0.375},
-                       {-0.4375, -0.5, -0.4375, -0.0625, -0.47, -0.0625},
-                       {-0.4375, -0.5, 0.125, -0.125, -0.47, 0.4375},
-                       {0.125, -0.5, -0.375, 0.375, -0.47, -0.125}}
-       },
+       node_box = xdecor.pixelbox(16, {
+               {8,  0,  8, 6, .5, 6},
+               {1,  0,  1, 6, .5, 6},
+               {1,  0, 10, 5, .5, 5},
+               {10, 0,  2, 4, .5, 4}
+       }),
        selection_box = xdecor.nodebox.slab_y(0.05)
 })
 
@@ -440,11 +453,9 @@ xdecor.register("table", {
        tiles = {"xdecor_wood.png"},
        groups = {choppy=3, oddly_breakable_by_hand=2, flammable=3},
        sounds = default.node_sound_wood_defaults(),
-       node_box = {
-               type = "fixed",
-               fixed = {{-0.5, 0.4, -0.5, 0.5, 0.5, 0.5},
-                       {-0.15, -0.5, -0.15, 0.15, 0.4, 0.15}}
-       }
+       node_box = xdecor.pixelbox(16, {
+               {0, 14, 0, 16, 2, 16}, {5.5, 0, 5.5, 5, 14, 6}
+       })
 })
 
 xdecor.register("tatami", {
@@ -452,9 +463,7 @@ xdecor.register("tatami", {
        tiles = {"xdecor_tatami.png"},
        wield_image = "xdecor_tatami.png",
        groups = {snappy=3, flammable=3},
-       node_box = {
-               type = "fixed", fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}
-       }
+       node_box = xdecor.nodebox.slab_y(0.0625)
 })
 
 xdecor.register("tv", {