1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

Update homedecor_modpack

This commit is contained in:
LeMagnesium 2015-09-07 20:30:52 +02:00
parent 589b0ce4a5
commit f8052a0108
45 changed files with 883 additions and 1221 deletions

View File

@ -1 +1,7 @@
# temporary files
*~
# eclipse project files
.project
.settings
.buildpath

View File

@ -7,7 +7,7 @@ minetest.register_craft({
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting" },
{ "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting" }
{ "homedecor:plastic_sheeting", "group:wood", "homedecor:plastic_sheeting" }
}
})
@ -15,7 +15,7 @@ minetest.register_craft({
output = "computer:slaystation",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting" }
{ "homedecor:plastic_sheeting", "group:wood", "homedecor:plastic_sheeting" }
}
})
@ -49,7 +49,7 @@ minetest.register_craft({
output = "computer:admiral64",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:wood", "default:wood", "default:wood" }
{ "group:wood", "group:wood", "group:wood" }
}
})

View File

@ -195,10 +195,7 @@ homedecor.register("shower_tray", {
{ 0.45, -0.45, -0.45, 0.5, -0.4, 0.45 }
},
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4, 0.5 },
},
selection_box = homedecor.nodebox.slab_y(0.1),
groups = {cracky=2},
sounds = default.node_sound_stone_defaults(),
on_destruct = function(pos)

View File

@ -143,3 +143,61 @@ for i in ipairs(bedcolors) do
minetest.register_alias("homedecor:bed_"..color.."_head", "air")
end
for _, w in pairs({"mahogany", "oak"}) do
homedecor.register("nightstand_"..w.."_one_drawer", {
description = S("Nightstand with One Drawer ("..w..")"),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
'homedecor_nightstand_'..w..'_lr.png',
'homedecor_nightstand_'..w..'_back.png',
'homedecor_nightstand_'..w..'_1_drawer_front.png'},
node_box = {
type = "fixed",
fixed = {
{ -8/16, 0, -30/64, 8/16, 8/16, 8/16 }, -- top half
{ -7/16, 1/16, -32/64, 7/16, 7/16, -29/64}, -- drawer face
{ -8/16, -8/16, -30/64, -7/16, 0, 8/16 }, -- left
{ 7/16, -8/16, -30/64, 8/16, 0, 8/16 }, -- right
{ -8/16, -8/16, 7/16, 8/16, 0, 8/16 }, -- back
{ -8/16, -8/16, -30/64, 8/16, -7/16, 8/16 } -- bottom
}
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = { type = "regular" },
infotext=S("One-drawer Nightstand"),
inventory = {
size=8,
lockable=true,
},
})
homedecor.register("nightstand_"..w.."_two_drawers", {
description = S("Nightstand with Two Drawers ("..w..")"),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
'homedecor_nightstand_'..w..'_lr.png',
'homedecor_nightstand_'..w..'_back.png',
'homedecor_nightstand_'..w..'_2_drawer_front.png'},
node_box = {
type = "fixed",
fixed = {
{ -8/16, -8/16, -30/64, 8/16, 8/16, 8/16 }, -- main body
{ -7/16, 1/16, -32/64, 7/16, 7/16, -29/64 }, -- top drawer face
{ -7/16, -7/16, -32/64, 7/16, -1/16, -29/64 }, -- bottom drawer face
}
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = { type = "regular" },
infotext=S("Two-drawer Nightstand"),
inventory = {
size=16,
lockable=true,
},
})
end

View File

@ -42,7 +42,6 @@ homedecor.register("desk_fan", {
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
local meta = minetest.get_meta(pos)
meta:set_string("active", "no")
print (meta:get_string("active"))
if entity_remove[1] == nil then
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "homedecor:mesh_desk_fan") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
@ -62,10 +61,8 @@ homedecor.register("desk_fan", {
local speedy_meta = minetest.get_meta(pos)
if speedy_meta:get_string("active") == "no" then
speedy_meta:set_string("active", "yes")
print (speedy_meta:get_string("active"))
elseif speedy_meta:get_string("active") == "yes" then
speedy_meta:set_string("active", "no")
print (speedy_meta:get_string("active"))
end
if entity_anim[1] == nil then
@ -145,11 +142,7 @@ homedecor.register("space_heater", {
}
})
local r_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, 0.25, 0.5, 0.5, 0.5 }
}
local r_cbox = homedecor.nodebox.slab_z(-0.25)
homedecor.register("radiator", {
mesh = "homedecor_radiator.obj",
tiles = {

View File

@ -483,7 +483,7 @@ minetest.register_craft( {
output = "homedecor:shingles_asphalt 6",
recipe = {
{ "building_blocks:gravel_spread", "dye:black", "building_blocks:gravel_spread" },
{ "default:sand", "dye:black", "default:sand" },
{ "group:sand", "dye:black", "group:sand" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
},
})
@ -1070,7 +1070,7 @@ end
local mats = {
{ "brass", "homedecor:pole_brass" },
{ "wrought_iron", "homedecor:pole_wrought_iron" },
{ "wood", "default:stick" }
{ "wood", "group:stick" }
}
for i in ipairs(mats) do
@ -1959,9 +1959,9 @@ minetest.register_craft( {
minetest.register_craft( {
output = "homedecor:door_woodglass_left",
recipe = {
{ "default:wood", "default:glass", "" },
{ "default:wood", "default:glass", "technic:brass_ingot" },
{ "default:wood", "default:wood", "" },
{ "group:wood", "default:glass", "" },
{ "group:wood", "default:glass", "technic:brass_ingot" },
{ "group:wood", "group:wood", "" },
},
})
@ -1971,8 +1971,8 @@ minetest.register_craft( {
output = "homedecor:door_woodglass2_left",
recipe = {
{ "default:glass", "default:glass", "" },
{ "default:wood", "default:wood", "default:iron_lump" },
{ "default:wood", "default:wood", "" },
{ "group:wood", "group:wood", "default:iron_lump" },
{ "group:wood", "group:wood", "" },
},
})
@ -2043,7 +2043,6 @@ minetest.register_craft( {
},
}) ]]-- Recipe disabled. Item "technich:motor" is unknown. //MFF(Mg|08/09/15)
minetest.register_craft( {
output = "homedecor:dishwasher_wood",
recipe = {
@ -2224,7 +2223,7 @@ minetest.register_craft({
minetest.register_craft({
output = "homedecor:towel_rod",
recipe = {
{ "default:wood", "group:stick", "default:wood" },
{ "group:wood", "group:stick", "group:wood" },
{ "", "building_blocks:terrycloth_towel", "" },
},
})
@ -2345,7 +2344,6 @@ minetest.register_craft({
},
}) ]]-- Recipe disabled. Item "technich:motor" is unknown. //MFF(Mg|08/09/15)
minetest.register_craft({
output = "homedecor:ceiling_fan",
recipe = {
@ -2655,7 +2653,7 @@ minetest.register_craft( {
recipe = {
{ "homedecor:shingles_wood", "homedecor:shingles_wood", "homedecor:shingles_wood" },
{ "group:wood", "group:stick", "group:wood" },
{ "default:cobble", "", "default:cobble" }
{ "group:stone", "", "group:stone" }
},
})
@ -3346,6 +3344,55 @@ minetest.register_craft( {
recipe = { { "homedecor:flower_pot_terracotta" } }
})
minetest.register_craft({
output = "homedecor:shrubbery_green 3",
recipe = {
{ "group:leaves", "group:leaves", "group:leaves" },
{ "group:leaves", "group:leaves", "group:leaves" },
{ "group:stick", "group:stick", "group:stick" }
}
})
for _, color in ipairs(homedecor.shrub_colors) do
minetest.register_craft({
type = "shapeless",
output = "homedecor:shrubbery_large_"..color,
recipe = {
"homedecor:shrubbery_"..color
}
})
minetest.register_craft({
type = "shapeless",
output = "homedecor:shrubbery_"..color,
recipe = {
"homedecor:shrubbery_large_"..color
}
})
if color ~= "green" then
minetest.register_craft({
type = "shapeless",
output = "homedecor:shrubbery_large_"..color,
recipe = {
"homedecor:shrubbery_large_green",
"dye:"..color
}
})
minetest.register_craft({
type = "shapeless",
output = "homedecor:shrubbery_"..color,
recipe = {
"homedecor:shrubbery_green",
"dye:"..color
}
})
end
end
for i in ipairs(homedecor.banister_materials) do
local name = homedecor.banister_materials[i][1]

View File

@ -400,7 +400,7 @@ for i in ipairs(gates_list) do
minetest.register_node("homedecor:gate_"..gate.."_closed", def)
-- this is either a terrible idea or a great one
def = homedecor.table_copy(def)
def = table.copy(def)
def.groups.not_in_creative_inventory = 1
def.selection_box.fixed = { 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 }
def.node_box.fixed = gate_models_open[i]

View File

@ -144,6 +144,7 @@ homedecor.register("telephone", {
minetest.register_abm({
nodenames = "homedecor:telephone",
label = "sfx",
interval = 30,
chance = 15,
action = function(pos, node)

View File

@ -241,7 +241,7 @@ homedecor.register("swing", {
fixed = { -0.3125, 0.33, -0.125, 0.3125, 0.5, 0.1875 }
},
on_place = function(itemstack, placer, pointed_thing)
isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing)
local isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing)
if isceiling then
local height = 0
@ -261,6 +261,7 @@ homedecor.register("swing", {
end
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
for j = 0, height do -- then fill that space with ropes...
local testpos = { x=pos.x, y=pos.y-j, z=pos.z }
local testnode = minetest.get_node(testpos)
@ -349,5 +350,60 @@ if minetest.get_modpath("bucket") then
})
end
local shrub_model = {
type = "fixed",
fixed = {
{-0.312500,-0.500000,0.250000,-0.187500,-0.437500,0.375000}, --NodeBox 1
{0.187500,-0.500000,-0.125000,0.312500,-0.437500,0.000000}, --NodeBox 2
{0.000000,-0.500000,-0.312500,0.125000,-0.437500,-0.187500}, --NodeBox 3
{-0.375000,-0.500000,-0.062500,-0.250000,-0.437500,0.062500}, --NodeBox 4
{0.000000,-0.500000,-0.250000,0.125000,-0.437500,-0.125000}, --NodeBox 5
{0.187500,-0.437500,-0.187500,0.375000,-0.375000,0.062500}, --NodeBox 6
{-0.062500,-0.437500,0.125000,0.187500,-0.375000,0.375000}, --NodeBox 7
{-0.062500,-0.437500,-0.375000,0.187500,-0.375000,-0.062500}, --NodeBox 8
{-0.375000,-0.437500,0.187500,-0.125000,-0.375000,0.431179}, --NodeBox 9
{-0.437500,-0.437500,-0.125000,-0.187500,-0.375000,0.125000}, --NodeBox 10
{-0.437500,-0.375000,-0.437500,0.439966,-0.312500,0.420887}, --NodeBox 11
{-0.500000,-0.312500,-0.500000,0.500000,0.500000,0.500000}, --NodeBox 12
{0.000000,-0.500000,0.187500,0.125000,-0.437500,0.312500}, --NodeBox 13
}
}
homedecor.shrub_colors = {
"green",
"red",
"yellow"
}
for _, color in ipairs(homedecor.shrub_colors) do
minetest.register_node("homedecor:shrubbery_large_"..color, {
description = S("Shrubbery ("..color..")"),
drawtype = "allfaces_optional",
tiles = {"homedecor_shrubbery_"..color.."_top.png"},
paramtype = "light",
is_ground_content = false,
groups = {snappy=3, flammable=2},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("homedecor:shrubbery_"..color, {
description = S("Shrubbery ("..color..")"),
drawtype = "nodebox",
tiles = {
"homedecor_shrubbery_"..color.."_top.png",
"homedecor_shrubbery_bottom.png",
"homedecor_shrubbery_"..color.."_sides.png"
},
paramtype = "light",
is_ground_content = false,
groups = {snappy=3, flammable=2},
sounds = default.node_sound_leaves_defaults(),
node_box = shrub_model
})
end
minetest.register_alias("homedecor:well_top", "air")
minetest.register_alias("homedecor:well_base", "homedecor:well")
minetest.register_alias("gloopblocks:shrubbery", "homedecor:shrubbery_green")
minetest.register_alias("gloopblocks:shrubbery_large", "homedecor:shrubbery_large_green")

View File

@ -71,14 +71,8 @@ homedecor.register("fence_picket", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }
},
selection_box = homedecor.nodebox.slab_z(-0.1),
node_box = homedecor.nodebox.slab_z(-0.002),
})
homedecor.register("fence_picket_corner", {
@ -93,20 +87,8 @@ homedecor.register("fence_picket_corner", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.4, 0.5, 0.4 }
}
},
node_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.498, 0.5, 0.5 }
}
},
selection_box = homedecor.nodebox.corner_xz(0.1, -0.1),
node_box = homedecor.nodebox.corner_xz(0.002, -0.002),
})
homedecor.register("fence_picket_white", {
@ -121,14 +103,8 @@ homedecor.register("fence_picket_white", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.498, 0.5, 0.5, 0.498 }
},
selection_box = homedecor.nodebox.slab_z(-0.1),
node_box = homedecor.nodebox.slab_z(-0.002),
})
homedecor.register("fence_picket_corner_white", {
@ -143,20 +119,8 @@ homedecor.register("fence_picket_corner_white", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.4, 0.5, 0.4 }
}
},
node_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.498, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.498, 0.5, 0.5 }
}
},
selection_box = homedecor.nodebox.corner_xz(0.1, -0.1),
node_box = homedecor.nodebox.corner_xz(0.002, -0.002),
})
homedecor.register("fence_privacy", {
@ -171,10 +135,7 @@ homedecor.register("fence_privacy", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 5/16, 0.5, 0.5, 8/16 }
},
selection_box = homedecor.nodebox.slab_z(-3/16),
node_box = {
type = "fixed",
fixed = {
@ -201,7 +162,7 @@ homedecor.register("fence_privacy_corner", {
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 5/16, 0.5, 0.5, 0.5 },
homedecor.box.slab_z(-3/16),
{ -0.5, -0.5, -0.5, -5/16, 0.5, 5/16 },
}
},
@ -226,10 +187,7 @@ homedecor.register("fence_barbed_wire", {
tiles = {"homedecor_fence_barbed_wire.png"},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }
},
selection_box = homedecor.nodebox.slab_z(-0.125),
node_box = {
type = "fixed",
fixed = {
@ -247,13 +205,7 @@ homedecor.register("fence_barbed_wire_corner", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.375, 0.5, 0.375 }
}
},
selection_box = homedecor.nodebox.corner_xz(0.125, -0.125),
node_box = {
type = "fixed",
fixed = {
@ -279,10 +231,7 @@ homedecor.register("fence_chainlink", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 }
},
selection_box = homedecor.nodebox.slab_z(-0.125),
node_box = {
type = "fixed",
fixed = {
@ -307,13 +256,7 @@ homedecor.register("fence_chainlink_corner", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.375, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.375, 0.5, 0.375 }
}
},
selection_box = homedecor.nodebox.corner_xz(0.125, -0.125),
node_box = {
type = "fixed",
fixed = {
@ -342,10 +285,7 @@ homedecor.register("fence_wrought_iron_2", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, 0.42, 0.5, 0.5, 0.5 }
},
selection_box = homedecor.nodebox.slab_z(-0.08),
node_box = {
type = "fixed",
fixed = {
@ -372,13 +312,7 @@ homedecor.register("fence_wrought_iron_2_corner", {
},
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, 0.42, 0.5, 0.5, 0.5 },
{ -0.5, -0.5, -0.5, -0.42, 0.5, 0.5 }
}
},
selection_box = homedecor.nodebox.corner_xz(0.08, -0.08),
node_box = {
type = "fixed",
fixed = {

View File

@ -0,0 +1,61 @@
local S = homedecor.gettext
homedecor.register("coatrack_wallmount", {
tiles = { homedecor.plain_wood },
inventory_image = "homedecor_coatrack_wallmount_inv.png",
description = "Coatrack (wallmounted)",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.375, 0, 0.4375, 0.375, 0.14, 0.5}, -- NodeBox1
{-0.3025, 0.0475, 0.375, -0.26, 0.09, 0.4375}, -- NodeBox2
{0.26, 0.0475, 0.375, 0.3025, 0.09, 0.4375}, -- NodeBox3
{0.0725, 0.0475, 0.375, 0.115, 0.09, 0.4375}, -- NodeBox4
{-0.115, 0.0475, 0.375, -0.0725, 0.09, 0.4375}, -- NodeBox5
{0.24, 0.025, 0.352697, 0.3225, 0.115, 0.375}, -- NodeBox6
{-0.3225, 0.025, 0.352697, -0.24, 0.115, 0.375}, -- NodeBox7
{-0.135, 0.025, 0.352697, -0.0525, 0.115, 0.375}, -- NodeBox8
{0.0525, 0.025, 0.352697, 0.135, 0.115, 0.375}, -- NodeBox9
}
},
})
homedecor.register("coat_tree", {
mesh = "homedecor_coatrack.obj",
tiles = {
homedecor.plain_wood,
"homedecor_generic_wood_old.png"
},
inventory_image = "homedecor_coatrack_inv.png",
description = "Coat tree",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
expand = { top="air" },
walkable = false,
selection_box = {
type = "fixed",
fixed = { -0.4, -0.5, -0.4, 0.4, 1.5, 0.4 }
},
on_rotate = screwdriver.rotate_simple
})
for _, color in pairs({ "green", "brown", "grey" }) do
homedecor.register("welcome_mat_"..color, {
description = "Welcome Mat ("..color..")",
tiles = {
"homedecor_welcome_mat_"..color..".png",
"homedecor_welcome_mat_bottom.png",
"homedecor_welcome_mat_"..color..".png",
},
groups = {crumbly=3},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.375, 0.5, -0.46875, 0.375 }
}
})
end

View File

@ -152,40 +152,6 @@ homedecor.register("wall_shelf", {
}
})
local ofchairs_sbox = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
}
local ofchairs_cbox = {
type = "fixed",
fixed = {
{ -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
{ -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
{ -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
{ -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
}
}
local ofchairs = {"basic", "upscale"}
for _, c in ipairs(ofchairs) do
homedecor.register("office_chair_"..c, {
description = "Office chair ("..c..")",
drawtype = "mesh",
tiles = { "homedecor_office_chair_"..c..".png" },
mesh = "homedecor_office_chair_"..c..".obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = ofchairs_sbox,
collision_box = ofchairs_cbox,
expand = { top = "air" },
on_rotate = screwdriver.rotate_simple
})
end
-- Aliases for 3dforniture mod.
minetest.register_alias("3dforniture:table", "homedecor:table")

View File

@ -0,0 +1,208 @@
local S = homedecor.gettext
local cutlery_cbox = {
type = "fixed",
fixed = {
{ -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 },
{ -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 }
}
}
homedecor.register("cutlery_set", {
drawtype = "mesh",
mesh = "homedecor_cutlery_set.obj",
tiles = { "homedecor_cutlery_set.png" },
inventory_image = "homedecor_cutlery_set_inv.png",
description = "Cutlery set",
groups = {snappy=3},
selection_box = cutlery_cbox,
walkable = false,
sounds = default.node_sound_glass_defaults(),
})
local bottle_cbox = {
type = "fixed",
fixed = {
{ -0.125, -0.5, -0.125, 0.125, 0, 0.125}
}
}
local fbottle_cbox = {
type = "fixed",
fixed = {
{ -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 }
}
}
local bottle_colors = {"brown", "green"}
for _, b in ipairs(bottle_colors) do
homedecor.register("bottle_"..b, {
tiles = { "homedecor_bottle_"..b..".png" },
inventory_image = "homedecor_bottle_"..b.."_inv.png",
description = "Bottle ("..b..")",
mesh = "homedecor_bottle.obj",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
selection_box = bottle_cbox
})
-- 4-bottle sets
homedecor.register("4_bottles_"..b, {
tiles = {
"homedecor_bottle_"..b..".png",
"homedecor_bottle_"..b..".png"
},
inventory_image = "homedecor_4_bottles_"..b.."_inv.png",
description = "Four "..b.." bottles",
mesh = "homedecor_4_bottles.obj",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
selection_box = fbottle_cbox
})
end
homedecor.register("4_bottles_multi", {
tiles = {
"homedecor_bottle_brown.png",
"homedecor_bottle_green.png"
},
inventory_image = "homedecor_4_bottles_multi_inv.png",
description = "Four misc brown/green bottles",
mesh = "homedecor_4_bottles.obj",
groups = {snappy=3},
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = fbottle_cbox
})
local wine_cbox = homedecor.nodebox.slab_z(-0.75)
homedecor.register("wine_rack", {
description = "Wine Rack",
mesh = "homedecor_wine_rack.obj",
tiles = {
"homedecor_generic_wood_red.png",
"homedecor_bottle_brown.png",
"homedecor_bottle_brown2.png",
"homedecor_bottle_brown3.png",
"homedecor_bottle_brown4.png"
},
inventory_image = "homedecor_wine_rack_inv.png",
groups = {choppy=2},
selection_box = wine_cbox,
collision_box = wine_cbox,
sounds = default.node_sound_defaults(),
})
homedecor.register("dartboard", {
description = "Dartboard",
mesh = "homedecor_dartboard.obj",
tiles = { "homedecor_dartboard.png" },
inventory_image = "homedecor_dartboard_inv.png",
wield_image = "homedecor_dartboard_inv.png",
paramtype2 = "wallmounted",
walkable = false,
selection_box = {
type = "wallmounted",
},
groups = {choppy=2,dig_immediate=2,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_wood_defaults(),
})
homedecor.register("beer_tap", {
description = "Beer tap",
mesh = "homedecor_beer_taps.obj",
tiles = {
"homedecor_generic_metal_bright.png",
"homedecor_generic_metal_black.png",
},
inventory_image = "homedecor_beertap_inv.png",
groups = { snappy=3 },
walkable = false,
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 }
},
on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item()
local inv = puncher:get_inventory()
local wieldname = wielditem:get_name()
if wieldname == "vessels:drinking_glass" then
if inv:room_for_item("main", "homedecor:beer_mug 1") then
wielditem:take_item()
puncher:set_wielded_item(wielditem)
inv:add_item("main", "homedecor:beer_mug 1")
minetest.chat_send_player(puncher:get_player_name(), "Ahh, a frosty cold beer - look in your inventory for it!")
else
minetest.chat_send_player(puncher:get_player_name(), "No room in your inventory to add a beer mug!")
end
end
end
})
minetest.register_craft({
output = "homedecor:beer_tap",
recipe = {
{ "group:stick","default:steel_ingot","group:stick" },
{ "homedecor:kitchen_faucet","default:steel_ingot","homedecor:kitchen_faucet" },
{ "default:steel_ingot","default:steel_ingot","default:steel_ingot" }
},
})
local beer_cbox = {
type = "fixed",
fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 }
}
homedecor.register("beer_mug", {
description = "Beer mug",
drawtype = "mesh",
mesh = "homedecor_beer_mug.obj",
tiles = { "homedecor_beer_mug.png" },
inventory_image = "homedecor_beer_mug_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = beer_cbox,
on_use = minetest.item_eat(2)
})
local svm_cbox = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}
}
homedecor.register("soda_machine", {
description = "Soda Vending Machine",
mesh = "homedecor_soda_machine.obj",
tiles = {"homedecor_soda_machine.png"},
groups = {snappy=3},
selection_box = svm_cbox,
collision_box = svm_cbox,
expand = { top="air" },
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item()
local wieldname = wielditem:get_name()
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} }
local fdir = node.param2
local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] }
if wieldname == "homedecor:coin" then
wielditem:take_item()
puncher:set_wielded_item(wielditem)
minetest.spawn_item(pos_drop, "homedecor:soda_can")
minetest.sound_play("insert_coin", {
pos=pos, max_hear_distance = 5
})
else
minetest.chat_send_player(puncher:get_player_name(), "Please insert a coin in the machine.")
end
end
})

View File

@ -54,12 +54,10 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
node2 = node2 or "air" -- this can be used to clear buildable_to nodes even though we are using a multinode mesh
minetest.set_node(pos2, { name = node2, param2 = (node2 ~= "air" and fdir) or nil })
-- temporary check if this is a locked node to set its infotext
local nodename = itemstack:get_name()
if string.find(nodename, "_locked") then
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer_name)
meta:set_string("infotext", S("Locked %s (owned by %s)"):format(minetest.registered_nodes[nodename].infotext, placer_name))
-- call after_place_node of the placed node if available
local ctrl_node_def = minetest.registered_nodes[node1]
if ctrl_node_def and ctrl_node_def.after_place_node then
ctrl_node_def.after_place_node(pos, placer)
end
if not homedecor.expect_infinite_stacks then

View File

@ -2,22 +2,14 @@
local S = homedecor.gettext
local function hacky_swap_node(pos,name)
local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
local meta = minetest.get_meta(pos)
local meta0 = meta:to_table()
if node.name == name then return end
node.name = name
local meta0 = meta:to_table()
minetest.set_node(pos,node)
meta = minetest.get_meta(pos)
meta:from_table(meta0)
minetest.swap_node(pos, node)
end
local function make_formspec(furnacedef, percent)
local fire
if percent and (percent > 0) then
@ -75,13 +67,15 @@ local function make_tiles(tiles, fmt, active)
return tiles
end
local furnace_can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("fuel")
and inv:is_empty("dst")
and inv:is_empty("src")
end
function homedecor.register_furnace(name, furnacedef)
local furnacedef = furnacedef
local tiles = make_tiles(furnacedef.tiles, furnacedef.tile_format, false)
local tiles_active = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true)
furnacedef.fire_fg = furnacedef.fire_bg or "default_furnace_fire_fg.png"
furnacedef.fire_bg = furnacedef.fire_bg or "default_furnace_fire_bg.png"
@ -90,45 +84,25 @@ function homedecor.register_furnace(name, furnacedef)
furnacedef.cook_speed = furnacedef.cook_speed or 1
local name_active = name.."_active"
local description = furnacedef.description or "Furnace"
local desc = furnacedef.description or "Furnace"
local def = {
description = furnacedef.description,
tiles = tiles,
paramtype2 = furnacedef.paramtype2 or "facedir",
groups = furnacedef.groups or {cracky=2},
legacy_facedir_simple = true,
sounds = furnacedef.sounds or default.node_sound_wood_defaults(),
on_construct = function(pos)
local furnace_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", make_formspec(furnacedef, 0))
meta:set_string("infotext", desc)
meta:set_string("infotext", description)
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", furnacedef.output_slots)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local furnace_allow_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("%s is empty"):format(desc))
meta:set_string("infotext", S("%s is empty"):format(description))
end
return stack:get_count()
else
@ -139,15 +113,15 @@ function homedecor.register_furnace(name, furnacedef)
elseif listname == "dst" then
return 0
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
end
local furnace_allow_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("%s is empty"):format(desc))
meta:set_string("infotext", S("%s is empty"):format(description))
end
return count
else
@ -158,77 +132,32 @@ function homedecor.register_furnace(name, furnacedef)
elseif to_list == "dst" then
return 0
end
end,
end
local def = {
description = description,
tiles = make_tiles(furnacedef.tiles, furnacedef.tile_format, false),
groups = furnacedef.groups or {cracky=2},
sounds = furnacedef.sounds or default.node_sound_wood_defaults(),
on_construct = furnace_construct,
can_dig = furnace_can_dig,
allow_metadata_inventory_put = furnace_allow_put,
allow_metadata_inventory_move = furnace_allow_move,
inventory = { lockable = true }
}
local def_active = {
description = furnacedef.description.." (active)",
tiles = tiles_active,
paramtype = furnacedef.paramtype,
paramtype2 = furnacedef.paramtype2 or "facedir",
description = description .. " (active)",
tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),
light_source = 8,
drop = name,
drop = "homedecor:" .. name,
groups = furnacedef.groups or {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = furnacedef.sounds or default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", make_formspec(furnacedef, 0))
meta:set_string("infotext", desc)
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", furnacedef.output_slots)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext",S("%s is empty"):format(desc))
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext",S("%s is empty"):format(desc))
end
return count
else
return 0
end
elseif to_list == "src" then
return count
elseif to_list == "dst" then
return 0
end
end,
on_construct = furnace_construct,
can_dig = furnace_can_dig,
allow_metadata_inventory_put = furnace_allow_put,
allow_metadata_inventory_move = furnace_allow_move,
inventory = { lockable = true }
}
if furnacedef.extra_nodedef_fields then
@ -238,11 +167,16 @@ function homedecor.register_furnace(name, furnacedef)
end
end
minetest.register_node(name, def)
minetest.register_node(name_active, def_active)
local name_active = name.."_active"
homedecor.register(name, def)
homedecor.register(name_active, def_active)
local name, name_active = "homedecor:"..name, "homedecor:"..name_active
minetest.register_abm({
nodenames = {name, name_active, name.."_locked", name_active.."_locked"},
label = "furnaces",
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
@ -281,8 +215,6 @@ function homedecor.register_furnace(name, furnacedef)
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
inv:set_stack("src", 1, aftercooked.items[1])
else
print(S("Could not insert '%s'"):format(cooked.item:to_string()))
end
meta:set_string("src_time", 0)
end
@ -296,7 +228,7 @@ function homedecor.register_furnace(name, furnacedef)
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent))
hacky_swap_node(pos,name_active..locked)
swap_node(pos,name_active..locked)
meta:set_string("formspec", make_formspec(furnacedef, percent))
return
end
@ -316,7 +248,7 @@ function homedecor.register_furnace(name, furnacedef)
if (not fuel) or (fuel.time <= 0) then
meta:set_string("infotext",desc..S(": Out of fuel"))
hacky_swap_node(pos,name..locked)
swap_node(pos, name..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
end
@ -324,7 +256,7 @@ function homedecor.register_furnace(name, furnacedef)
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext",S("%s is empty"):format(desc))
hacky_swap_node(pos,name..locked)
swap_node(pos, name..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
end
return
@ -332,7 +264,7 @@ function homedecor.register_furnace(name, furnacedef)
if not inv:room_for_item("dst", cooked.item) then
meta:set_string("infotext", desc..S(": output bins are full"))
hacky_swap_node(pos, name..locked)
swap_node(pos, name..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
end

View File

@ -0,0 +1,22 @@
local handlerpath = homedecor.modpath .. "/handlers/"
-- nodebox arithmetics and helpers
-- (please keep non-generic nodeboxes with their node definition)
dofile(handlerpath.."nodeboxes.lua")
-- expand and unexpand decor
dofile(handlerpath.."expansion.lua")
-- register nodes that cook stuff
dofile(handlerpath.."furnaces.lua")
-- inventory related functionality, like initialization, ownership and spawning locked versions
dofile(handlerpath.."inventory.lua")
-- glue it all together into a registration function
dofile(handlerpath.."registration.lua")
-- some nodes have particle spawners
dofile(handlerpath.."water_particles.lua")
dofile(handlerpath.."sit.lua")

View File

@ -1,161 +0,0 @@
-- Locked Stuff for Home Decor mod, by Kaeza
--
-- The code is mostly copypasta from default:chest_locked, with a few
-- tidbits to ease creation of new items, should need arise.
local S = homedecor.gettext
--[[
| create_locked ( name, infotext )
|
| Description:
| This function takes a base node name such as "homedecor:refrigerator",
| copies the definition from the original item into a new table, modifies
| it a bit, and registers a new node with a "_locked" suffix such as
| "homedecor:refrigerator_locked". The new node behaves identically to
| the base node, except that moving items to/from the node's inventory
| is only allowed for the original placer. In addition, it register a new
| shapeless recipe for the node, using the base node plus a steel ingot.
|
| Arguments:
| name The base node name
| infotext The infotext description (in case the name is too long).
|
| Example Usage:
| create_locked("homedecor:refrigerator", "Locked Fridge")
| ^ This generates a new "Locked Refrigerator" node, whose infotext is
| "Locked Fridge (owned by <placer>)".
|
| Notes:
| If <infotext> is not specified (or is nil), the infotext will be the
| base node's description prefixed by "Locked ".
|
| The ABM for the locked oven is defined in oven.lua.
]]
local function create_locked ( name, infotext )
local def = { }
for k, v in pairs(minetest.registered_nodes[name]) do
def[k] = v
end
def.type = nil
def.name = nil
def.description = S("%s (Locked)"):format(def.description)
local after_place_node = def.after_place_node
def.after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", S("%s (owned by %s)"):format(infotext,meta:get_string("owner")))
if (after_place_node) then
return after_place_node(pos, placer)
end
end
local allow_metadata_inventory_move = def.allow_metadata_inventory_move;
def.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if (player:get_player_name() ~= meta:get_string("owner")) then
minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format(
player:get_player_name(),
infotext,
meta:get_string("owner"),
minetest.pos_to_string(pos)
))
return 0
end
if (allow_metadata_inventory_move) then
return allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
else
return count
end
end
local allow_metadata_inventory_put = def.allow_metadata_inventory_put;
def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if (player:get_player_name() ~= meta:get_string("owner")) then
minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format(
player:get_player_name(),
infotext,
meta:get_string("owner"),
minetest.pos_to_string(pos)
))
return 0
end
if (allow_metadata_inventory_put) then
return allow_metadata_inventory_put(pos, listname, index, stack, player)
else
return stack:get_count()
end
end
local allow_metadata_inventory_take = def.allow_metadata_inventory_take;
def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if (player:get_player_name() ~= meta:get_string("owner")) then
minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format(
player:get_player_name(),
infotext,
meta:get_string("owner"),
minetest.pos_to_string(pos)
))
return 0
end
if (allow_metadata_inventory_take) then
return allow_metadata_inventory_take(pos, listname, index, stack, player)
else
return stack:get_count()
end
end
minetest.register_node(name.."_locked", def)
minetest.register_craft({
output = name.."_locked",
type = "shapeless",
recipe = {
name,
"default:steel_ingot",
}
})
end
local items = {
{ "refrigerator_white",
"Refrigerator" },
{ "refrigerator_steel",
"Refrigerator (stainless steel)" },
{ "kitchen_cabinet",
"Cabinet" },
{ "kitchen_cabinet_steel",
"Cabinet (stainless steel top)" },
{ "kitchen_cabinet_granite",
"Cabinet (granite top)" },
{ "kitchen_cabinet_marble",
"Cabinet (marble top)" },
{ "kitchen_cabinet_half",
"Cabinet" },
{ "kitchen_cabinet_with_sink",
"Cabinet" },
{ "nightstand_oak_one_drawer",
"Nightstand" },
{ "nightstand_oak_two_drawers",
"Nightstand" },
{ "nightstand_mahogany_one_drawer",
"Nightstand" },
{ "nightstand_mahogany_two_drawers",
"Nightstand" },
{ "filing_cabinet",
"Filing cabinet" },
{ "oven",
"Oven" },
{ "oven_active",
"Oven (active)" },
{ "oven_steel",
"Oven (stainless steel)" },
{ "oven_steel_active",
"Oven (stainless steel, active)" },
{ "microwave_oven",
"Microwave Oven" },
{ "microwave_oven_active",
"Microwave Oven (active)" },
}
for _,item in ipairs(items) do
local name, info = item[1], item[2];
create_locked("homedecor:"..name, S("Locked "..info));
end

View File

@ -4,8 +4,23 @@
-- a box is defined as {x1, y1, z1, x2, y2, z2}
homedecor.box = {
-- slab starting from -x (after rotation: left)
slab_x = function(depth) return { -0.5, -0.5, -0.5, -0.5+depth, 0.5, 0.5 } end,
-- bottom slab (starting from -y) with height optionally shifted upwards
slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end,
slab_z = function(depth) return { -0.5, -0.5, -0.5+depth, 0.5, 0.5, 0.5 } end,
-- slab starting from -z (+z with negative depth)
slab_z = function(depth)
-- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth,
-- but since conventionally a lot of nodes place slabs against +z for player convenience, we define
-- a "negative" depth as a depth extending from the other side, i.e. +z
if depth > 0 then
-- slab starting from -z
return { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5+depth }
else
-- slab starting from +z (z1=0.5-(-depth))
return { -0.5, -0.5, 0.5+depth, 0.5, 0.5, 0.5 }
end
end,
bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end,
cuboid = function(radius_x, radius_y, radius_z) return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z} end,
}
@ -16,6 +31,14 @@ homedecor.nodebox = {
-- { type="regular" },
regular = { type="regular" },
null = { type = "fixed", fixed = { 0, 0, 0, 0, 0, 0 } },
corner_xz = function(depth_x, depth_z) return {
type="fixed",
fixed={
homedecor.box.slab_x(depth_x),
homedecor.box.slab_z(depth_z),
-- { -0.5, -0.5, -0.5, 0.5-depth, 0.5, -0.5+depth } -- slab_x without the overlap, but actually looks a bit worse
}
} end,
}
local mt = {}

View File

@ -1,56 +1,10 @@
homedecor = homedecor or {}
local S = homedecor.gettext
local default_can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
return meta:get_inventory():is_empty("main")
end
local default_inventory_size = 32
local default_inventory_formspecs = {
["4"]="size[8,6]"..
"list[context;main;2,0;4,1;]"..
"list[current_player;main;0,2;8,4;]",
["6"]="size[8,6]"..
"list[context;main;1,0;6,1;]"..
"list[current_player;main;0,2;8,4;]",
["8"]="size[8,6]"..
"list[context;main;0,0;8,1;]"..
"list[current_player;main;0,2;8,4;]",
["12"]="size[8,7]"..
"list[context;main;1,0;6,2;]"..
"list[current_player;main;0,3;8,4;]",
["16"]="size[8,7]"..
"list[context;main;0,0;8,2;]"..
"list[current_player;main;0,3;8,4;]",
["24"]="size[8,8]"..
"list[context;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]",
["32"]="size[8,9]".. default.gui_bg .. default.gui_bg_img .. default.gui_slots ..
"list[context;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
default.get_hotbar_bg(0,4.85),
["50"]="size[10,10]"..
"list[context;main;0,0;10,5;]"..
"list[current_player;main;1,6;8,4;]",
}
local function get_formspec_by_size(size)
--TODO heuristic to use the "next best size"
local formspec = default_inventory_formspecs[tostring(size)]
return formspec or default_inventory_formspecs
end
--wrapper around minetest.register_node that sets sane defaults and interprets some specialized settings
function homedecor.register(name, def)
function homedecor.register(name, original_def)
local def = table.copy(original_def)
def.drawtype = def.drawtype
or (def.mesh and "mesh")
or (def.node_box and "nodebox")
@ -67,48 +21,17 @@ function homedecor.register(name, def)
def.paramtype2 = def.paramtype2 or "facedir"
end
homedecor.handle_inventory(name, def, original_def)
local infotext = def.infotext
--def.infotext = nil -- currently used to set locked refrigerator infotexts
-- handle inventory setting
-- inventory = {
-- size = 16
-- formspec = …
-- }
local inventory = def.inventory
def.inventory = nil
if inventory then
def.on_construct = def.on_construct or function(pos)
local meta = minetest.get_meta(pos)
if infotext then
meta:set_string("infotext", infotext)
end
local size = inventory.size or default_inventory_size
meta:get_inventory():set_size("main", size)
meta:set_string("formspec", inventory.formspec or get_formspec_by_size(size))
end
def.can_dig = def.can_dig or default_can_dig
def.on_metadata_inventory_move = def.on_metadata_inventory_move or function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", S("%s moves stuff in %s at %s"):format(
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_put = def.on_metadata_inventory_put or function(pos, listname, index, stack, player)
minetest.log("action", S("%s moves stuff to %s at %s"):format(
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_take = def.on_metadata_inventory_take or function(pos, listname, index, stack, player)
minetest.log("action", S("%s takes stuff from %s at %s"):format(
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
elseif infotext and not def.on_construct then
local on_construct = def.on_construct
def.on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", infotext)
if on_construct then on_construct(pos) end
end
end

View File

@ -7,52 +7,19 @@
-- The code for ovens, nightstands, refrigerators are basically modified
-- copies of the code for chests and furnaces.
homedecor = {}
local modpath = minetest.get_modpath("homedecor")
homedecor.debug = 0
-- detail level for roofing slopes and also cobwebs
homedecor.detail_level = 16
homedecor.modpath = minetest.get_modpath("homedecor")
homedecor = {
modpath = modpath,
-- Boilerplate to support localized strings if intllib mod is installed.
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
homedecor.gettext = S
-- debug
local dbg = function(s)
if homedecor.debug == 1 then
print('[HomeDecor] ' .. s)
end
end
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
-- infinite stacks
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
homedecor.expect_infinite_stacks = false
else
homedecor.expect_infinite_stacks = true
end
--table copy
function homedecor.table_copy(t)
local nt = { };
for k, v in pairs(t) do
if type(v) == "table" then
nt[k] = homedecor.table_copy(v)
else
nt[k] = v
end
end
return nt
end
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
}
-- Determine if the item being pointed at is the underside of a node (e.g a ceiling)
function homedecor.find_ceiling(itemstack, placer, pointed_thing)
-- most of this is copied from the rotate-and-place function in builtin
local unode = core.get_node_or_nil(pointed_thing.under)
@ -113,61 +80,55 @@ homedecor.white_wood = "(homedecor_generic_wood_plain.png^[colorize:#e0f0ff:200)
homedecor.dark_wood = "(homedecor_generic_wood_plain.png^[colorize:#140900:200)^"..
"(homedecor_generic_wood_boards_overlay.png^[colorize:#21110180:180)"
-- nodebox arithmetics and helpers
-- (please keep non-generic nodeboxes with their node definition)
dofile(homedecor.modpath.."/handlers/nodeboxes.lua")
-- expand and unexpand decor
dofile(homedecor.modpath.."/handlers/expansion.lua")
-- register nodes that cook stuff
dofile(homedecor.modpath.."/handlers/furnaces.lua")
-- glue it all together into a registration function
dofile(homedecor.modpath.."/handlers/registration.lua")
-- some nodes have particle spawners
dofile(homedecor.modpath.."/handlers/water_particles.lua")
dofile(homedecor.modpath.."/handlers/sit.lua")
-- load different handler subsystems
dofile(modpath.."/handlers/init.lua")
-- load various other components
dofile(homedecor.modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes
dofile(homedecor.modpath.."/tables.lua")
dofile(homedecor.modpath.."/electronics.lua")
dofile(homedecor.modpath.."/shutters.lua")
dofile(homedecor.modpath.."/shingles.lua")
dofile(homedecor.modpath.."/slopes.lua")
dofile(modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes
dofile(modpath.."/tables.lua")
dofile(modpath.."/electronics.lua")
dofile(modpath.."/shutters.lua")
dofile(homedecor.modpath.."/doors_and_gates.lua")
dofile(modpath.."/roofing.lua")
dofile(homedecor.modpath.."/fences.lua")
dofile(modpath.."/foyer.lua")
dofile(homedecor.modpath.."/lighting.lua")
dofile(modpath.."/doors_and_gates.lua")
dofile(homedecor.modpath.."/kitchen_appliances.lua")
dofile(homedecor.modpath.."/kitchen_furniture.lua")
dofile(modpath.."/fences.lua")
dofile(homedecor.modpath.."/bathroom_furniture.lua")
dofile(homedecor.modpath.."/bathroom_sanitation.lua")
dofile(modpath.."/lighting.lua")
dofile(homedecor.modpath.."/laundry.lua")
dofile(modpath.."/kitchen_appliances.lua")
dofile(modpath.."/kitchen_furniture.lua")
dofile(modpath.."/gastronomy.lua")
dofile(homedecor.modpath.."/nightstands.lua")
dofile(homedecor.modpath.."/clocks.lua")
dofile(homedecor.modpath.."/misc-electrical.lua")
dofile(modpath.."/bathroom_furniture.lua")
dofile(modpath.."/bathroom_sanitation.lua")
dofile(homedecor.modpath.."/window_treatments.lua")
dofile(modpath.."/bedroom.lua")
dofile(homedecor.modpath.."/furniture.lua")
dofile(homedecor.modpath.."/furniture_medieval.lua")
dofile(homedecor.modpath.."/furniture_recipes.lua")
dofile(homedecor.modpath.."/climate-control.lua")
dofile(modpath.."/laundry.lua")
dofile(homedecor.modpath.."/cobweb.lua")
dofile(homedecor.modpath.."/beds.lua")
dofile(homedecor.modpath.."/books.lua")
dofile(homedecor.modpath.."/exterior.lua")
dofile(homedecor.modpath.."/trash_cans.lua")
--dofile(homedecor.modpath.."/wardrobe.lua") --MFF crabman(30/07/2015) disabled wardrobe, duplicate with u_skin
dofile(modpath.."/office.lua")
dofile(homedecor.modpath.."/handlers/locked.lua")
dofile(modpath.."/clocks.lua")
dofile(modpath.."/electrics.lua")
dofile(homedecor.modpath.."/crafts.lua")
dofile(modpath.."/window_treatments.lua")
minetest.log("action", "[HomeDecor] "..S("Loaded!"))
dofile(modpath.."/furniture.lua")
dofile(modpath.."/furniture_medieval.lua")
dofile(modpath.."/furniture_recipes.lua")
dofile(modpath.."/climate-control.lua")
dofile(modpath.."/cobweb.lua")
dofile(modpath.."/books.lua")
dofile(modpath.."/exterior.lua")
dofile(modpath.."/trash_cans.lua")
dofile(modpath.."/wardrobe.lua")
dofile(modpath.."/crafts.lua")
print("[HomeDecor] " .. homedecor.gettext("Loaded!"))

View File

@ -35,7 +35,7 @@ homedecor.register("refrigerator_white", {
infotext=S("Refrigerator"),
inventory = {
size=50,
lockable=true
lockable=true,
},
on_rotate = screwdriver.rotate_simple
})
@ -53,7 +53,7 @@ minetest.register_alias("homedecor:refrigerator_steel_bottom_locked", "homedecor
minetest.register_alias("homedecor:refrigerator_steel_top_locked", "air")
-- kitchen "furnaces"
homedecor.register_furnace("homedecor:oven", {
homedecor.register_furnace("oven", {
description = S("Oven"),
tile_format = "homedecor_oven_%s%s.png",
output_slots = 4,
@ -61,7 +61,7 @@ homedecor.register_furnace("homedecor:oven", {
cook_speed = 1.25,
})
homedecor.register_furnace("homedecor:oven_steel", {
homedecor.register_furnace("oven_steel", {
description = S("Oven (stainless steel)"),
tile_format = "homedecor_oven_steel_%s%s.png",
output_slots = 4,
@ -69,7 +69,7 @@ homedecor.register_furnace("homedecor:oven_steel", {
cook_speed = 1.25,
})
homedecor.register_furnace("homedecor:microwave_oven", {
homedecor.register_furnace("microwave_oven", {
description = S("Microwave Oven"),
tiles = {
"homedecor_microwave_top.png", "homedecor_microwave_top.png^[transformR180",
@ -85,11 +85,9 @@ homedecor.register_furnace("homedecor:microwave_oven", {
output_width = 2,
cook_speed = 1.5,
extra_nodedef_fields = {
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = { { -0.5, -0.5, -0.125, 0.5, 0.125, 0.5 } },
fixed = { -0.5, -0.5, -0.125, 0.5, 0.125, 0.5 },
},
},
})
@ -129,6 +127,7 @@ local fdir_to_steampos = {
minetest.register_abm({
nodenames = "homedecor:coffee_maker",
label = "sfx",
interval = 2,
chance = 1,
action = function(pos, node)

View File

@ -29,6 +29,7 @@ for _, mat in ipairs(counter_materials) do
infotext=S("Kitchen Cabinet"),
inventory = {
size=24,
lockable=true,
},
})
end
@ -51,6 +52,7 @@ homedecor.register("kitchen_cabinet_half", {
infotext=S("Kitchen Cabinet"),
inventory = {
size=12,
lockable=true,
},
})
@ -68,6 +70,7 @@ homedecor.register("kitchen_cabinet_with_sink", {
infotext=S("Under-sink cabinet"),
inventory = {
size=16,
lockable=true,
},
node_box = {
type = "fixed",

View File

@ -81,7 +81,7 @@ homedecor.register("glowlight_half_"..color, {
selection_box = glowlight_nodebox.half,
node_box = glowlight_nodebox.half,
groups = { snappy = 3 },
light_source = LIGHT_MAX,
light_source = default.LIGHT_MAX,
sounds = default.node_sound_glass_defaults(),
on_place = minetest.rotate_node
})
@ -99,7 +99,7 @@ homedecor.register("glowlight_quarter_"..color, {
selection_box = glowlight_nodebox.quarter,
node_box = glowlight_nodebox.quarter,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
on_place = minetest.rotate_node
})
@ -119,7 +119,7 @@ homedecor.register("glowlight_small_cube_"..color, {
selection_box = glowlight_nodebox.small_cube,
node_box = glowlight_nodebox.small_cube,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
on_place = minetest.rotate_node
})
@ -137,7 +137,7 @@ homedecor.register("plasma_lamp", {
}
},
use_texture_alpha = true,
light_source = LIGHT_MAX - 1,
light_source = default.LIGHT_MAX - 1,
sunlight_propagates = true,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
@ -164,7 +164,7 @@ homedecor.register("plasma_ball", {
},
walkable = false,
use_texture_alpha = true,
light_source = LIGHT_MAX - 5,
light_source = default.LIGHT_MAX - 5,
sunlight_propagates = true,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
@ -188,7 +188,7 @@ homedecor.register("candle", {
selection_box = tc_cbox,
walkable = false,
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
light_source = default.LIGHT_MAX-4,
})
local c_cbox = {
@ -209,7 +209,7 @@ homedecor.register("candle_thin", {
selection_box = c_cbox,
walkable = false,
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
light_source = default.LIGHT_MAX-4,
})
local cs_cbox = {
@ -231,7 +231,7 @@ homedecor.register("candlestick_wrought_iron", {
selection_box = cs_cbox,
walkable = false,
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
light_source = default.LIGHT_MAX-4,
})
homedecor.register("candlestick_brass", {
@ -246,7 +246,7 @@ homedecor.register("candlestick_brass", {
selection_box = cs_cbox,
walkable = false,
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
light_source = default.LIGHT_MAX-4,
})
homedecor.register("wall_sconce", {
@ -265,7 +265,7 @@ homedecor.register("wall_sconce", {
},
walkable = false,
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
light_source = default.LIGHT_MAX-4,
})
local ol_cbox = {
@ -291,7 +291,7 @@ homedecor.register("oil_lamp", {
selection_box = ol_cbox,
walkable = false,
groups = { snappy = 3 },
light_source = LIGHT_MAX-3,
light_source = default.LIGHT_MAX-3,
sounds = default.node_sound_glass_defaults(),
})
@ -303,7 +303,7 @@ homedecor.register("oil_lamp_tabletop", {
selection_box = ol_cbox,
collision_box = ol_cbox,
groups = { snappy = 3 },
light_source = LIGHT_MAX-3,
light_source = default.LIGHT_MAX-3,
sounds = default.node_sound_glass_defaults(),
})
@ -367,7 +367,7 @@ homedecor.register("lattice_lantern_large", {
description = S("Lattice lantern (large)"),
tiles = { 'homedecor_lattice_lantern_large.png' },
groups = { snappy = 3 },
light_source = LIGHT_MAX,
light_source = default.LIGHT_MAX,
sounds = default.node_sound_glass_defaults(),
})
@ -387,7 +387,7 @@ homedecor.register("lattice_lantern_small", {
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
on_place = minetest.rotate_node
})
@ -535,7 +535,7 @@ homedecor.register("ceiling_lamp", {
"homedecor_generic_plastic_black.png^[colorize:#442d04:200",
},
inventory_image = "homedecor_ceiling_lamp_inv.png",
light_source = LIGHT_MAX,
light_source = default.LIGHT_MAX,
groups = {snappy=3},
walkable = false,
on_punch = function(pos, node, puncher)

2
mods/homedecor_modpack/homedecor/locale/de.txt Executable file → Normal file
View File

@ -202,8 +202,6 @@ Two-drawer Nightstand = Nachttisch mit zwei Schubladen
### oven.lua ###
Oven = Herd
Microwave Oven = Mikrowelle
## 1: Item descrition
Could not insert '%s' = Kann '%s' nicht einfuegen
## 1: Item description, 2: Percentage
%s active: %d%% = %s ist aktiv: %d%%
## 1: Item description

2
mods/homedecor_modpack/homedecor/locale/es.txt Executable file → Normal file
View File

@ -167,8 +167,6 @@ Two-drawer Nightstand = Mesa de Noche de dos Cajones
### oven.lua ###
Oven = Estufa
## 1: Item name
Could not insert '%s' = No se pudo insertar '%s'
## 1: Percentage
Oven active: %d%% = Estufa activa: %d%%
Oven out of fuel = Estufa sin combustible

2
mods/homedecor_modpack/homedecor/locale/fr.txt Executable file → Normal file
View File

@ -154,8 +154,6 @@ Two-drawer Nightstand = Table de chevet avec deux tiroirs
### oven.lua ###
Oven = Four
## 1: Item name
Could not insert '%s' = Ne peut insérer '%s'
## 1: Percentage
Oven active: %d%% = Four actif : %d%%
Oven out of fuel = Four sans carburant

2
mods/homedecor_modpack/homedecor/locale/pt.txt Executable file → Normal file
View File

@ -171,8 +171,6 @@ Two-drawer Nightstand = Criado-mudo com duas gavetas
### oven.lua ###
Oven = Forno
## 1: Item name
Could not insert '%s' = Não foi possível inserir '%s'
## 1: Percentage
Oven active: %d%% = Forno ativo: %d%%
Oven out of fuel = O forno está sem combustível

2
mods/homedecor_modpack/homedecor/locale/template.txt Executable file → Normal file
View File

@ -203,8 +203,6 @@ Two-drawer Nightstand =
### oven.lua ###
Oven =
Microwave Oven =
## 1: Item descrition
Could not insert '%s' =
## 1: Item description, 2: Percentage
%s active: %d%% =
## 1: Item description

View File

@ -26,8 +26,8 @@ homedecor.register("ceiling_tile", {
local rug_types = {
{ "small", "homedecor_small_rug.obj" },
{ "large", { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 } },
{ "persian", { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 } }
{ "large", homedecor.box.slab_y(0.0625)},
{ "persian", homedecor.box.slab_y(0.0625)}
}
for i in ipairs(rug_types) do
@ -158,39 +158,6 @@ homedecor.register("pole_wrought_iron", {
sounds = default.node_sound_wood_defaults(),
})
local welcome_mat_colors = { "green", "brown", "grey" }
for _, color in ipairs(welcome_mat_colors) do
homedecor.register("welcome_mat_"..color, {
description = "Welcome Mat ("..color..")",
tiles = {
"homedecor_welcome_mat_"..color..".png",
"homedecor_welcome_mat_bottom.png",
"homedecor_welcome_mat_"..color..".png",
},
groups = {crumbly=3},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.375, 0.5, -0.46875, 0.375 }
}
})
end
homedecor.register("chimney", {
description = "Chimney",
mesh = "homedecor_chimney.obj",
tiles = {
"homedecor_chimney_tb.png",
"default_brick.png"
},
selection_box = homedecor.nodebox.bar_y(0.25),
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})
local ft_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.375, 0.5, 0.3125, 0.375 }
@ -282,27 +249,11 @@ homedecor.register("dvd_cd_cabinet", {
"homedecor_dvdcd_cabinet_front.png",
"homedecor_dvdcd_cabinet_back.png"
},
selection_box = homedecor.nodebox.slab_z(0.5),
selection_box = homedecor.nodebox.slab_z(-0.5),
groups = {choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
})
homedecor.register("filing_cabinet", {
description = S("Filing Cabinet"),
mesh = "homedecor_filing_cabinet.obj",
tiles = {
homedecor.plain_wood,
"homedecor_filing_cabinet_front.png",
"homedecor_filing_cabinet_bottom.png"
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
infotext=S("Filing cabinet"),
inventory = {
size=16,
},
})
local pooltable_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.3125, 1.5 }
@ -329,143 +280,6 @@ homedecor.register("pool_table", {
minetest.register_alias("homedecor:pool_table_2", "air")
homedecor.register("coatrack_wallmount", {
tiles = { homedecor.plain_wood },
inventory_image = "homedecor_coatrack_wallmount_inv.png",
description = "Coatrack (wallmounted)",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.375, 0, 0.4375, 0.375, 0.14, 0.5}, -- NodeBox1
{-0.3025, 0.0475, 0.375, -0.26, 0.09, 0.4375}, -- NodeBox2
{0.26, 0.0475, 0.375, 0.3025, 0.09, 0.4375}, -- NodeBox3
{0.0725, 0.0475, 0.375, 0.115, 0.09, 0.4375}, -- NodeBox4
{-0.115, 0.0475, 0.375, -0.0725, 0.09, 0.4375}, -- NodeBox5
{0.24, 0.025, 0.352697, 0.3225, 0.115, 0.375}, -- NodeBox6
{-0.3225, 0.025, 0.352697, -0.24, 0.115, 0.375}, -- NodeBox7
{-0.135, 0.025, 0.352697, -0.0525, 0.115, 0.375}, -- NodeBox8
{0.0525, 0.025, 0.352697, 0.135, 0.115, 0.375}, -- NodeBox9
}
},
})
homedecor.register("coat_tree", {
mesh = "homedecor_coatrack.obj",
tiles = {
homedecor.plain_wood,
"homedecor_generic_wood_old.png"
},
inventory_image = "homedecor_coatrack_inv.png",
description = "Coat tree",
groups = {snappy=3},
sounds = default.node_sound_wood_defaults(),
expand = { top="air" },
walkable = false,
selection_box = {
type = "fixed",
fixed = { -0.4, -0.5, -0.4, 0.4, 1.5, 0.4 }
},
on_rotate = screwdriver.rotate_simple
})
local cutlery_cbox = {
type = "fixed",
fixed = {
{ -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 },
{ -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 }
}
}
homedecor.register("cutlery_set", {
drawtype = "mesh",
mesh = "homedecor_cutlery_set.obj",
tiles = { "homedecor_cutlery_set.png" },
inventory_image = "homedecor_cutlery_set_inv.png",
description = "Cutlery set",
groups = {snappy=3},
selection_box = cutlery_cbox,
walkable = false,
sounds = default.node_sound_glass_defaults(),
})
local bottle_cbox = {
type = "fixed",
fixed = {
{ -0.125, -0.5, -0.125, 0.125, 0, 0.125}
}
}
local fbottle_cbox = {
type = "fixed",
fixed = {
{ -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 }
}
}
local bottle_colors = {"brown", "green"}
for _, b in ipairs(bottle_colors) do
homedecor.register("bottle_"..b, {
tiles = { "homedecor_bottle_"..b..".png" },
inventory_image = "homedecor_bottle_"..b.."_inv.png",
description = "Bottle ("..b..")",
mesh = "homedecor_bottle.obj",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
selection_box = bottle_cbox
})
-- 4-bottle sets
homedecor.register("4_bottles_"..b, {
tiles = {
"homedecor_bottle_"..b..".png",
"homedecor_bottle_"..b..".png"
},
inventory_image = "homedecor_4_bottles_"..b.."_inv.png",
description = "Four "..b.." bottles",
mesh = "homedecor_4_bottles.obj",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
selection_box = fbottle_cbox
})
end
homedecor.register("4_bottles_multi", {
tiles = {
"homedecor_bottle_brown.png",
"homedecor_bottle_green.png"
},
inventory_image = "homedecor_4_bottles_multi_inv.png",
description = "Four misc brown/green bottles",
mesh = "homedecor_4_bottles.obj",
groups = {snappy=3},
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = fbottle_cbox
})
homedecor.register("dartboard", {
description = "Dartboard",
mesh = "homedecor_dartboard.obj",
tiles = { "homedecor_dartboard.png" },
inventory_image = "homedecor_dartboard_inv.png",
wield_image = "homedecor_dartboard_inv.png",
paramtype2 = "wallmounted",
walkable = false,
selection_box = {
type = "wallmounted",
},
groups = {choppy=2,dig_immediate=2,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_wood_defaults(),
})
local piano_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.125, 1.5, 0.5, 0.5 }
@ -548,56 +362,6 @@ homedecor.register("skateboard", {
on_place = minetest.rotate_node
})
homedecor.register("beer_tap", {
description = "Beer tap",
mesh = "homedecor_beer_taps.obj",
tiles = {
"homedecor_generic_metal_bright.png",
"homedecor_generic_metal_black.png",
},
inventory_image = "homedecor_beertap_inv.png",
groups = { snappy=3 },
walkable = false,
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 }
},
on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item()
local inv = puncher:get_inventory()
local wieldname = wielditem:get_name()
if wieldname == "vessels:drinking_glass" then
if inv:room_for_item("main", "homedecor:beer_mug 1") then
wielditem:take_item()
puncher:set_wielded_item(wielditem)
inv:add_item("main", "homedecor:beer_mug 1")
minetest.chat_send_player(puncher:get_player_name(), "Ahh, a frosty cold beer - look in your inventory for it!")
else
minetest.chat_send_player(puncher:get_player_name(), "No room in your inventory to add a beer mug!")
end
end
end
})
local beer_cbox = {
type = "fixed",
fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 }
}
homedecor.register("beer_mug", {
description = "Beer mug",
drawtype = "mesh",
mesh = "homedecor_beer_mug.obj",
tiles = { "homedecor_beer_mug.png" },
inventory_image = "homedecor_beer_mug_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = beer_cbox,
on_use = minetest.item_eat(2)
})
homedecor.register("tool_cabinet", {
description = "Metal tool cabinet and work table",
mesh = "homedecor_tool_cabinet.obj",
@ -622,74 +386,6 @@ homedecor.register("tool_cabinet", {
minetest.register_alias("homedecor:tool_cabinet_bottom", "homedecor:tool_cabinet")
minetest.register_alias("homedecor:tool_cabinet_top", "air")
homedecor.register("calendar", {
description = "Calendar",
mesh = "homedecor_calendar.obj",
tiles = {"homedecor_calendar.png"},
inventory_image = "homedecor_calendar_inv.png",
wield_image = "homedecor_calendar_inv.png",
paramtype2 = "wallmounted",
walkable = false,
selection_box = {
type = "wallmounted",
wall_side = { -8/16, -8/16, -4/16, -5/16, 5/16, 4/16 },
wall_bottom = { -4/16, -8/16, -8/16, 4/16, -5/16, 5/16 },
wall_top = { -4/16, 5/16, -8/16, 4/16, 8/16, 5/16 }
},
groups = {choppy=2,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local date = os.date("%Y-%m-%d") -- ISO 8601 format
meta:set_string("infotext", "Date (right-click to update):\n"..date)
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
local date = os.date("%Y-%m-%d")
meta:set_string("infotext", "Date (right-click to update):\n"..date)
end
})
local globe_cbox = {
type = "fixed",
fixed = { -0.4, -0.5, -0.3, 0.3, 0.3, 0.3 }
}
homedecor.register("desk_globe", {
description = "Desk globe",
mesh = "homedecor_desk_globe.obj",
tiles = {
"homedecor_generic_wood_red.png",
"homedecor_generic_metal_black.png^[brighten",
"homedecor_earth.png"
},
inventory_image = "homedecor_desk_globe_inv.png",
selection_box = globe_cbox,
collision_box = globe_cbox,
groups = {choppy=2},
walkable = false,
sounds = default.node_sound_wood_defaults(),
})
local wine_cbox = homedecor.nodebox.slab_z(0.25)
homedecor.register("wine_rack", {
description = "Wine Rack",
mesh = "homedecor_wine_rack.obj",
tiles = {
"homedecor_generic_wood_red.png",
"homedecor_bottle_brown.png",
"homedecor_bottle_brown2.png",
"homedecor_bottle_brown3.png",
"homedecor_bottle_brown4.png"
},
inventory_image = "homedecor_wine_rack_inv.png",
groups = {choppy=2},
selection_box = wine_cbox,
collision_box = wine_cbox,
sounds = default.node_sound_defaults(),
})
local pframe_cbox = {
type = "fixed",
fixed = { -0.18, -0.5, -0.08, 0.18, -0.08, 0.18 }
@ -887,11 +583,11 @@ homedecor.register("spiral_staircase", {
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
local belownode = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z })
if belownode and belownode.name == "homedecor:spiral_staircase" then
if newnode.name ~= "homedecor:spiral_staircase"
and belownode
and belownode.name == "homedecor:spiral_staircase" then
minetest.set_node(pos, { name = "air" })
local newpos = { x = pos.x, y = pos.y + 2, z = pos.z }
@ -905,37 +601,3 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
end
end
end)
local svm_cbox = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}
}
homedecor.register("soda_machine", {
description = "Soda Vending Machine",
mesh = "homedecor_soda_machine.obj",
tiles = {"homedecor_soda_machine.png"},
groups = {snappy=3},
selection_box = svm_cbox,
collision_box = svm_cbox,
expand = { top="air" },
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item()
local wieldname = wielditem:get_name()
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} }
local fdir = node.param2
local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] }
if wieldname == "homedecor:coin" then
wielditem:take_item()
puncher:set_wielded_item(wielditem)
minetest.spawn_item(pos_drop, "homedecor:soda_can")
minetest.sound_play("insert_coin", {
pos=pos, max_hear_distance = 5
})
else
minetest.chat_send_player(puncher:get_player_name(), "Please insert a coin in the machine.")
end
end
})

View File

@ -1,60 +0,0 @@
local S = homedecor.gettext
local woods = {"mahogany", "oak"}
for _, w in ipairs(woods) do
homedecor.register("nightstand_"..w.."_one_drawer", {
description = S("Nightstand with One Drawer ("..w..")"),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
'homedecor_nightstand_'..w..'_lr.png',
'homedecor_nightstand_'..w..'_back.png',
'homedecor_nightstand_'..w..'_1_drawer_front.png'},
node_box = {
type = "fixed",
fixed = {
{ -8/16, 0, -30/64, 8/16, 8/16, 8/16 }, -- top half
{ -7/16, 1/16, -32/64, 7/16, 7/16, -29/64}, -- drawer face
{ -8/16, -8/16, -30/64, -7/16, 0, 8/16 }, -- left
{ 7/16, -8/16, -30/64, 8/16, 0, 8/16 }, -- right
{ -8/16, -8/16, 7/16, 8/16, 0, 8/16 }, -- back
{ -8/16, -8/16, -30/64, 8/16, -7/16, 8/16 } -- bottom
}
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = { type = "regular" },
infotext=S("One-drawer Nightstand"),
inventory = {
size=8,
},
})
homedecor.register("nightstand_"..w.."_two_drawers", {
description = S("Nightstand with Two Drawers ("..w..")"),
tiles = { 'homedecor_nightstand_'..w..'_tb.png',
'homedecor_nightstand_'..w..'_tb.png^[transformFY',
'homedecor_nightstand_'..w..'_lr.png^[transformFX',
'homedecor_nightstand_'..w..'_lr.png',
'homedecor_nightstand_'..w..'_back.png',
'homedecor_nightstand_'..w..'_2_drawer_front.png'},
node_box = {
type = "fixed",
fixed = {
{ -8/16, -8/16, -30/64, 8/16, 8/16, 8/16 }, -- main body
{ -7/16, 1/16, -32/64, 7/16, 7/16, -29/64 }, -- top drawer face
{ -7/16, -7/16, -32/64, 7/16, -1/16, -29/64 }, -- bottom drawer face
}
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = { type = "regular" },
infotext=S("Two-drawer Nightstand"),
inventory = {
size=16,
},
})
end

View File

@ -0,0 +1,118 @@
local S = homedecor.gettext
homedecor.register("filing_cabinet", {
description = S("Filing Cabinet"),
mesh = "homedecor_filing_cabinet.obj",
tiles = {
homedecor.plain_wood,
"homedecor_filing_cabinet_front.png",
"homedecor_filing_cabinet_bottom.png"
},
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
infotext=S("Filing cabinet"),
inventory = {
size=16,
lockable=true,
},
})
local desk_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 }
}
homedecor.register("desk", {
description = "Desk",
mesh = "homedecor_desk.obj",
tiles = {
homedecor.plain_wood,
"homedecor_desk_drawers.png",
"homedecor_generic_metal_black.png",
},
inventory_image = "homedecor_desk_inv.png",
selection_box = desk_cbox,
collision_box = desk_cbox,
sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 },
expand = { right="air" },
inventory = {
size=24,
lockable=true,
},
})
minetest.register_alias("homedecor:desk_r", "air")
local globe_cbox = {
type = "fixed",
fixed = { -0.4, -0.5, -0.3, 0.3, 0.3, 0.3 }
}
homedecor.register("desk_globe", {
description = "Desk globe",
mesh = "homedecor_desk_globe.obj",
tiles = {
"homedecor_generic_wood_red.png",
"homedecor_generic_metal_black.png^[brighten",
"homedecor_earth.png"
},
inventory_image = "homedecor_desk_globe_inv.png",
selection_box = globe_cbox,
collision_box = globe_cbox,
groups = {choppy=2},
walkable = false,
sounds = default.node_sound_wood_defaults(),
})
homedecor.register("calendar", {
description = "Calendar",
mesh = "homedecor_calendar.obj",
tiles = {"homedecor_calendar.png"},
inventory_image = "homedecor_calendar_inv.png",
wield_image = "homedecor_calendar_inv.png",
paramtype2 = "wallmounted",
walkable = false,
selection_box = {
type = "wallmounted",
wall_side = { -8/16, -8/16, -4/16, -5/16, 5/16, 4/16 },
wall_bottom = { -4/16, -8/16, -8/16, 4/16, -5/16, 5/16 },
wall_top = { -4/16, 5/16, -8/16, 4/16, 8/16, 5/16 }
},
groups = {choppy=2,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
infotext = "Date (right-click to update):\n" .. os.date("%Y-%m-%d"), -- ISO 8601 format
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
local date = os.date("%Y-%m-%d")
meta:set_string("infotext", "Date (right-click to update):\n"..date)
end
})
local ofchairs_sbox = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
}
local ofchairs_cbox = {
type = "fixed",
fixed = {
{ -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
{ -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
{ -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
{ -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
}
}
for _, c in pairs({"basic", "upscale"}) do
homedecor.register("office_chair_"..c, {
description = "Office chair ("..c..")",
drawtype = "mesh",
tiles = { "homedecor_office_chair_"..c..".png" },
mesh = "homedecor_office_chair_"..c..".obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = ofchairs_sbox,
collision_box = ofchairs_cbox,
expand = { top = "air" },
on_rotate = screwdriver.rotate_simple
})
end

View File

@ -1,5 +1,45 @@
local S = homedecor.gettext
minetest.register_node("homedecor:skylight", {
description = S("Glass Skylight"),
drawtype = "raillike",
tiles = { "default_glass.png" },
wield_image = "default_glass.png",
inventory_image = "homedecor_skylight_inv.png",
groups = { snappy = 3 },
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
selection_box = homedecor.nodebox.slab_y(0.1),
})
minetest.register_node("homedecor:skylight_frosted", {
description = S("Glass Skylight Frosted"),
drawtype = "raillike",
tiles = { "homedecor_skylight_frosted.png" },
wield_image = "homedecor_skylight_frosted.png",
inventory_image = "homedecor_skylight_frosted_inv.png",
use_texture_alpha = true,
groups = { snappy = 3 },
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
selection_box = homedecor.nodebox.slab_y(0.1),
})
for _, s in pairs({"asphalt", "terracotta", "wood"}) do
minetest.register_node("homedecor:shingles_"..s, {
description = S("Shingles ("..s..")"),
drawtype = "raillike",
tiles = { "homedecor_shingles_"..s..".png" },
wield_image = "homedecor_shingles_"..s..".png",
inventory_image = "homedecor_shingles_"..s.."_inv.png",
paramtype = "light",
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = homedecor.nodebox.slab_y(0.1),
})
end
local slope_cbox = {
type = "fixed",
fixed = {
@ -34,7 +74,6 @@ local icorner_cbox = {
}
homedecor.register_outer_corner = function(modname, subname, groups, slope_image, description)
local tiles = slope_image
if type(slope_image) ~= "table" then
@ -57,7 +96,6 @@ homedecor.register_outer_corner = function(modname, subname, groups, slope_image
end
homedecor.register_inner_corner = function(modname, subname, groups, slope_image, description)
local tiles = slope_image
if type(slope_image) ~= "table" then
@ -79,7 +117,6 @@ homedecor.register_inner_corner = function(modname, subname, groups, slope_image
end
homedecor.register_slope = function(modname, subname, recipeitem, groups, slope_image, description)
local tiles = slope_image
if type(slope_image) ~= "table" then
@ -219,25 +256,19 @@ end
-- corners
homedecor.register_roof(
"homedecor",
"wood",
homedecor.register_roof("homedecor", "wood",
{ snappy = 3 },
{ "homedecor_shingles_wood.png" },
"Wood Shingles"
)
homedecor.register_roof(
"homedecor",
"asphalt",
homedecor.register_roof("homedecor", "asphalt",
{ snappy = 3 },
{ "homedecor_shingles_asphalt.png" },
"Asphalt Shingles"
)
homedecor.register_roof(
"homedecor",
"terracotta",
homedecor.register_roof("homedecor", "terracotta",
{ snappy = 3 },
{ "homedecor_shingles_terracotta.png" },
"Terracotta Shingles"
@ -245,39 +276,43 @@ homedecor.register_roof(
-- register just the slopes
homedecor.register_slope(
"homedecor",
"wood",
homedecor.register_slope("homedecor", "wood",
"homedecor:shingles_wood",
{ snappy = 3 },
{ "homedecor_shingles_wood.png" },
"Wood Shingles"
)
homedecor.register_slope(
"homedecor",
"asphalt",
homedecor.register_slope("homedecor", "asphalt",
"homedecor:shingles_asphalt",
{ snappy = 3 },
{ "homedecor_shingles_asphalt.png" },
"Asphalt Shingles"
)
homedecor.register_slope(
"homedecor",
"terracotta",
homedecor.register_slope("homedecor", "terracotta",
"homedecor:shingles_terracotta",
{ snappy = 3 },
{ "homedecor_shingles_terracotta.png" },
"Terracotta Shingles"
)
homedecor.register_slope(
"homedecor",
"glass",
homedecor.register_slope("homedecor", "glass",
"homedecor:shingles_glass",
{ snappy = 3 },
{ "homedecor_shingles_glass.png", "homedecor_shingles_wood.png" },
"Glass Shingles"
)
homedecor.register("chimney", {
description = "Chimney",
mesh = "homedecor_chimney.obj",
tiles = {
"homedecor_chimney_tb.png",
"default_brick.png"
},
selection_box = homedecor.nodebox.bar_y(0.25),
groups = {cracky=3},
sounds = default.node_sound_stone_defaults()
})

View File

@ -1,43 +0,0 @@
local S = homedecor.gettext
minetest.register_node("homedecor:skylight", {
description = S("Glass Skylight"),
drawtype = "raillike",
tiles = { "default_glass.png" },
wield_image = "default_glass.png",
inventory_image = "homedecor_skylight_inv.png",
groups = { snappy = 3 },
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
selection_box = homedecor.nodebox.slab_y(0.1),
})
minetest.register_node("homedecor:skylight_frosted", {
description = S("Glass Skylight Frosted"),
drawtype = "raillike",
tiles = { "homedecor_skylight_frosted.png" },
wield_image = "homedecor_skylight_frosted.png",
inventory_image = "homedecor_skylight_frosted_inv.png",
use_texture_alpha = true,
groups = { snappy = 3 },
paramtype = "light",
sounds = default.node_sound_glass_defaults(),
selection_box = homedecor.nodebox.slab_y(0.1),
})
local materials = {"asphalt", "terracotta", "wood", "glass"}
for _, s in ipairs(materials) do
minetest.register_node("homedecor:shingles_"..s, {
description = S("Shingles ("..s..")"),
drawtype = "raillike",
tiles = { "homedecor_shingles_"..s..".png" },
wield_image = "homedecor_shingles_"..s..".png",
inventory_image = "homedecor_shingles_"..s.."_inv.png",
paramtype = "light",
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = homedecor.nodebox.slab_y(0.1),
})
end

View File

@ -187,29 +187,3 @@ homedecor.register("utility_table_legs", {
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
},
})
local desk_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 }
}
homedecor.register("desk", {
description = "Desk",
mesh = "homedecor_desk.obj",
tiles = {
homedecor.plain_wood,
"homedecor_desk_drawers.png",
"homedecor_generic_metal_black.png",
},
inventory_image = "homedecor_desk_inv.png",
selection_box = desk_cbox,
collision_box = desk_cbox,
sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 },
expand = { right="air" },
inventory = {
size=24,
},
})
minetest.register_alias("homedecor:desk_r", "air")

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

View File

@ -30,39 +30,18 @@ homedecor.register("trash_can_green_open", {
on_punch = function(pos, node, puncher, pointed_thing)
minetest.set_node(pos, {name = "homedecor:trash_can_green", param2 = node.param2})
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,9]".. default.gui_bg .. default.gui_bg_img .. default.gui_slots ..
infotext="Trash Can",
inventory= {
size = 9,
formspec = "size[8,9]" .. default.gui_bg .. default.gui_bg_img .. default.gui_slots ..
"button[2.5,3.8;3,1;empty;Empty Trash]"..
"list[current_name;main;2.5,0.5;3,3;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Trash Can")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in trash can at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff in trash can at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from trash can at "..minetest.pos_to_string(pos))
end,
"list[context;main;2.5,0.5;3,3;]"..
"list[current_player;main;0,5;8,4;]",
},
on_receive_fields = function(pos, formname, fields, sender)
if fields.empty then
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_list("main", {})
meta:get_inventory():set_list("main", {})
minetest.sound_play("homedecor_trash_all", {to_player=sender:get_player_name(), gain = 1.0})
end
end

View File

@ -20,6 +20,10 @@ homedecor.register("wardrobe", {
sounds = default.node_sound_wood_defaults(),
expand = { top="air" },
on_rotate = screwdriver.rotate_simple,
infotext = "Wardrobe",
inventory = {
size = 10
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local skins = {"male1", "male2", "male3", "male4", "male5"}
@ -30,33 +34,12 @@ homedecor.register("wardrobe", {
"image_button_exit["..(i-1)..".5,0;1.1,2;homedecor_clothes_"..skins[i].."_preview.png;"..skins[i]..";]"..
"image_button_exit["..(i-1)..".5,2;1.1,2;homedecor_clothes_fe"..skins[i].."_preview.png;fe"..skins[i]..";]"
end
meta:set_string("formspec", "size[5.5,8.5]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
"vertlabel[0,0.5;CLOTHES]"..
clothes_strings..
"vertlabel[0,5.2;STORAGE]"..
"list[current_name;main;0.5,4.5;5,2;]"..
"list[current_player;main;0.5,6.8;5,2;]")
meta:set_string("infotext", "Wardrobe")
local inv = meta:get_inventory()
inv:set_size("main", 5*2)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in wardrobe at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff in wardrobe at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from wardrobe at "..minetest.pos_to_string(pos))
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)

View File

@ -1007,7 +1007,6 @@ minetest.register_craft( {
},
}) ]]-- Removed. Item "steel:sheet_metal" is unknown //MFF(Mg|08/09/15)
minetest.register_craft( {
output = "signs:sign_wall_white_red 4",
recipe = {
@ -1024,7 +1023,6 @@ minetest.register_craft( {
},
}) ]]-- Removed. Item "steel:sheet_metal" is unknown //MFF(Mg|08/09/15)
minetest.register_craft( {
output = "signs:sign_wall_white_black 4",
recipe = {
@ -1041,7 +1039,6 @@ minetest.register_craft( {
},
}) ]]-- Removed. Item "steel:sheet_metal" is unknown //MFF(Mg|08/09/15)
minetest.register_craft( {
output = "signs:sign_wall_orange 4",
recipe = {