Conventional code style
This commit is contained in:
parent
b76d50e416
commit
d3cde805aa
243
crafts.lua
243
crafts.lua
@ -1,134 +1,255 @@
|
||||
minetest.register_craft({ output = "xdecor:candle",
|
||||
recipe = {{"default:torch"}} })
|
||||
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:cabinet_half 2",
|
||||
recipe = {
|
||||
{"xdecor:cabinet"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:cushion 2",
|
||||
recipe = {{"wool:red", "wool:red"}} })
|
||||
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:painting",
|
||||
recipe = {
|
||||
{"default:sign_wall", "dye:blue"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:moonbrick",
|
||||
recipe = {{"default:brick", "default:stone"}} })
|
||||
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:flint_steel",
|
||||
recipe = {
|
||||
{"default:obsidian_shard", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:barrel", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:barrel",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"default:iron_lump", "", "default:iron_lump"},
|
||||
{"group:wood", "group:wood", "group:wood"} } })
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:cabinet", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cabinet",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"doors:trapdoor", "", "doors:trapdoor"},
|
||||
{"group:wood", "group:wood", "group:wood"} } })
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:cardboard_box", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cardboard_box",
|
||||
recipe = {
|
||||
{"default:paper", "default:paper", "default:paper"},
|
||||
{"default:paper", "default:paper", "default:paper"} } })
|
||||
{"default:paper", "default:paper", "default:paper"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:cauldron", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cauldron",
|
||||
recipe = {
|
||||
{"default:iron_lump", "", "default:iron_lump"},
|
||||
{"default:iron_lump", "default:water_source", "default:iron_lump"},
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"} } })
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:chair", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:chair",
|
||||
recipe = {
|
||||
{"group:stick", "", ""},
|
||||
{"group:stick", "group:stick", "group:stick"},
|
||||
{"group:stick", "", "group:stick"} } })
|
||||
{"group:stick", "", "group:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:chandelier", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:chandelier",
|
||||
recipe = {
|
||||
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
|
||||
{"default:torch", "default:torch", "default:torch"} } })
|
||||
{"default:torch", "default:torch", "default:torch"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:coalstone_tile 8", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:coalstone_tile 8",
|
||||
recipe = {
|
||||
{"default:coalblock", "default:stone"},
|
||||
{"default:stone", "default:coalblock"} } })
|
||||
{"default:stone", "default:coalblock"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:empty_shelf", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:empty_shelf",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"", "", ""},
|
||||
{"group:wood", "group:wood", "group:wood"} } })
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:fence_wrought_iron 2", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:fence_wrought_iron 2",
|
||||
recipe = {
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"},
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"} } })
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:frame", recipe = {
|
||||
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"} } })
|
||||
{"group:stick", "group:stick", "group:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:hammer", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:hammer",
|
||||
recipe = {
|
||||
{"default:steel_ingot"},
|
||||
{"group:stick"} } })
|
||||
{"group:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("xdecor:hammer", {
|
||||
description = "Hammer",
|
||||
inventory_image = "xdecor_hammer.png"})
|
||||
inventory_image = "xdecor_hammer.png"
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:lantern", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:lantern",
|
||||
recipe = {
|
||||
{"default:iron_lump"},
|
||||
{"default:torch"},
|
||||
{"default:iron_lump"}} })
|
||||
{"default:iron_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:metal_cabinet", recipe = {
|
||||
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"} } })
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:multishelf", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:multishelf",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"group:vessel", "group:book", "group:vessel"},
|
||||
{"group:wood", "group:wood", "group:wood"} } })
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:plant_pot", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:plant_pot",
|
||||
recipe = {
|
||||
{"default:clay_lump", "", "default:clay_lump"},
|
||||
{"default:clay_lump", "default:dirt", "default:clay_lump"},
|
||||
{"default:clay_lump", "default:clay_lump", "default:clay_lump"} } })
|
||||
{"default:clay_lump", "default:clay_lump", "default:clay_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:rope 2", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:rope 2",
|
||||
recipe = {
|
||||
{"farming:string"},
|
||||
{"farming:string"},
|
||||
{"farming:string"} } })
|
||||
{"farming:string"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:stereo", recipe = {
|
||||
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"} } })
|
||||
{"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:stone_tile 2", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:stone_tile 2",
|
||||
recipe = {
|
||||
{"default:cobble", "default:cobble"},
|
||||
{"default:cobble", "default:cobble"} } })
|
||||
{"default:cobble", "default:cobble"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:stone_rune 4", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:stone_rune 4",
|
||||
recipe = {
|
||||
{"default:stone", "default:stone", "default:stone"},
|
||||
{"default:stone", "", "default:stone"},
|
||||
{"default:stone", "default:stone", "default:stone"} } })
|
||||
{"default:stone", "default:stone", "default:stone"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:table", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:table",
|
||||
recipe = {
|
||||
{"stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood"},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""} } })
|
||||
{"", "group:stick", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:tv", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:tv",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:glass", "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:worktable", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:worktable",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"group:wood", "group:wood", "group:wood"} } })
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:woodframed_glass", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:woodframed_glass",
|
||||
recipe = {
|
||||
{"group:stick", "group:stick", "group:stick"},
|
||||
{"group:stick", "default:glass", "group:stick"},
|
||||
{"group:stick", "group:stick", "group:stick"} } })
|
||||
{"group:stick", "group:stick", "group:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ output = "xdecor:wood_tile 2", recipe = {
|
||||
minetest.register_craft({
|
||||
output = "xdecor:wood_tile 2",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"group:wood", "group:wood"} } })
|
||||
{"group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
@ -2,8 +2,12 @@ local tmp = {}
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
minetest.register_entity("xdecor:f_item", {
|
||||
hp_max = 1, visual="wielditem", visual_size={x=.33,y=.33},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0}, physical=false, textures={"air"},
|
||||
hp_max = 1,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=.33,y=.33},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
physical = false,
|
||||
textures = {"air"},
|
||||
on_activate = function(self, staticdata)
|
||||
if tmp.nodename ~= nil and tmp.texture ~= nil then
|
||||
self.nodename = tmp.nodename
|
||||
@ -34,9 +38,11 @@ minetest.register_entity("xdecor:f_item", {
|
||||
local remove_item = function(pos, node)
|
||||
local objs = nil
|
||||
objs = minetest.get_objects_inside_radius(pos, .5)
|
||||
|
||||
if objs then
|
||||
for _, obj in ipairs(objs) do
|
||||
if obj and obj:get_luaentity() and obj:get_luaentity().name == "xdecor:f_item" then
|
||||
if obj and obj:get_luaentity()
|
||||
and obj:get_luaentity().name == "xdecor:f_item" then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
@ -52,14 +58,19 @@ facedir[3] = {x=-1, y=0, z=0}
|
||||
local update_item = function(pos, node)
|
||||
remove_item(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if meta:get_string("item") ~= "" then
|
||||
local posad = facedir[node.param2]
|
||||
if not posad then return end
|
||||
|
||||
if not posad then
|
||||
return
|
||||
end
|
||||
pos.x = pos.x + posad.x*6.5/16
|
||||
pos.y = pos.y + posad.y*6.5/16
|
||||
pos.z = pos.z + posad.z*6.5/16
|
||||
tmp.nodename = node.name
|
||||
tmp.texture = ItemStack(meta:get_string("item")):get_name()
|
||||
|
||||
local e = minetest.add_entity(pos, "xdecor:f_item")
|
||||
local yaw = math.pi*2 - node.param2 * math.pi/2
|
||||
e:setyaw(yaw)
|
||||
@ -76,10 +87,17 @@ local drop_item = function(pos, node)
|
||||
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_wood.png", "xdecor_wood.png", "xdecor_wood.png",
|
||||
"xdecor_wood.png", "xdecor_wood.png", "xdecor_frame.png"},
|
||||
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_wood.png", "xdecor_wood.png", "xdecor_wood.png",
|
||||
"xdecor_wood.png", "xdecor_wood.png", "xdecor_frame.png"
|
||||
},
|
||||
inventory_image = "xdecor_frame.png",
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -87,7 +105,10 @@ xdecor.register("frame", {
|
||||
meta:set_string("infotext", "Item frame (owned by "..placer:get_player_name()..")")
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if not itemstack then return end
|
||||
if not itemstack then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
if clicker:get_player_name() == meta:get_string("owner") then
|
||||
drop_item(pos, node)
|
||||
@ -95,6 +116,7 @@ xdecor.register("frame", {
|
||||
meta:set_string("item", s:to_string())
|
||||
update_item(pos, node)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
@ -111,9 +133,13 @@ xdecor.register("frame", {
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:frame"}, interval = 15, chance = 1,
|
||||
nodenames = {"xdecor:frame"},
|
||||
interval = 15,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then return end
|
||||
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then
|
||||
return
|
||||
end
|
||||
update_item(pos, node)
|
||||
end
|
||||
})
|
||||
|
402
nodes.lua
402
nodes.lua
@ -1,239 +1,411 @@
|
||||
xdecor.register("barrel", {
|
||||
description = "Barrel", inventory = {size=24}, infotext = "Barrel",
|
||||
description = "Barrel",
|
||||
inventory = {size=24},
|
||||
infotext = "Barrel",
|
||||
tiles = { "xdecor_barrel_top.png", "xdecor_barrel_sides.png" },
|
||||
groups = {snappy=3}, sounds = xdecor.wood })
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.wood
|
||||
})
|
||||
|
||||
xdecor.register("cabinet", {
|
||||
description = "Cabinet", inventory = {size=24}, infotext = "Cabinet",
|
||||
tiles = {"default_wood.png", "default_wood.png",
|
||||
description = "Cabinet",
|
||||
inventory = {size=24},
|
||||
infotext = "Cabinet",
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.wood,
|
||||
tiles = {
|
||||
"default_wood.png", "default_wood.png",
|
||||
"default_wood.png","xdecor_cabinet_front.png"},
|
||||
groups = {snappy=3}, sounds = xdecor.wood })
|
||||
"default_wood.png", "default_wood.png",
|
||||
"default_wood.png","xdecor_cabinet_front.png"
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("cabinet_half", {
|
||||
description = "Half Cabinet", inventory = {size=8}, infotext = "Half Cabinet",
|
||||
tiles = {"default_wood.png", "default_wood.png",
|
||||
description = "Half Cabinet",
|
||||
inventory = {size=8},
|
||||
infotext = "Half Cabinet",
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.wood,
|
||||
node_box = xdecor.nodebox.slab_y(0.5, 0.5),
|
||||
tiles = {
|
||||
"default_wood.png", "default_wood.png",
|
||||
"default_wood.png", "xdecor_cabinet_half_front.png"},
|
||||
groups = {snappy=3}, sounds = xdecor.wood,
|
||||
node_box = xdecor.nodebox.slab_y(0.5, 0.5) })
|
||||
"default_wood.png", "default_wood.png",
|
||||
"default_wood.png", "xdecor_cabinet_half_front.png"
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("candle", {
|
||||
description = "Candle", light_source = 12, 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",
|
||||
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}} },
|
||||
selection_box = {type="wallmounted",
|
||||
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}} })
|
||||
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",
|
||||
description = "Cardboard Box",
|
||||
inventory = {size=8},
|
||||
infotext = "Cardboard Box",
|
||||
groups = {snappy=3},
|
||||
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}}} })
|
||||
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",
|
||||
description = "Cauldron",
|
||||
groups = {snappy=1},
|
||||
tiles = {
|
||||
{ name = "xdecor_cauldron_top_anim.png",
|
||||
animation = {type="vertical_frames", length=3.0} },
|
||||
"xdecor_cauldron_sides.png"} })
|
||||
"xdecor_cauldron_sides.png"
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("chair", {
|
||||
description = "Chair", tiles = {"xdecor_wood.png"},
|
||||
sounds = xdecor.wood, groups = {snappy=3},
|
||||
node_box = {type="fixed", fixed={
|
||||
description = "Chair",
|
||||
tiles = {"xdecor_wood.png"},
|
||||
sounds = xdecor.wood,
|
||||
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.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 = 14 })
|
||||
description = "Chandelier",
|
||||
drawtype = "plantlike",
|
||||
walkable = false,
|
||||
inventory_image = "xdecor_chandelier.png",
|
||||
tiles = {"xdecor_chandelier.png"},
|
||||
groups = {dig_immediate=3},
|
||||
light_source = 14
|
||||
})
|
||||
|
||||
xdecor.register("coalstone_tile", {
|
||||
drawtype = "normal", description = "Coalstone Tile", tiles = {"xdecor_coalstone_tile.png"},
|
||||
groups = {snappy=2}, sounds = xdecor.stone })
|
||||
drawtype = "normal",
|
||||
description = "Coalstone Tile",
|
||||
tiles = {"xdecor_coalstone_tile.png"},
|
||||
groups = {snappy=2},
|
||||
sounds = xdecor.stone
|
||||
})
|
||||
|
||||
local curtaincolors = {"red"} -- add more curtains simply here
|
||||
for _, c in ipairs(curtaincolors) do
|
||||
local colors = {"red"} -- Add more curtains colors simply here
|
||||
|
||||
for _, c in ipairs(colors) do
|
||||
xdecor.register("curtain_"..c, {
|
||||
description = "Curtain ("..c..")", use_texture_alpha = true, walkable = false,
|
||||
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",
|
||||
groups = {dig_immediate=3}, selection_box = {type="wallmounted"},
|
||||
drawtype = "signlike",
|
||||
paramtype2 = "wallmounted",
|
||||
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_"..c, param2=fdir })
|
||||
end })
|
||||
end
|
||||
})
|
||||
|
||||
xdecor.register("curtain_open_"..c, {
|
||||
tiles = { "xdecor_curtain_open.png^[colorize:"..c..":130" },
|
||||
drawtype = "signlike", paramtype2 = "wallmounted",
|
||||
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},
|
||||
selection_box = {type="wallmounted"}, drop = "xdecor:curtain_"..c,
|
||||
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_"..c, param2=fdir })
|
||||
end })
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:curtain_"..c.." 4",
|
||||
recipe = {{"", "wool:"..c, ""},
|
||||
recipe = {
|
||||
{"", "wool:"..c, ""},
|
||||
{"", "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 = xdecor.nodebox.slab_y(-0.5, 0.5) })
|
||||
description = "Cushion",
|
||||
tiles = {"xdecor_cushion.png"},
|
||||
groups = {snappy=3},
|
||||
on_place = minetest.rotate_node,
|
||||
node_box = xdecor.nodebox.slab_y(-0.5, 0.5)
|
||||
})
|
||||
|
||||
xdecor.register("empty_shelf", {
|
||||
description = "Empty Shelf", inventory = {size=24}, infotext = "Empty Shelf",
|
||||
description = "Empty Shelf",
|
||||
inventory = {size=24},
|
||||
infotext = "Empty Shelf",
|
||||
tiles = { "default_wood.png", "xdecor_empty_shelf.png" },
|
||||
groups = {snappy=3}, sounds = xdecor.wood })
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.wood
|
||||
})
|
||||
|
||||
local fence_sbox = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}
|
||||
}
|
||||
|
||||
local fence_sbox = {type="fixed", fixed={-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}}
|
||||
xdecor.register("fence_wrought_iron", {
|
||||
description = "Wrought Iron Fence", drawtype = "fencelike", groups = {snappy=2},
|
||||
tiles = {"default_stone.png^[colorize:#2a2420:180"}, selection_box = fence_sbox,
|
||||
inventory_image = "default_fence_overlay.png^default_stone.png^[colorize:#2a2420:160^default_fence_overlay.png^[makealpha:255,126,126" })
|
||||
description = "Wrought Iron Fence",
|
||||
drawtype = "fencelike",
|
||||
groups = {snappy=2},
|
||||
tiles = { "default_stone.png^[colorize:#2a2420:180" },
|
||||
selection_box = fence_sbox,
|
||||
inventory_image = "default_fence_overlay.png^default_stone.png^[colorize:#2a2420:160^default_fence_overlay.png^[makealpha:255,126,126"
|
||||
})
|
||||
|
||||
xdecor.register("fire", {
|
||||
description = "Fake Fire", light_source = 14, walkable = false,
|
||||
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} })
|
||||
description = "Fake Fire",
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
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,
|
||||
description = "Flint & Steel",
|
||||
stack_max = 1,
|
||||
inventory_image = "xdecor_flint_steel.png",
|
||||
tool_capabilities = {groupcaps={flamable={uses=65, maxlevel=1}}},
|
||||
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
|
||||
minetest.set_node(pointed_thing.above, {name="xdecor:fire"})
|
||||
else
|
||||
minetest.chat_send_player(user:get_player_name(), "This area is protected!") end
|
||||
else return end
|
||||
minetest.chat_send_player(user:get_player_name(), "This area is protected!")
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
itemstack:add_wear(65535/65)
|
||||
return itemstack
|
||||
end })
|
||||
end
|
||||
})
|
||||
|
||||
xdecor.register("lantern", {
|
||||
description = "Lantern", light_source = 12, drawtype = "torchlike",
|
||||
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",
|
||||
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}} })
|
||||
wall_side = {-0.5, -0.5, -0.15, 0.5, 0.5, 0.15}
|
||||
}
|
||||
})
|
||||
|
||||
local flowerstype = { "dandelion_white", "dandelion_yellow", "geranium",
|
||||
"rose", "tulip", "viola" }
|
||||
|
||||
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,
|
||||
description = "Potted Flowers ("..f..")",
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3},
|
||||
tiles = {"xdecor_"..f.."_pot.png"}, inventory_image = "xdecor_"..f.."_pot.png",
|
||||
drawtype = "plantlike", sounds = xdecor.leaves })
|
||||
tiles = {"xdecor_"..f.."_pot.png"},
|
||||
inventory_image = "xdecor_"..f.."_pot.png",
|
||||
drawtype = "plantlike",
|
||||
sounds = xdecor.leaves
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless", output = "xdecor:potted_"..f.." 2",
|
||||
recipe = {"flowers:"..f, "xdecor:plant_pot"} })
|
||||
recipe = { "flowers:"..f, "xdecor:plant_pot" }
|
||||
})
|
||||
end
|
||||
|
||||
xdecor.register("painting", {
|
||||
description = "Painting", drawtype = "signlike",
|
||||
tiles = {"xdecor_painting.png"}, inventory_image = "xdecor_painting.png",
|
||||
paramtype2 = "wallmounted", legacy_wallmounted = true, walkable = false,
|
||||
wield_image = "xdecor_painting.png", selection_box = {type = "wallmounted"},
|
||||
groups = {dig_immediate=3, attached_node=1} })
|
||||
description = "Painting",
|
||||
drawtype = "signlike",
|
||||
tiles = {"xdecor_painting.png"},
|
||||
inventory_image = "xdecor_painting.png",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
walkable = false,
|
||||
wield_image = "xdecor_painting.png",
|
||||
selection_box = {type="wallmounted"},
|
||||
groups = {dig_immediate=3, attached_node=1}
|
||||
})
|
||||
|
||||
xdecor.register("plant_pot", {
|
||||
description = "Plant Pot", groups = {snappy=3},
|
||||
tiles = {"xdecor_plant_pot_top.png", "xdecor_plant_pot_bottom.png", "xdecor_plant_pot_sides.png"} })
|
||||
description = "Plant Pot",
|
||||
groups = {snappy=3},
|
||||
tiles = {"xdecor_plant_pot_top.png", "xdecor_plant_pot_bottom.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",
|
||||
description = "Metal Cabinet",
|
||||
inventory = {size=24},
|
||||
groups = {snappy=1},
|
||||
infotext = "Metal Cabinet",
|
||||
tiles = {
|
||||
"xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_sides.png",
|
||||
"xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_front.png"},
|
||||
groups = {snappy=1}, infotext = "Metal Cabinet" })
|
||||
"xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_sides.png",
|
||||
"xdecor_metal_cabinet_sides.png", "xdecor_metal_cabinet_front.png"
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("moonbrick", {
|
||||
drawtype = "normal", description = "Moonbrick", tiles = {"xdecor_moonbrick.png"},
|
||||
groups = {snappy=2}, sounds = xdecor.stone })
|
||||
drawtype = "normal",
|
||||
description = "Moonbrick",
|
||||
tiles = {"xdecor_moonbrick.png"},
|
||||
groups = {snappy=2},
|
||||
sounds = xdecor.stone
|
||||
})
|
||||
|
||||
xdecor.register("multishelf", {
|
||||
description = "Multi Shelf", inventory = {size=24}, infotext = "Multi Shelf",
|
||||
description = "Multi Shelf",
|
||||
inventory = {size=24},
|
||||
infotext = "Multi Shelf",
|
||||
tiles = {"default_wood.png", "xdecor_multishelf.png"},
|
||||
groups = {snappy=3}, sounds = xdecor.wood })
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.wood
|
||||
})
|
||||
|
||||
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 = "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" })
|
||||
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",
|
||||
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_stereo_back.png", "xdecor_stereo_front.png"
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("stone_rune", {
|
||||
description = "Stone Rune", tiles = {"xdecor_stone_rune.png"},
|
||||
drawtype = "normal", groups = {snappy=3}, sounds = xdecor.stone })
|
||||
description = "Stone Rune",
|
||||
tiles = {"xdecor_stone_rune.png"},
|
||||
drawtype = "normal",
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.stone
|
||||
})
|
||||
|
||||
xdecor.register("stone_tile", {
|
||||
description = "Stone Tile", tiles = {"xdecor_stone_tile.png"},
|
||||
drawtype = "normal", groups = {snappy=3}, sounds = xdecor.stone })
|
||||
description = "Stone Tile",
|
||||
tiles = {"xdecor_stone_tile.png"},
|
||||
drawtype = "normal",
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.stone
|
||||
})
|
||||
|
||||
xdecor.register("table", {
|
||||
description = "Table", tiles = {"xdecor_wood.png"},
|
||||
groups = {snappy=3}, sounds = xdecor.wood,
|
||||
node_box = {type="fixed", fixed={
|
||||
description = "Table",
|
||||
tiles = {"xdecor_wood.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.wood,
|
||||
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.15, -0.5, -0.15, 0.15, 0.4, 0.15}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("tv", {
|
||||
description = "Television", light_source = 11, groups = {snappy=3},
|
||||
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",
|
||||
"xdecor_television_left.png", "xdecor_television_back.png",
|
||||
{ name = "xdecor_television_front_animated.png",
|
||||
animation = {type="vertical_frames", length=80.0}}} })
|
||||
animation = {type="vertical_frames", length=80.0} }
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("woodframed_glass", {
|
||||
description = "Wood Framed Glass", drawtype = "glasslike_framed",
|
||||
description = "Wood Framed Glass",
|
||||
drawtype = "glasslike_framed",
|
||||
tiles = { "xdecor_framed_glass.png", "xdecor_framed_glass_detail.png" },
|
||||
groups = {snappy=3}, sounds = xdecor.glass })
|
||||
groups = {snappy=3},
|
||||
sounds = xdecor.glass
|
||||
})
|
||||
|
||||
xdecor.register("wood_tile", {
|
||||
description = "Wood Tile", tiles = {"xdecor_wood_tile.png"},
|
||||
drawtype = "normal", groups = {snappy=2, wood=1}, sounds = xdecor.wood })
|
||||
description = "Wood Tile",
|
||||
tiles = {"xdecor_wood_tile.png"},
|
||||
drawtype = "normal",
|
||||
groups = {snappy=2, wood=1},
|
||||
sounds = xdecor.wood
|
||||
})
|
||||
|
123
worktable.lua
123
worktable.lua
@ -1,20 +1,48 @@
|
||||
local material = {
|
||||
"cloud", -- only used for the formspec display
|
||||
"wood", "junglewood", "pinewood", "tree", "pinetree",
|
||||
"cloud", -- Only used for the formspec display.
|
||||
"wood", "junglewood", "pinewood",
|
||||
"tree", "jungletree", "pinetree",
|
||||
"cobble", "mossycobble", "desert_cobble",
|
||||
"stone", "sandstone", "desert_stone", "obsidian",
|
||||
"stonebrick", "sandstonebrick", "desert_stonebrick", "obsidianbrick",
|
||||
"copperblock", "bronzeblock", "goldblock", "steelblock", "diamondblock",
|
||||
"meselamp", "glass", "obsidian_glass" }
|
||||
"coalblock", "copperblock", "bronzeblock",
|
||||
"goldblock", "steelblock", "diamondblock",
|
||||
"clay", "ice", "meselamp",
|
||||
"glass", "obsidian_glass"
|
||||
}
|
||||
|
||||
local def = { -- node name, yield, nodebox shape
|
||||
{"nanoslab", "16", {-0.5, -0.5, -0.5, 0, -0.4375, 0}},
|
||||
{"micropanel", "16", {-0.5, -0.5, -0.5, 0.5, -0.4375, 0}},
|
||||
{"microslab", "8", {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}},
|
||||
{"panel", "4", {-0.5, -0.5, -0.5, 0.5, 0, 0}},
|
||||
{"slab", "2", {-0.5, -0.5, -0.5, 0.5, 0, 0.5}},
|
||||
{"outerstair", "1", {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0, 0.5, 0.5}}},
|
||||
{"stair", "1", {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0.5, 0.5, 0.5}}},
|
||||
{"innerstair", "1", {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0.5, 0.5, 0.5}, {-0.5, 0, -0.5, 0, 0.5, 0}}}
|
||||
local def = { -- Node name, yield, nodebox shape.
|
||||
{ "nanoslab", "16",
|
||||
{-0.5, -0.5, -0.5, 0, -0.4375, 0}
|
||||
},
|
||||
{ "micropanel", "16",
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0}
|
||||
},
|
||||
{ "microslab", "8",
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
|
||||
},
|
||||
{ "panel", "4",
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0}
|
||||
},
|
||||
{ "slab", "2",
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}
|
||||
},
|
||||
{ "outerstair", "1", {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
{ "stair", "1", {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
{ "innerstair", "1", {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
{-0.5, 0, -0.5, 0, 0.5, 0}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local function xconstruct(pos)
|
||||
@ -42,6 +70,7 @@ local function xconstruct(pos)
|
||||
"list[current_name;fuel;7,2;1,1;]"..
|
||||
"list[current_player;main;0,3.25;8,4;]")
|
||||
meta:set_string("infotext", "Work Table")
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("output", 1)
|
||||
inv:set_size("input", 1)
|
||||
@ -61,6 +90,7 @@ local function xfields(pos, formname, fields, sender)
|
||||
for n=1, #def do
|
||||
local v = material[m]
|
||||
local w = def[n]
|
||||
|
||||
if (inputstack:get_name() == "default:"..v)
|
||||
and (outputstack:get_count() < 99) and fields[w[1]] then
|
||||
shape = "xdecor:"..w[1].."_"..v
|
||||
@ -78,26 +108,39 @@ end
|
||||
local function xdig(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if not inv:is_empty("input") or not inv:is_empty("output")
|
||||
or not inv:is_empty("fuel") or not inv:is_empty("src") then
|
||||
return false end
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
xdecor.register("worktable", {
|
||||
description = "Work Table", groups = {snappy=3},
|
||||
description = "Work Table",
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
tiles = {"xdecor_worktable_top.png", "xdecor_worktable_top.png",
|
||||
tiles = {
|
||||
"xdecor_worktable_top.png", "xdecor_worktable_top.png",
|
||||
"xdecor_worktable_sides.png", "xdecor_worktable_sides.png",
|
||||
"xdecor_worktable_front.png", "xdecor_worktable_front.png"},
|
||||
on_construct = xconstruct, on_receive_fields = xfields, can_dig = xdig })
|
||||
"xdecor_worktable_front.png", "xdecor_worktable_front.png"
|
||||
},
|
||||
on_construct = xconstruct,
|
||||
on_receive_fields = xfields,
|
||||
can_dig = xdig
|
||||
})
|
||||
|
||||
local function lightlvl(mat)
|
||||
if (mat == "meselamp") then return 12 else return 0 end
|
||||
if (mat == "meselamp") then
|
||||
return 12
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
local function stype(mat)
|
||||
if string.find(mat, "glass") or string.find(mat, "lamp") then
|
||||
if string.find(mat, "glass") or string.find(mat, "lamp")
|
||||
or string.find(mat, "ice") then
|
||||
return default.node_sound_glass_defaults()
|
||||
elseif string.find(mat, "wood") or string.find(mat, "tree") then
|
||||
return default.node_sound_wood_defaults()
|
||||
@ -113,7 +156,9 @@ local function tnaming(mat)
|
||||
elseif string.find(mat, "brick") then
|
||||
local newname = string.gsub(mat, "(brick)", "_%1")
|
||||
return "default_"..newname..".png"
|
||||
else return "default_"..mat..".png" end
|
||||
else
|
||||
return "default_"..mat..".png"
|
||||
end
|
||||
end
|
||||
|
||||
for m=1, #material do
|
||||
@ -125,17 +170,22 @@ for m=1, #material do
|
||||
for n=1, #def do
|
||||
local w = def[n]
|
||||
xdecor.register(w[1].."_"..v, {
|
||||
description = string.sub(string.upper(w[1]), 0, 1)..string.sub(w[1], 2),
|
||||
light_source = light, sounds = sound, tiles = {tile},
|
||||
description = string.sub(string.upper(w[1]), 0, 1)..
|
||||
string.sub(w[1], 2),
|
||||
light_source = light,
|
||||
sounds = sound,
|
||||
tiles = {tile},
|
||||
groups = {snappy=3, not_in_creative_inventory=1},
|
||||
node_box = {type = "fixed", fixed = w[3]},
|
||||
on_place = minetest.rotate_node })
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = w[3]
|
||||
},
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Repair Tool's code by Krock, modified by kilbith
|
||||
|
||||
minetest.register_abm({
|
||||
minetest.register_abm({ -- Repair Tool's code by Krock, modified by kilbith
|
||||
nodenames = {"xdecor:worktable"},
|
||||
interval = 5, chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
@ -145,11 +195,20 @@ minetest.register_abm({
|
||||
local wear = src:get_wear()
|
||||
local repair = -1400
|
||||
|
||||
if (src:is_empty() or wear == 0 or wear == 65535) then return end
|
||||
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
|
||||
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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user