From c6a141d24a91456a5be1e5aaebbad36619dc20fe Mon Sep 17 00:00:00 2001 From: kilbith Date: Wed, 10 Jun 2015 10:54:20 +0200 Subject: [PATCH] style --- building.lua | 34 +++++---------- crafts.lua | 24 +++++------ furniture.lua | 90 ++++++++++++--------------------------- lighting.lua | 48 ++++++--------------- misc.lua | 116 +++++++++++++------------------------------------- storage.lua | 60 +++++++------------------- 6 files changed, 108 insertions(+), 264 deletions(-) diff --git a/building.lua b/building.lua index c99b698..846c400 100644 --- a/building.lua +++ b/building.lua @@ -1,37 +1,23 @@ xdecor.register("moonbrick", { - description = "Moonbrick", - tiles = {"xdecor_moonbrick.png"}, - groups = {snappy=3}, - sounds = default.node_sound_stone_defaults() + description = "Moonbrick", tiles = {"xdecor_moonbrick.png"}, + groups = {snappy=3}, sounds = default.node_sound_stone_defaults() }) xdecor.register("wood_tile", { - description = "Wood tile", - tiles = {"xdecor_wood_tile.png"}, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults() + description = "Wood tile", tiles = {"xdecor_wood_tile.png"}, + groups = {snappy=3}, sounds = default.node_sound_wood_defaults() }) xdecor.register("coalstone_tile", { - description = "Coalstone tile", - tiles = {"xdecor_coalstone_tile.png"}, - groups = {snappy=3}, - sounds = default.node_sound_stone_defaults() + description = "Coalstone tile", tiles = {"xdecor_coalstone_tile.png"}, + groups = {snappy=3}, sounds = default.node_sound_stone_defaults() }) -fence_material = {"brass", "wrought_iron"} - -for _, m in ipairs(fence_material) do +fencematerial = {"brass", "wrought_iron"} +for _, m in ipairs(fencematerial) do xdecor.register("fence_"..m, { - description = "Fence ("..m..")", - drawtype = "fencelike", - tiles = {"xdecor_"..m..".png"}, + description = "Fence ("..m..")", drawtype = "fencelike", tiles = {"xdecor_"..m..".png"}, inventory_image = "default_fence_overlay.png^xdecor_"..m..".png^default_fence_overlay.png^[makealpha:255,126,126", - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), + groups = {snappy=3}, sounds = default.node_sound_wood_defaults() }) end diff --git a/crafts.lua b/crafts.lua index 1ff3c09..5ffa217 100644 --- a/crafts.lua +++ b/crafts.lua @@ -35,7 +35,7 @@ minetest.register_craft({ minetest.register_craft({ type = "shapeless", output = "xdecor:candle 2", - recipe = {"default:torch"} + recipe = {"default:torch", "farming:string"} }) minetest.register_craft({ @@ -56,11 +56,11 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:chair", + output = "xdecor:chair 2", recipe = { - {"group:stick", "", ""}, - {"group:stick", "group:stick", "group:stick"}, - {"group:stick", "", "group:stick"} + {"group:wood", "", ""}, + {"group:wood", "group:wood", "group:wood"}, + {"group:wood", "", "group:wood"} } }) @@ -80,7 +80,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:fence_brass 2", + output = "xdecor:fence_brass 4", recipe = { {"xdecor:brass_ingot", "xdecor:brass_ingot", "xdecor:brass_ingot"}, {"xdecor:brass_ingot", "xdecor:brass_ingot", "xdecor:brass_ingot"} @@ -88,7 +88,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:fence_wrought_iron 2", + output = "xdecor:fence_wrought_iron 4", recipe = { {"default:iron_lump", "default:iron_lump", "default:iron_lump"}, {"default:iron_lump", "default:iron_lump", "default:iron_lump"} @@ -132,7 +132,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:plant_pot", + output = "xdecor:plant_pot 2", recipe = { {"default:clay_lump", "", "default:clay_lump"}, {"default:clay_lump", "default:dirt", "default:clay_lump"}, @@ -156,11 +156,11 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:table", + output = "xdecor:table 2", recipe = { - {"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood"}, - {"", "group:stick", ""}, - {"", "group:stick", ""} + {"group:wood", "group:wood", "group:wood"}, + {"", "group:wood", ""}, + {"", "group:wood", ""} } }) diff --git a/furniture.lua b/furniture.lua index 5dc3e2b..1f26f14 100644 --- a/furniture.lua +++ b/furniture.lua @@ -1,67 +1,44 @@ xdecor.register("chair", { - description = "Chair", - tiles = {"xdecor_wood.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} - } - } + description = "Chair", tiles = {"xdecor_wood.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}}} }) 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} } - } + 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}}} }) -local curtaincolors = { - { "red", "#ad2323e0:175" }, - { "white", "#ffffffe0:175" } -} - +local curtaincolors = { {"red", "#ad2323e0:175"}, {"white", "#ffffffe0:175"} } for c in ipairs(curtaincolors) do local color = curtaincolors[c][1] local hue = curtaincolors[c][2] - local color_d = curtaincolors[c][1] xdecor.register("curtain_"..color, { - description = "Curtain ("..color_d..")", - tiles = {"xdecor_curtain.png^[colorize:"..hue }, + description = "Curtain ("..color..")", tiles = {"xdecor_curtain.png^[colorize:"..hue}, inventory_image = "xdecor_curtain_open.png^[colorize:"..hue, - drawtype = "signlike", - use_texture_alpha = true, - walkable = false, - groups = {dig_immediate=3}, - paramtype2 = "wallmounted", - selection_box = {type = "wallmounted"}, + 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_"..color, param2 = fdir}) end }) xdecor.register("curtain_open_"..color, { tiles = { "xdecor_curtain_open.png^[colorize:"..hue }, - drawtype = "signlike", - use_texture_alpha = true, - walkable = false, + drawtype = "signlike", paramtype2 = "wallmounted", + use_texture_alpha = true, walkable = false, groups = {dig_immediate=3, not_in_creative_inventory=1}, - paramtype2 = "wallmounted", - selection_box = {type = "wallmounted"}, - drop = "xdecor:curtain_"..color, + selection_box = {type="wallmounted"}, drop = "xdecor:curtain_"..color, on_rightclick = function(pos, node, clicker, itemstack) local fdir = node.param2 minetest.set_node(pos, { name = "xdecor:curtain_"..color, param2 = fdir }) @@ -70,25 +47,14 @@ for c in ipairs(curtaincolors) do minetest.register_craft({ output = "xdecor:curtain_"..color.." 4", - recipe = { - {"", "wool:"..color, ""}, - {"", "wool:"..color, ""}, - {"", "wool:"..color, ""} - } - }) - + recipe = {{"", "wool:"..color, ""}, + {"", "wool:"..color, ""}, + {"", "wool:"..color, ""}} }) end xdecor.register("table", { - description = "Table", - tiles = {"xdecor_wood.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} - } - } + description = "Table", tiles = {"xdecor_wood.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}}} }) diff --git a/lighting.lua b/lighting.lua index 787845c..1771bac 100644 --- a/lighting.lua +++ b/lighting.lua @@ -1,44 +1,20 @@ xdecor.register("candle", { - description = "Candle", - walkable = false, + description = "Candle", light_source = 12, + inventory_image = "xdecor_candle_inv.png", drawtype = "torchlike", + paramtype2 = "wallmounted", legacy_wallmounted = true, + walkable = false, groups = {dig_immediate=3, attached_node=1}, tiles = { - { name = "xdecor_candle_floor.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 1.5 - } - }, - { name = "xdecor_candle_wall.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 1.5 - } - } + {name="xdecor_candle_floor.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}}, + {name="xdecor_candle_wall.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, 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} - }, - inventory_image = "xdecor_candle_inv.png", - drawtype = "torchlike", - paramtype2 = "wallmounted", - legacy_wallmounted = true, - light_source = 12, - groups = {dig_immediate=3, attached_node=1} + 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("fire", { - description = "Fake fire", - walkable = false, - tiles = { {name="xdecor_fire_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}} }, - drawtype = "plantlike", - light_source = 14, - damage_per_second = 2, - drop = "", + description = "Fake fire", light_source = 14, walkable = false, + tiles = {{name="xdecor_fire_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}}}, + drawtype = "plantlike", damage_per_second = 2, drop = "", groups = {dig_immediate=3, not_in_creative_inventory=1} }) diff --git a/misc.lua b/misc.lua index 90bbb3e..3860858 100644 --- a/misc.lua +++ b/misc.lua @@ -1,24 +1,12 @@ xdecor.register("cauldron", { - description = "Cauldron", - groups = {snappy=1}, - tiles = { - { - name="xdecor_cauldron_top_anim.png", - animation={type="vertical_frames", - aspect_w=16, aspect_h=16, length=3.0} - }, - "xdecor_cauldron_sides.png" - } + description = "Cauldron", groups = {snappy=1}, + tiles = {{name="xdecor_cauldron_top_anim.png", animation={type="vertical_frames", + aspect_w=16, aspect_h=16, length=3.0}}, "xdecor_cauldron_sides.png"} }) minetest.register_tool("xdecor:flint_steel", { - description = "Flint and steel", - inventory_image = "xdecor_flint_steel.png", - stack_max = 1, - tool_capabilities = { - full_punch_interval = 1.0, max_drop_level = 0, - groupcaps = {flamable = {uses=65, maxlevel=1}} - }, + description = "Flint and 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 if not minetest.is_protected(pointed_thing.above, user:get_player_name()) then @@ -33,94 +21,50 @@ minetest.register_tool("xdecor:flint_steel", { end }) -flowers_type = {"dandelion_white", "dandelion_yellow", "geranium", "rose", "tulip", "viola"} - -for _, f in ipairs(flowers_type) do +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, - tiles = {"xdecor_"..f.."_pot.png"}, - inventory_image = "xdecor_"..f.."_pot.png", - drawtype = "plantlike", - groups = {dig_immediate=3}, - sounds = default.node_sound_leaves_defaults(), + description = "Potted flowers ("..f..")", walkable = false, + tiles = {"xdecor_"..f.."_pot.png"}, inventory_image = "xdecor_"..f.."_pot.png", + drawtype = "plantlike", groups = {dig_immediate=3}, sounds = default.node_sound_leaves_defaults() }) minetest.register_craft({ - type = "shapeless", - output = "xdecor:potted_"..f.." 2", + type = "shapeless", output = "xdecor:potted_"..f.." 2", recipe = {"flowers:"..f, "xdecor:plant_pot"} }) end xdecor.register("painting", { - description = "Painting", - drawtype = "signlike", - paramtype2 = "wallmounted", - walkable = false, - legacy_wallmounted = true, - selection_box = {type = "wallmounted"}, - tiles = {"xdecor_painting.png"}, - inventory_image = "xdecor_painting.png", - groups = {dig_immediate=3, attached_node=1}, - sounds = default.node_sound_wood_defaults() + description = "Painting", drawtype = "signlike", tiles = {"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() }) xdecor.register("plant_pot", { - description = "Plant pot", - tiles = {"xdecor_plant_pot_top.png", "xdecor_plant_pot_sides.png"}, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults() + description = "Plant pot", groups = {snappy=3}, + tiles = {"xdecor_plant_pot_top.png", "xdecor_plant_pot_sides.png"} }) -local rope_sbox = { - type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 } -} - +local rope_sbox = {type="fixed", fixed={-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}} xdecor.register("rope", { - description = "Hanging 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 = "Hanging 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 }) -local skull_sbox = { - type = "fixed", - fixed = { -0.3, -0.5, -0.3, 0.3, 0.25, 0.3 } -} - +local skull_sbox = {type="fixed", fixed={-0.3, -0.5, -0.3, 0.3, 0.25, 0.3}} xdecor.register("skull", { - description = "Skull head", - walkable = false, - tiles = {"xdecor_skull.png"}, - inventory_image = "xdecor_skull.png", - drawtype = "torchlike", - groups = {dig_immediate=3, attached_node=1}, - selection_box = skull_sbox + description = "Skull head", walkable = false, selection_box = skull_sbox, + tiles = {"xdecor_skull.png"}, inventory_image = "xdecor_skull.png", + drawtype = "torchlike", groups = {dig_immediate=3, attached_node=1} }) xdecor.register("tv", { - description = "Television", - tiles = { - "xdecor_television_top.png", - "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", - aspect_w=16, - aspect_h=16, - length=80.0 } - } - }, - light_source = 11, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), + description = "Television", light_source = 11, groups = {snappy=3}, + tiles = {"xdecor_television_top.png", "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", aspect_w=16, aspect_h=16, length=80.0}}} }) diff --git a/storage.lua b/storage.lua index 16cfd45..ea544c1 100644 --- a/storage.lua +++ b/storage.lua @@ -1,66 +1,38 @@ xdecor.register("barrel", { - description = "Barrel", + description = "Barrel", infotext = "Barrel", inventory = {size=24}, tiles = {"xdecor_barrel_top.png", "xdecor_barrel_sides.png"}, - groups = {snappy=3}, - inventory = {size=24}, - infotext = "Barrel", - sounds = default.node_sound_wood_defaults() + groups = {snappy=3}, sounds = default.node_sound_wood_defaults() }) xdecor.register("cardboard_box", { - description = "Cardboard box", + description = "Cardboard box", groups = {snappy=3}, inventory = {size=8}, 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} } - }, - groups = {snappy=3}, - inventory = {size=8} + node_box = {type="fixed", fixed={{-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125}}} }) xdecor.register("cabinet", { - description = "Cabinet", + description = "Cabinet", infotext = "Cabinet", inventory = {size=24}, tiles = {"default_wood.png", "xdecor_cabinet_front.png"}, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), - infotext = "Cabinet", - inventory = {size=24} + groups = {snappy=3}, sounds = default.node_sound_wood_defaults() }) xdecor.register("cabinet_half", { - description = "Cabinet half", + description = "Cabinet half", infotext = "Cabinet (half)", inventory = {size=8}, tiles = {"default_wood.png", "xdecor_cabinet_half_front.png"}, - node_box = { - type = "fixed", - fixed = { {-0.5, 0, -0.5, 0.5, 0.5, 0.5} } - }, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), - infotext = "Cabinet (half)", - inventory = {size=8} + 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("multishelf", { - description = "Multishelf", + description = "Multishelf", infotext = "Multishelf", inventory = {size=24}, tiles = {"default_wood.png", "xdecor_multishelf.png"}, - groups = {snappy=3}, - sounds = default.node_sound_wood_defaults(), - infotext = "Multishelf", - inventory = {size=24} + groups = {snappy=3}, sounds = default.node_sound_wood_defaults() }) xdecor.register("workbench", { - description = "Work table", - 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}, - inventory = {size=24}, - infotext = "Work bench", - sounds = default.node_sound_wood_defaults() + description = "Work table", infotext = "Work bench", inventory = {size=24}, + groups = {snappy=3}, sounds = default.node_sound_wood_defaults(), + 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"} })