From 669d495742d08847aca9d1b58a660ae65848ae1c Mon Sep 17 00:00:00 2001 From: kilbith Date: Thu, 11 Jun 2015 22:06:54 +0200 Subject: [PATCH] Add new nodes and functional working bench --- README.md | 3 +- crafts.lua | 50 +++++++- depends.txt | 1 + handlers/registration.lua | 2 +- init.lua | 1 + itemframes.lua | 4 +- nodes.lua | 163 +++++++++++++++--------- textures/xdecor_chandelier.png | Bin 0 -> 332 bytes textures/xdecor_hammer.png | Bin 0 -> 198 bytes textures/xdecor_lantern.png | Bin 0 -> 297 bytes textures/xdecor_lantern_ceiling.png | Bin 0 -> 246 bytes textures/xdecor_lantern_floor.png | Bin 0 -> 227 bytes textures/xdecor_metal_cabinet_front.png | Bin 0 -> 216 bytes textures/xdecor_metal_cabinet_sides.png | Bin 0 -> 128 bytes textures/xdecor_saw.png | Bin 0 -> 192 bytes textures/xdecor_stereo_back.png | Bin 0 -> 146 bytes textures/xdecor_stereo_bottom.png | Bin 0 -> 154 bytes textures/xdecor_stereo_front.png | Bin 0 -> 167 bytes textures/xdecor_stereo_left.png | Bin 0 -> 107 bytes textures/xdecor_stereo_top.png | Bin 0 -> 99 bytes textures/xdecor_wood.png | Bin 220 -> 0 bytes textures/xdecor_wood_tile.png | Bin 218 -> 220 bytes workbench.lua | 115 +++++++++++++++++ 23 files changed, 272 insertions(+), 67 deletions(-) create mode 100644 textures/xdecor_chandelier.png create mode 100644 textures/xdecor_hammer.png create mode 100644 textures/xdecor_lantern.png create mode 100644 textures/xdecor_lantern_ceiling.png create mode 100644 textures/xdecor_lantern_floor.png create mode 100644 textures/xdecor_metal_cabinet_front.png create mode 100644 textures/xdecor_metal_cabinet_sides.png create mode 100644 textures/xdecor_saw.png create mode 100644 textures/xdecor_stereo_back.png create mode 100644 textures/xdecor_stereo_bottom.png create mode 100644 textures/xdecor_stereo_front.png create mode 100644 textures/xdecor_stereo_left.png create mode 100644 textures/xdecor_stereo_top.png delete mode 100644 textures/xdecor_wood.png create mode 100644 workbench.lua diff --git a/README.md b/README.md index 6ae9e3f..803ecb8 100644 --- 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) diff --git a/crafts.lua b/crafts.lua index 4293970..63bc901 100644 --- a/crafts.lua +++ b/crafts.lua @@ -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"} } }) diff --git a/depends.txt b/depends.txt index 4ad96d5..41bb35a 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ default +moreblocks? diff --git a/handlers/registration.lua b/handlers/registration.lua index cde23a4..c51058f 100644 --- a/handlers/registration.lua +++ b/handlers/registration.lua @@ -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.. diff --git a/init.lua b/init.lua index c1f6f72..4c6eb5f 100644 --- 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") diff --git a/itemframes.lua b/itemframes.lua index 6b7b137..765c2d1 100644 --- a/itemframes.lua +++ b/itemframes.lua @@ -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()) diff --git a/nodes.lua b/nodes.lua index f60f5ae..3e25b63 100644 --- 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 index 0000000000000000000000000000000000000000..b54d3fe43adf6833a4c2abfa4a3d226952b2d538 GIT binary patch literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}et=JiE0DI)mpRqUIHknZ(L`}Z zxkq}C;k;mm|2G(xL^A&ef$8(>18S1&d~DVJ_cNGli65|C{|+`ICX5=^zGp9yqMliZ7(7@j~g7xwDT@jR0^FqX`TF*2m_bk z#HVdM9!c^0=LfMl=VY~PO6U+NVsn=1B-B>OGrrgsPgUTPFR#@SH9Gl9jJ$~B*-tA!Qt7BG$6;t z)5S4_<9f0KBUiwzlLDs#_$D=R%;=JcW7sSbJBL-FXsO<-gjuf_CmTd)yl+||*pW8- ptOAdj=3@qC>ktMe3qAv&+kTwp3TL-_TLCnW!PC{xWt~$(69D|oJXHVy literal 0 HcmV?d00001 diff --git a/textures/xdecor_lantern.png b/textures/xdecor_lantern.png new file mode 100644 index 0000000000000000000000000000000000000000..b13bc6603f876d45f52cc440185c9688c787c22b GIT binary patch literal 297 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv5AX?b1=6b0Vp>X4ijpE43X+#k zRbD(%E-4^z@<8#4eMKfZa)uhR{A`@|b-!|fN*POn{DK)Ap4~_Tagw~FdgVpN(5sSCwh=(<-1)wWo_?2*>s01O_HoM@2?~ zvnw<-lsJ+!3^@!t8dyX`Bv~Dlw0O9Dn0g!-Raw>89M#y|92FfI+1v!#92E`=u9(;u z?Hw7}7#J|2QM1x*Wh2961!nJGJ&T!`_#ED*J$uNLP;4@Fc4Hf(WZtQR0&J(1m?zje e?BPr?l@ZfY zl2ViqzI3ueLqXC&Lry|~-&99IMOyU4{^Aq+icTFUK6#*6kb`?;?kh*2PL`4&zhDMN zM#ek7yj4Jcwx^3@h{Wa4UQfOw1{^Hb#wHb~zx_YYret{{)goXStBl}6dv<;47QMyW z&RbZvD^9;TdtSVds+P}|0*}ab0V}s|KF_;i>uU)&pDXW*^TR%QZ4UGKcsS+Fsl`fx om!&$-Xjm&xY!j`w$b9ynIU<~?Gvch$381wMp00i_>zopr0B`qBQ~&?~ literal 0 HcmV?d00001 diff --git a/textures/xdecor_lantern_floor.png b/textures/xdecor_lantern_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..d4c1ce7b15f7432f3a9a5fe17965df7a3d090a7d GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!aez;VE09)|5i`_~)l!rMGBgz> z6(vP3pQ<>qzt}=w$xu^PLV#a_pYPPcl9LCDkMAquXX8A5S6CUSjin^WFPMRmk@1c% zZxxUq?djqeB5`?cPbA*~1rC>usR!1c{_7ttqWoVrdB&a(3f`OezfF4fKy4nJ za0`PlBg3pY5H=O_WNwyZ2Bs(`PaSzg)%)|977~7m!31^Yj)saIl%anH|C`9 zr>-qO{rHttQjg2J5kB~f#0Fty}RSq@7}#Dsp7=O$KD2VUm{Q3tN)|OA~s>c zjrwSN2U8#6!Ut!Y9pigG{C#p7PdRD%^dauIl$ks!z#q*vDtO!3S900VG!PC{x JWt~$(69CBLPALEY literal 0 HcmV?d00001 diff --git a/textures/xdecor_metal_cabinet_sides.png b/textures/xdecor_metal_cabinet_sides.png new file mode 100644 index 0000000000000000000000000000000000000000..7609c3caa87ca8afab4cdf5a14efae1bfb49b8dd GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx*Bp9q_EZ7UAI14-?iy0WWg+Z8+Vb&Z8pdfpR zr>`sfeKu}31@?*wyFGwH@}4e^ArhC9b5gTJ^+<6c)I$ztaD0e0stRl9ohf@ literal 0 HcmV?d00001 diff --git a/textures/xdecor_saw.png b/textures/xdecor_saw.png new file mode 100644 index 0000000000000000000000000000000000000000..56de7a1ab3cb53e4ffd55814396b9fbbacddbd1d GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPHF3h)VW1=2w9_2I6bNWEL#p8rqP z&6`;9aSY+O zo~*!Tz~#iyoU!8bs#%MaT-gGjJ$U75oTg#aVPJ9pnunKHia=^Xo|l)1NP<9O8C#G; j>><52rhvB&vpg6WHZya-eRAWD7|0=>u6{1-oD!MVGBEIeHtLpZJ{3$!q?F|rvXqzDukBqSsxF&Qxl2`I5~akbqLb(VAx qYHf7hDCE;SiRq3W>x?8tRR*5x?3`uZn@+I>`7{YNqS)hf9jgieDAw__L_2NPfHYcuw1_lN}X=!XmA|fI)X3TiN yvqNN+o^q;zbBAMNr=#Er0hUe;8W|#<6I(V(Q0&=A1G@WPt&0ZU4hCD2p`Pgg&e IbxsLQ0P&b9bpQYW literal 0 HcmV?d00001 diff --git a/textures/xdecor_stereo_left.png b/textures/xdecor_stereo_left.png new file mode 100644 index 0000000000000000000000000000000000000000..129f47373d4ffaba8f185af808df35c14abf16b0 GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|uExg3^78U}dV0U((xQQa zvYsxEAsp9}Iarz4`uW)0R1P&VdNimg=&(3OFfkls<>GyN*r^<-kipZ{&t;ucLK6Td C4Hn)2 literal 0 HcmV?d00001 diff --git a/textures/xdecor_stereo_top.png b/textures/xdecor_stereo_top.png new file mode 100644 index 0000000000000000000000000000000000000000..e2e58c88cdb795e9ab71fc7f6122588cd579a927 GIT binary patch literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9YhYlYfq}uvX8w0T5eZKh v#}JO|$v^(jU)VS?F;s(v@n(fUfFXnP37*!!5z>o+Y8X6S{an^LB{Ts5^C}r7 literal 0 HcmV?d00001 diff --git a/textures/xdecor_wood.png b/textures/xdecor_wood.png deleted file mode 100644 index 87eac16a880ae7561124af4dfafdedd160e1e76e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa4)6(aU6|pxs@QjWvQ4qSYGau3 z&c^V~mHyez3MKBEx~H6tfXZq-T^vI=u8a0;(Hu9b~oz{ z#)h*q=E(jicw4qJhVMJ;>vNLt4(*%W>mFadlrd>ezezJ+((M|-FOk*#KM$uf_bgI8 zA`-`BzUrD8lk${h68-NV{NhWrT=a--ciPLAsxMEO*R5X@>mQ(7=oNfHUhk^lFP=>@ RbAaw(@O1TaS?83{1OQh0QaJzs diff --git a/textures/xdecor_wood_tile.png b/textures/xdecor_wood_tile.png index b65f9d972e11062b1dd39d395af8e01dad27be31..87eac16a880ae7561124af4dfafdedd160e1e76e 100644 GIT binary patch delta 192 zcmV;x06+iQ0o(zQB!3%FOjJdoXhEuTO_yUlb5A9KRx`PQSF?FfYeOJ(M=34JLoxsW z0DMVAK~xCW6^yYCf-n>S4@%fmfnvL6~7XY(yZgcTR^^Fp^?Br*cZNdQy;EHO!-3 z9{>OVcS%G+R0!7{&AkZ&F${*`mlT(@5?qne25%s6YaiLbBX|K9A$5vOkcsc(Dv3uw zAO5!ymJGKN^T-MF(LP~LF2Q|vLjYSO1P_=8g5Rrc!382hRX6=)tasz9QK=#=>wLjY s=eAe69-_>ph>ZJQXHSk<8u83_0^X$+7)W?ba{vGU07*qoM6N<$f|R~aF8}}l diff --git a/workbench.lua b/workbench.lua new file mode 100644 index 0000000..c77ff79 --- /dev/null +++ b/workbench.lua @@ -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 +})