]> git.lizzy.rs Git - xdecor.git/commitdiff
Add new nodes and functional working bench
authorkilbith <jeanpatrick.guerrero@gmail.com>
Thu, 11 Jun 2015 20:06:54 +0000 (22:06 +0200)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Fri, 12 Jun 2015 08:47:41 +0000 (10:47 +0200)
23 files changed:
README.md
crafts.lua
depends.txt
handlers/registration.lua
init.lua
itemframes.lua
nodes.lua
textures/xdecor_chandelier.png [new file with mode: 0644]
textures/xdecor_hammer.png [new file with mode: 0644]
textures/xdecor_lantern.png [new file with mode: 0644]
textures/xdecor_lantern_ceiling.png [new file with mode: 0644]
textures/xdecor_lantern_floor.png [new file with mode: 0644]
textures/xdecor_metal_cabinet_front.png [new file with mode: 0644]
textures/xdecor_metal_cabinet_sides.png [new file with mode: 0644]
textures/xdecor_saw.png [new file with mode: 0644]
textures/xdecor_stereo_back.png [new file with mode: 0644]
textures/xdecor_stereo_bottom.png [new file with mode: 0644]
textures/xdecor_stereo_front.png [new file with mode: 0644]
textures/xdecor_stereo_left.png [new file with mode: 0644]
textures/xdecor_stereo_top.png [new file with mode: 0644]
textures/xdecor_wood.png [deleted file]
textures/xdecor_wood_tile.png
workbench.lua [new file with mode: 0644]

index 6ae9e3fd7f11d2f5f2777fe90dfef26021eb50d1..803ecb82d9016bfaaee6c47d544c4f21357b8278 100644 (file)
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@
 ### Credits ###
 
 ##### Textures : Gambit, VanessaE, kilbith. #####
-##### Code : VanessaE, t4im, kilbith. #####
+##### Code : VanessaE, t4im, kilbith, Krock. #####
 
 ![Preview](http://i.imgur.com/teTQM6V.png)
+![Preview2](http://i.imgur.com/FZzmpep.png)
index 429397000a89569437e22d736742c38497d9538c..63bc901db8d77623f3f60fc06c977a542a9172f3 100644 (file)
@@ -1,9 +1,20 @@
-minetest.register_craft({ output = "xdecor:candle", recipe = {{"default:torch"}} })
-minetest.register_craft({ output = "xdecor:cabinet_half 2", recipe = {{"xdecor:cabinet"}} })
-minetest.register_craft({ output = "xdecor:cushion 2", recipe = {{"wool:red", "wool:red"}} })
-minetest.register_craft({ output = "xdecor:painting", recipe = {{"default:sign_wall", "dye:blue"}} })
-minetest.register_craft({ output = "xdecor:moonbrick", recipe = {{"default:brick", "default:stone"}} })
-minetest.register_craft({ output = "xdecor:flint_steel", recipe = {{"default:obsidian_shard", "default:steel_ingot"}} })
+minetest.register_craft({ output = "xdecor:candle",
+       recipe = {{"default:torch"}} })
+
+minetest.register_craft({ output = "xdecor:cabinet_half 2",
+       recipe = {{"xdecor:cabinet"}} })
+
+minetest.register_craft({ output = "xdecor:cushion 2",
+       recipe = {{"wool:red", "wool:red"}} })
+
+minetest.register_craft({ output = "xdecor:painting",
+       recipe = {{"default:sign_wall", "dye:blue"}} })
+
+minetest.register_craft({ output = "xdecor:moonbrick",
+       recipe = {{"default:brick", "default:stone"}} })
+
+minetest.register_craft({ output = "xdecor:flint_steel",
+       recipe = {{"default:obsidian_shard", "default:steel_ingot"}} })
 
 minetest.register_craft({ output = "xdecor:barrel", recipe = {
        {"group:wood", "group:wood", "group:wood"},
@@ -28,6 +39,10 @@ minetest.register_craft({ output = "xdecor:chair", recipe = {
        {"group:stick", "", ""},
        {"group:stick", "group:stick", "group:stick"},
        {"group:stick", "", "group:stick"} } })
+       
+       minetest.register_craft({ output = "xdecor:chandelier", recipe = {
+       {"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
+       {"default:torch", "default:torch", "default:torch"} } })
 
 minetest.register_craft({ output = "xdecor:coalstone_tile 8", recipe = {
        {"default:coalblock", "default:stone"},
@@ -46,6 +61,24 @@ minetest.register_craft({ output = "xdecor:frame", recipe = {
        {"group:stick", "group:stick", "group:stick"},
        {"group:stick", "default:paper", "group:stick"},
        {"group:stick", "group:stick", "group:stick"} } })
+       
+minetest.register_craft({ output = "xdecor:hammer", recipe = {
+       {"default:steel_ingot"},
+       {"group:stick"} } })
+       
+minetest.register_craftitem("xdecor:hammer", {
+       description = "Hammer",
+       inventory_image = "xdecor_hammer.png"})
+       
+minetest.register_craft({ output = "xdecor:lantern", recipe = {
+       {"default:iron_lump"},
+       {"default:torch"},
+       {"default:iron_lump"}} })
+       
+minetest.register_craft({ output = "xdecor:metal_cabinet", recipe = {
+       {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
+       {"", "", ""},
+       {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} } })
 
 minetest.register_craft({ output = "xdecor:multishelf", recipe = {
        {"group:wood", "group:wood", "group:wood"},
@@ -62,6 +95,11 @@ minetest.register_craft({ output = "xdecor:rope 2", recipe = {
        {"farming:string"},
        {"farming:string"} } })
        
+minetest.register_craft({ output = "xdecor:stereo", recipe = {
+       {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"},
+       {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"},
+       {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"} } })
+       
 minetest.register_craft({ output = "xdecor:stone_tile 2", recipe = {
        {"default:cobble", "default:cobble"},
        {"default:cobble", "default:cobble"} } })
index 4ad96d51599fb734101f6229f6c1a8a509bd6255..41bb35a6a1e85a3ae5b1e9858df5bbdb2847b15e 100644 (file)
@@ -1 +1,2 @@
 default
+moreblocks?
index cde23a4b013e80d185b5357a713bf773db53a02d..c51058f8219b553f5005ed500e5594c97d73cd7a 100644 (file)
@@ -5,7 +5,7 @@ local default_can_dig = function(pos,player)
        return meta:get_inventory():is_empty("main")
 end
 
-local fancy_gui = default.gui_bg..default.gui_bg_img..default.gui_slots
+fancy_gui = default.gui_bg..default.gui_bg_img..default.gui_slots
 local default_inventory_size = 32
 local default_inventory_formspecs = {
        ["8"]="size[8,6]"..fancy_gui..
index c1f6f725d74bd9caa3f4d842d40be085a2ddbfff..4c6eb5f5b6fca16ab14a9468f867bfc777d1f153 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -6,3 +6,4 @@ dofile(modpath.."/handlers/registration.lua")
 dofile(modpath.."/crafts.lua")
 dofile(modpath.."/itemframes.lua")
 dofile(modpath.."/nodes.lua")
+dofile(modpath.."/workbench.lua")
index 6b7b137615b0d8e85a99a19c232a20bafcbf2002..765c2d1552a3eb2d819a7683ae14b24aa981755b 100644 (file)
@@ -78,7 +78,9 @@ end
 xdecor.register("frame", {
        description = "Item frame", groups = {snappy=3}, on_rotate = screwdriver.disallow,
        node_box = { type = "fixed", fixed = {-0.5, -0.5, 7/16, 0.5, 0.5, 0.5} },
-       tiles = {"xdecor_frame.png"}, inventory_image = "xdecor_frame.png",
+       tiles = {"xdecor_wood_tile.png", "xdecor_wood_tile.png", "xdecor_wood_tile.png",
+               "xdecor_wood_tile.png", "xdecor_wood_tile.png", "xdecor_frame.png"}, 
+       inventory_image = "xdecor_frame.png",
        after_place_node = function(pos, placer, itemstack)
                local meta = minetest.get_meta(pos)
                meta:set_string("owner", placer:get_player_name())
index f60f5ae8163c0aedf34e9ee8469abcbcef187808..3e25b63ae61b8373a23177548c32137ce9e1ea7f 100644 (file)
--- a/nodes.lua
+++ b/nodes.lua
@@ -5,87 +5,104 @@ xdecor.register("barrel", {
 
 xdecor.register("cabinet", {
        description = "Cabinet", inventory = {size=24}, infotext = "Cabinet",
-       tiles = {"default_wood.png", "xdecor_cabinet_front.png"},
+       tiles = {"default_wood.png", "default_wood.png", 
+       "default_wood.png", "default_wood.png",
+       "default_wood.png","xdecor_cabinet_front.png"},
        groups = {snappy=3}, sounds = default.node_sound_wood_defaults() })
 
 xdecor.register("cabinet_half", {
        description = "Half Cabinet", inventory = {size=8}, infotext = "Half Cabinet",
-       tiles = {"default_wood.png", "xdecor_cabinet_half_front.png"},
+       tiles = {"default_wood.png", "default_wood.png",
+       "default_wood.png", "default_wood.png",
+       "default_wood.png", "xdecor_cabinet_half_front.png"},
        groups = {snappy=3}, sounds = default.node_sound_wood_defaults(),
        node_box = {type="fixed", fixed={{-0.5, 0, -0.5, 0.5, 0.5, 0.5}}} })
 
 xdecor.register("candle", {
-       description = "Candle", light_source = 12,
-       inventory_image = "xdecor_candle_inv.png", drawtype = "torchlike",
+       description = "Candle", light_source = 12, drawtype = "torchlike",
+       inventory_image = "xdecor_candle_inv.png", 
+       wield_image = "xdecor_candle_inv.png", 
        paramtype2 = "wallmounted", legacy_wallmounted = true,
        walkable = false, groups = {dig_immediate=3, attached_node=1},
-       tiles = { {name="xdecor_candle_floor.png", animation={type="vertical_frames", length=1.5}},
-               {name="xdecor_candle_wall.png", animation={type="vertical_frames", length=1.5}} },
+       tiles = { {name="xdecor_candle_floor.png",
+               animation={type="vertical_frames", length=1.5}},
+               {name="xdecor_candle_wall.png",
+               animation={type="vertical_frames", length=1.5}} },
        selection_box = {type="wallmounted",
                wall_bottom={-0.25, -0.5, -0.25, 0.25, 0.1, 0.25},
                wall_side={-0.5, -0.35, -0.15, -0.15, 0.4, 0.15}} })
 
 xdecor.register("cardboard_box", {
-       description = "Cardboard Box", groups = {snappy=3}, inventory = {size=8}, infotext = "Cardboard Box",
-       tiles = {"xdecor_cardbox_top.png", "xdecor_cardbox_top.png", "xdecor_cardbox_sides.png"},
-       node_box = {type="fixed", fixed={{-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125}}} })
+       description = "Cardboard Box", groups = {snappy=3}, 
+       inventory = {size=8}, infotext = "Cardboard Box",
+       tiles = {"xdecor_cardbox_top.png", "xdecor_cardbox_top.png", 
+               "xdecor_cardbox_sides.png"},
+       node_box = {type="fixed",
+               fixed={{-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125}}} })
 
 xdecor.register("cauldron", {
        description = "Cauldron", groups = {snappy=1},
        tiles = {{name="xdecor_cauldron_top_anim.png",
-               animation={type="vertical_frames", length=3.0}}, "xdecor_cauldron_sides.png"} })
+               animation={type="vertical_frames", length=3.0}},
+               "xdecor_cauldron_sides.png"} })
 
 xdecor.register("chair", {
-       description = "Chair", tiles = {"xdecor_wood.png"},
+       description = "Chair", tiles = {"xdecor_wood_tile.png"},
        sounds = default.node_sound_wood_defaults(), groups = {snappy=3},
        node_box = {type="fixed", fixed={
-               {-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125}, {0.1875, -0.5, 0.1875, 0.3125, 0.5, 0.3125},
-               {-0.1875, 0.025, 0.22, 0.1875, 0.45, 0.28}, {-0.3125, -0.5, -0.3125, -0.1875, -0.125, -0.1875},
-               {0.1875, -0.5, -0.3125, 0.3125, -0.125, -0.1875}, {-0.3125, -0.125, -0.3125, 0.3125, 0, 0.1875}}} })
+               {-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125},
+               {0.1875, -0.5, 0.1875, 0.3125, 0.5, 0.3125},
+               {-0.1875, 0.025, 0.22, 0.1875, 0.45, 0.28},
+               {-0.3125, -0.5, -0.3125, -0.1875, -0.125, -0.1875},
+               {0.1875, -0.5, -0.3125, 0.3125, -0.125, -0.1875},
+               {-0.3125, -0.125, -0.3125, 0.3125, 0, 0.1875}}} })
+
+xdecor.register("chandelier", {
+       description = "Chandelier", drawtype = "plantlike", walkable = false, 
+       inventory_image = "xdecor_chandelier.png", tiles = {"xdecor_chandelier.png"}, 
+       groups = {dig_immediate=3}, light_source = 15 })
 
 xdecor.register("coalstone_tile", {
        description = "Coalstone Tile", tiles = {"xdecor_coalstone_tile.png"},
        groups = {snappy=3}, sounds = default.node_sound_stone_defaults() })
 
-local curtaincolors = { {"red", "#ad2323e0:175"} } -- add more curtains simply here
-for c in ipairs(curtaincolors) do
-local color = curtaincolors[c][1]
-local hue = curtaincolors[c][2]
-
-xdecor.register("curtain_"..color, {
-       description = "Curtain ("..color..")", tiles = {"xdecor_curtain.png^[colorize:"..hue},
-       inventory_image = "xdecor_curtain_open.png^[colorize:"..hue,
+local curtaincolors = {"red"} -- add more curtains simply here
+for _, c in ipairs(curtaincolors) do
+xdecor.register("curtain_"..c, {
+       description = "Curtain ("..c..")", use_texture_alpha = true, walkable = false,
+       tiles = {"xdecor_curtain.png^[colorize:"..c..":130"},
+       inventory_image = "xdecor_curtain_open.png^[colorize:"..c..":130", 
+       wield_image = "xdecor_curtain.png^[colorize:"..c..":130",
        drawtype = "signlike", paramtype2 = "wallmounted",
-       use_texture_alpha = true, walkable = false,
        groups = {dig_immediate=3}, selection_box = {type="wallmounted"},
        on_rightclick = function(pos, node, clicker, itemstack)
                local fdir = node.param2
-               minetest.set_node(pos, {name = "xdecor:curtain_open_"..color, param2 = fdir})
+               minetest.set_node(pos, {name="xdecor:curtain_open_"..c, param2=fdir})
        end })
 
-xdecor.register("curtain_open_"..color, {
-       tiles = { "xdecor_curtain_open.png^[colorize:"..hue },
+xdecor.register("curtain_open_"..c, {
+       tiles = { "xdecor_curtain_open.png^[colorize:"..c..":130" },
        drawtype = "signlike", paramtype2 = "wallmounted",
        use_texture_alpha = true, walkable = false,
        groups = {dig_immediate=3, not_in_creative_inventory=1},
-       selection_box = {type="wallmounted"}, drop = "xdecor:curtain_"..color,
+       selection_box = {type="wallmounted"}, drop = "xdecor:curtain_"..c,
        on_rightclick = function(pos, node, clicker, itemstack)
                local fdir = node.param2
-               minetest.set_node(pos, { name = "xdecor:curtain_"..color, param2 = fdir })
+               minetest.set_node(pos, { name="xdecor:curtain_"..c, param2=fdir })
        end })
-       
+
 minetest.register_craft({
-       output = "xdecor:curtain_"..color.." 4",
-       recipe = {{"", "wool:"..color, ""},
-                       {"", "wool:"..color, ""},
-                       {"", "wool:"..color, ""}} })
+       output = "xdecor:curtain_"..c.." 4",
+       recipe = {{"", "wool:"..c, ""},
+               {"", "wool:"..c, ""},
+               {"", "wool:"..c, ""}} })
 end
 
 xdecor.register("cushion", {
        description = "Cushion", tiles = {"xdecor_cushion.png"},
        groups = {snappy=3}, on_place = minetest.rotate_node,
        node_box = {type="fixed", fixed={{-0.5, -0.5, -0.5, 0.5, 0, 0.5}}} })
-       
+
 xdecor.register("empty_shelf", {
        description = "Empty Shelf", inventory = {size=24}, infotext = "Empty Shelf",
        tiles = {"default_wood.png", "xdecor_empty_shelf.png"},
@@ -98,12 +115,14 @@ xdecor.register("fence_wrought_iron", {
 
 xdecor.register("fire", {
        description = "Fake Fire", light_source = 14, walkable = false,
-       tiles = {{name="xdecor_fire_anim.png", animation={type="vertical_frames", length=1.5}}},
+       tiles = {{name="xdecor_fire_anim.png", 
+               animation={type="vertical_frames", length=1.5}}},
        drawtype = "plantlike", damage_per_second = 2, drop = "",
        groups = {dig_immediate=3, not_in_creative_inventory=1} })
 
 minetest.register_tool("xdecor:flint_steel", {
-       description = "Flint & Steel", stack_max = 1, inventory_image = "xdecor_flint_steel.png",
+       description = "Flint & Steel", stack_max = 1, 
+       inventory_image = "xdecor_flint_steel.png",
        tool_capabilities = {groupcaps={flamable={uses=65, maxlevel=1}}},
        on_use = function(itemstack, user, pointed_thing)
                if pointed_thing.type == "node" and minetest.get_node(pointed_thing.above).name == "air" then
@@ -116,10 +135,23 @@ minetest.register_tool("xdecor:flint_steel", {
                return itemstack
        end })
 
+xdecor.register("lantern", {
+       description = "Lantern", light_source = 12, drawtype = "torchlike",
+       inventory_image = "xdecor_lantern_floor.png", 
+       wield_image = "xdecor_lantern_floor.png", 
+       paramtype2 = "wallmounted", legacy_wallmounted = true,
+       walkable = false, groups = {dig_immediate=3, attached_node=1},
+       tiles = {"xdecor_lantern_floor.png", "xdecor_lantern_ceiling.png", "xdecor_lantern.png"},
+       selection_box = {type="wallmounted",
+               wall_top = {-0.25, -0.4, -0.25, 0.25, 0.5, 0.25},
+               wall_bottom = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25},
+               wall_side = {-0.5, -0.5, -0.15, 0.5, 0.5, 0.15}} })
+
 flowerstype = {"dandelion_white", "dandelion_yellow", "geranium", "rose", "tulip", "viola"}
 for _, f in ipairs(flowerstype) do
 xdecor.register("potted_"..f, {
-       description = "Potted Flowers ("..f..")", walkable = false, groups = {dig_immediate=3},
+       description = "Potted Flowers ("..f..")", walkable = false, 
+       groups = {dig_immediate=3},
        tiles = {"xdecor_"..f.."_pot.png"}, inventory_image = "xdecor_"..f.."_pot.png",
        drawtype = "plantlike", sounds = default.node_sound_leaves_defaults() })
 
@@ -129,57 +161,72 @@ minetest.register_craft({
 end
 
 xdecor.register("painting", {
-       description = "Painting", drawtype = "signlike", tiles = {"xdecor_painting.png"},
+       description = "Painting", drawtype = "signlike",
+       tiles = {"xdecor_painting.png"}, inventory_image = "xdecor_painting.png",
        paramtype2 = "wallmounted", legacy_wallmounted = true, walkable = false,
-       inventory_image = "xdecor_painting.png", selection_box = {type = "wallmounted"},
-       groups = {dig_immediate=3, attached_node=1}, sounds = default.node_sound_wood_defaults() })
+       wield_image = "xdecor_painting.png", selection_box = {type = "wallmounted"},
+       groups = {dig_immediate=3, attached_node=1}, 
+       sounds = default.node_sound_wood_defaults() })
 
 xdecor.register("plant_pot", {
        description = "Plant Pot", groups = {snappy=3},
        tiles = {"xdecor_plant_pot_top.png", "xdecor_plant_pot_sides.png"} })
 
+xdecor.register("metal_cabinet", {
+       description = "Metal Cabinet", inventory = {size=24},
+       tiles = {"xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_sides.png",
+       "xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_sides.png",
+       "xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_front.png"},
+       groups = {snappy=2}, infotext = "Metal Cabinet" })
+
 xdecor.register("moonbrick", {
        description = "Moonbrick", tiles = {"xdecor_moonbrick.png"}, 
        groups = {snappy=3}, sounds = default.node_sound_stone_defaults() })
 
 xdecor.register("multishelf", {
-       description = "Multishelf", inventory = {size=24}, infotext = "Multishelf",
+       description = "Multi Shelf", inventory = {size=24}, infotext = "Multi Shelf",
        tiles = {"default_wood.png", "xdecor_multishelf.png"},
        groups = {snappy=3}, sounds = default.node_sound_wood_defaults() })
 
 local rope_sbox = {type="fixed", fixed={-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}}
 xdecor.register("rope", {
-       description = "Rope", walkable = false, climbable = true,
-       tiles = {"xdecor_rope.png"}, inventory_image = "xdecor_rope_inv.png",
-       drawtype = "plantlike", groups = {dig_immediate=3}, selection_box = rope_sbox })
-       
+       description = "Rope", walkable = false, climbable = true, 
+       groups = {dig_immediate=3}, selection_box = rope_sbox,
+       tiles = {"xdecor_rope.png"}, inventory_image = "xdecor_rope_inv.png", 
+       wield_image = "xdecor_rope_inv.png", drawtype = "plantlike" })
+
+xdecor.register("stereo", {
+       description = "Stereo", groups = {snappy=3},
+       tiles = {"xdecor_stereo_top.png", "xdecor_stereo_bottom.png",
+       "xdecor_stereo_left.png^[transformFX", "xdecor_stereo_left.png",
+       "xdecor_stereo_back.png", "xdecor_stereo_front.png"} })
+
 xdecor.register("stone_rune", {
        description = "Stone Rune", tiles = {"xdecor_stone_rune.png"},
        groups = {snappy=3}, sounds = default.node_sound_stone_defaults() })
-       
+
 xdecor.register("stone_tile", {
        description = "Stone Tile", tiles = {"xdecor_stone_tile.png"},
        groups = {snappy=3}, sounds = default.node_sound_stone_defaults() })
 
 xdecor.register("table", {
-       description = "Table", tiles = {"xdecor_wood.png"},
+       description = "Table", tiles = {"xdecor_wood_tile.png"},
        groups = {snappy=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}}} })
+               {-0.5, 0.4, -0.5, 0.5, 0.5, 0.5}, 
+               {-0.15, -0.5, -0.15, 0.15, 0.4, 0.15}}} })
 
 xdecor.register("tv", {
        description = "Television", light_source = 11, groups = {snappy=3},
-       tiles = {"xdecor_television_left.png^[transformR270", "xdecor_television_left.png^[transformR90",
-               "xdecor_television_left.png^[transformFX", "xdecor_television_left.png",
-               "xdecor_television_back.png", {name="xdecor_television_front_animated.png",
+       tiles = {
+               "xdecor_television_left.png^[transformR270",
+               "xdecor_television_left.png^[transformR90",
+               "xdecor_television_left.png^[transformFX",
+               "xdecor_television_left.png",
+               "xdecor_television_back.png",
+               {name="xdecor_television_front_animated.png",
                animation = {type="vertical_frames", length=80.0}}} })
 
 xdecor.register("wood_tile", {
        description = "Wood Tile", tiles = {"xdecor_wood_tile.png"},
-       groups = {snappy=3}, sounds = default.node_sound_wood_defaults() })
-
-xdecor.register("workbench", {
-       description = "Work Bench", inventory = {size=24}, infotext = "Work Bench",
-       sounds = default.node_sound_wood_defaults(), groups = {snappy=3}, 
-       tiles = {"xdecor_workbench_top.png", "xdecor_workbench_top.png", "xdecor_workbench_sides.png", "xdecor_workbench_sides.png",
-               "xdecor_workbench_front.png", "xdecor_workbench_front.png"} })
+       groups = {snappy=3, wood=1}, sounds = default.node_sound_wood_defaults() })
diff --git a/textures/xdecor_chandelier.png b/textures/xdecor_chandelier.png
new file mode 100644 (file)
index 0000000..b54d3fe
Binary files /dev/null and b/textures/xdecor_chandelier.png differ
diff --git a/textures/xdecor_hammer.png b/textures/xdecor_hammer.png
new file mode 100644 (file)
index 0000000..f80fcef
Binary files /dev/null and b/textures/xdecor_hammer.png differ
diff --git a/textures/xdecor_lantern.png b/textures/xdecor_lantern.png
new file mode 100644 (file)
index 0000000..b13bc66
Binary files /dev/null and b/textures/xdecor_lantern.png differ
diff --git a/textures/xdecor_lantern_ceiling.png b/textures/xdecor_lantern_ceiling.png
new file mode 100644 (file)
index 0000000..71310ec
Binary files /dev/null and b/textures/xdecor_lantern_ceiling.png differ
diff --git a/textures/xdecor_lantern_floor.png b/textures/xdecor_lantern_floor.png
new file mode 100644 (file)
index 0000000..d4c1ce7
Binary files /dev/null and b/textures/xdecor_lantern_floor.png differ
diff --git a/textures/xdecor_metal_cabinet_front.png b/textures/xdecor_metal_cabinet_front.png
new file mode 100644 (file)
index 0000000..ba0cd9f
Binary files /dev/null and b/textures/xdecor_metal_cabinet_front.png differ
diff --git a/textures/xdecor_metal_cabinet_sides.png b/textures/xdecor_metal_cabinet_sides.png
new file mode 100644 (file)
index 0000000..7609c3c
Binary files /dev/null and b/textures/xdecor_metal_cabinet_sides.png differ
diff --git a/textures/xdecor_saw.png b/textures/xdecor_saw.png
new file mode 100644 (file)
index 0000000..56de7a1
Binary files /dev/null and b/textures/xdecor_saw.png differ
diff --git a/textures/xdecor_stereo_back.png b/textures/xdecor_stereo_back.png
new file mode 100644 (file)
index 0000000..2d2715f
Binary files /dev/null and b/textures/xdecor_stereo_back.png differ
diff --git a/textures/xdecor_stereo_bottom.png b/textures/xdecor_stereo_bottom.png
new file mode 100644 (file)
index 0000000..6177ab3
Binary files /dev/null and b/textures/xdecor_stereo_bottom.png differ
diff --git a/textures/xdecor_stereo_front.png b/textures/xdecor_stereo_front.png
new file mode 100644 (file)
index 0000000..f923dcb
Binary files /dev/null and b/textures/xdecor_stereo_front.png differ
diff --git a/textures/xdecor_stereo_left.png b/textures/xdecor_stereo_left.png
new file mode 100644 (file)
index 0000000..129f473
Binary files /dev/null and b/textures/xdecor_stereo_left.png differ
diff --git a/textures/xdecor_stereo_top.png b/textures/xdecor_stereo_top.png
new file mode 100644 (file)
index 0000000..e2e58c8
Binary files /dev/null and b/textures/xdecor_stereo_top.png differ
diff --git a/textures/xdecor_wood.png b/textures/xdecor_wood.png
deleted file mode 100644 (file)
index 87eac16..0000000
Binary files a/textures/xdecor_wood.png and /dev/null differ
index b65f9d972e11062b1dd39d395af8e01dad27be31..87eac16a880ae7561124af4dfafdedd160e1e76e 100644 (file)
Binary files a/textures/xdecor_wood_tile.png and b/textures/xdecor_wood_tile.png differ
diff --git a/workbench.lua b/workbench.lua
new file mode 100644 (file)
index 0000000..c77ff79
--- /dev/null
@@ -0,0 +1,115 @@
+-- Repair Tool's code by Krock, modified by kilbith
+
+xdecor.register("workbench", {
+       description = "Work Bench", infotext = "Work Bench",
+       sounds = default.node_sound_wood_defaults(), groups = {snappy=3}, 
+       tiles = {"xdecor_workbench_top.png", "xdecor_workbench_top.png", 
+               "xdecor_workbench_sides.png", "xdecor_workbench_sides.png",
+               "xdecor_workbench_front.png", "xdecor_workbench_front.png"},
+       on_construct = function(pos)
+               local meta = minetest.get_meta(pos)
+               meta:set_string("formspec", "size[8,7;]"..fancy_gui..
+                       "label[0,0;Cut your wood into...]"..
+                       "label[0,1.5;Input]"..
+                       "list[current_name;input;0,2;1,1;]"..
+                       "image[1,2;1,1;xdecor_saw.png]"..
+                       "label[2,1.5;Output]"..
+                       "list[current_name;output;2,2;1,1;]"..
+                       "label[5.5,0;Damaged tool]"..
+                       "list[current_name;src;6,0.5;1,1;]"..
+                       "image[4.35,1.1;1.5,1.5;xdecor_hammer.png]"..
+                       "label[5.8,1.5;Hammer]]"..
+                       "list[current_name;fuel;6,2;1,1;]"..
+                       "item_image_button[0,0.5;1,1;xdecor:microslab_wood;microslab; ]"..
+                       "item_image_button[1,0.5;1,1;xdecor:microslab_half_wood;microslabhalf; ]"..
+                       "item_image_button[2,0.5;1,1;xdecor:microcube_wood;microcube; ]"..
+                       "item_image_button[3,0.5;1,1;xdecor:panel_wood;panel; ]"..
+                       "list[current_player;main;0,3.25;8,4;]")
+               meta:set_string("infotext", "Work Bench")
+               local inv = meta:get_inventory()
+               inv:set_size("output", 1)
+               inv:set_size("input", 1)
+               inv:set_size("src", 1)
+               inv:set_size("fuel", 1)
+       end,
+       on_receive_fields = function(pos, formname, fields, sender)
+               local meta = minetest.get_meta(pos)
+               local inv = meta:get_inventory()
+               local shape = {}
+               local anz = 0
+
+               if fields["microslab"] then
+                       anz = "8"
+                       shape = "xdecor:microslab_wood"
+               elseif fields["microslabhalf"] then
+                       anz = "16"
+                       shape = "xdecor:microslab_half_wood"
+               elseif fields["microcube"] then
+                       anz = "8"
+                       shape = "xdecor:microcube_wood"
+               elseif fields["panel"] then
+                       anz = "4"
+                       shape = "xdecor:panel_wood"
+               else return end
+
+               local inputstack = inv:get_stack("input", 1)
+               if minetest.get_item_group(inputstack:get_name(), "wood") ~= 0 then
+                       local give = {}
+                       for i = 0, anz-1 do
+                               give[i+1] = inv:add_item("output", shape)
+                       end
+                       inputstack:take_item()
+                       inv:set_stack("input", 1, inputstack)
+               else return end
+       end,
+       can_dig = function(pos, player)
+               local meta = minetest.get_meta(pos)
+               local inv = meta:get_inventory()
+               return inv:is_empty("src") and inv:is_empty("fuel") 
+                       and inv:is_empty("input") and inv:is_empty("output")
+       end
+})
+
+local function register_wood_cut(name, desc, box, f_groups)
+       f_groups = {}
+       f_groups.snappy = 3
+       f_groups.not_in_creative_inventory = 1
+       xdecor.register(name.."_wood", {
+               description = "Wood "..desc,
+               tiles = {"xdecor_wood_tile.png"}, groups = f_groups,
+               sounds = default.node_sound_wood_defaults(),
+               node_box = { type = "fixed", fixed = box } }) end
+
+wood = {}
+wood.datas = {
+       {"microslab", "Microslab", { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }},
+       {"microslab_half", "Half Microslab", { -0.5, -0.5, -0.5, 0.5, -0.4375, 0 }},
+       {"microcube", "Microcube", { -0.5, -0.5, -0.5, 0, 0, 0 }},
+       {"panel", "Panel", { -0.5, -0.5, -0.5, 0.5, 0, 0 }},
+}
+
+for _, item in pairs(wood.datas) do
+       register_wood_cut(unpack(item))
+end
+
+minetest.register_abm({
+       nodenames = {"xdecor:workbench"},
+       interval = 5, chance = 1,
+       action = function(pos, node, active_object_count, active_object_count_wider)
+               local meta = minetest.get_meta(pos)
+               local inv = meta:get_inventory()
+               local src = inv:get_stack("src", 1)
+               local wear = src:get_wear()
+               local repair = -1400
+
+               if (src:is_empty() or wear == 0 or wear == 65535) then return end
+               local fuel = inv:get_stack("fuel", 1)
+               if (fuel:is_empty() or fuel:get_name() ~= "xdecor:hammer") then return end
+
+               if (wear + repair < 0) then src:add_wear(repair + wear)
+               else src:add_wear(repair) end
+
+               inv:set_stack("src", 1, src)
+               inv:remove_item("fuel", "xdecor:hammer 1")
+       end
+})