Update homedecor

master
CraigyDavi 2014-09-08 17:20:52 +01:00
parent c78c034296
commit 0de0101e23
13 changed files with 391 additions and 482 deletions

View File

@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -1885,6 +1885,98 @@ minetest.register_craft( {
},
})
-- paintings
--[[
minetest.register_craft({
output = "homedecor:blank_canvas",
recipe = {
{ "", "group:stick", "" },
{ "group:stick", "wool:white", "group:stick" },
{ "", "group:stick", "" },
}
})
local painting_patterns = {
[1] = { { "brown", "red", "brown" },
{ "dark_green", "red", "green" } },
[2] = { { "green", "yellow", "green" },
{ "green", "yellow", "green" } },
[3] = { { "green", "pink", "green" },
{ "brown", "pink", "brown" } },
[4] = { { "black", "orange", "grey" },
{ "dark_green", "orange", "orange" } },
[5] = { { "blue", "orange", "yellow" },
{ "green", "red", "brown" } },
[6] = { { "green", "red", "orange" },
{ "orange", "yellow", "green" } },
[7] = { { "blue", "dark_green", "dark_green" },
{ "green", "grey", "green" } },
[8] = { { "blue", "blue", "blue" },
{ "green", "green", "green" } },
[9] = { { "blue", "blue", "dark_green" },
{ "green", "grey", "dark_green" } },
[10] = { { "green", "white", "green" },
{ "dark_green", "white", "dark_green" } },
[11] = { { "blue", "white", "blue" },
{ "blue", "grey", "dark_green" } },
[12] = { { "green", "green", "green" },
{ "grey", "grey", "green" } },
[13] = { { "blue", "blue", "grey" },
{ "dark_green", "white", "white" } },
[14] = { { "red", "yellow", "blue" },
{ "blue", "green", "violet" } },
[15] = { { "blue", "yellow", "blue" },
{ "black", "black", "black" } },
[16] = { { "red", "orange", "blue" },
{ "black", "dark_grey", "grey" } },
[17] = { { "orange", "yellow", "orange" },
{ "black", "black", "black" } },
[18] = { { "grey", "dark_green", "grey" },
{ "white", "white", "white" } },
[19] = { { "white", "brown", "green" },
{ "green", "brown", "brown" } },
[20] = { { "blue", "blue", "blue" },
{ "red", "brown", "grey" } }
}
for i,recipe in pairs(painting_patterns) do
local item1 = "dye:"..recipe[1][1]
local item2 = "dye:"..recipe[1][2]
local item3 = "dye:"..recipe[1][3]
local item4 = "dye:"..recipe[2][1]
local item5 = "dye:"..recipe[2][2]
local item6 = "dye:"..recipe[2][3]
minetest.register_craft({
output = "homedecor:painting_"..i,
recipe = {
{ item1, item2, item3 },
{ item4, item5, item6 },
{"", "homedecor:blank_canvas", "" }
}
})
end
]]--
-- more misc stuff here
minetest.register_craft({
@ -2030,6 +2122,15 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "homedecor:ceiling_fan",
recipe = {
{ "technic:motor" },
{ "homedecor:fan_blades" },
{ "homedecor:glowlight_small_cube_white" }
}
})
minetest.register_craft({
output = "homedecor:welcome_mat_grey 2",
recipe = {
@ -2416,7 +2517,34 @@ minetest.register_craft( {
{ "moreblocks:slab_wood", "", "moreblocks:slab_wood" }
},
})
--[[
local bedcolors = {
{ "red", "red"},
{ "orange", "orange" },
{ "yellow", "yellow"},
{ "green", "dark_green"},
{ "blue", "blue"},
{ "violet", "violet"},
{ "pink", "pink"},
{ "darkgrey", "dark_grey"},
{ "brown", "brown" },
}
for c in ipairs(bedcolors) do
local color = bedcolors[c][1]
local woolcolor = bedcolors[c][2]
minetest.register_craft( {
output = "homedecor:bed_"..color.."_foot",
recipe = {
{ "group:stick", "", "group:stick" },
{ "wool:white", "wool:"..woolcolor, "wool:"..woolcolor },
{ "group:wood", "", "group:wood" },
},
})
end
]]--
minetest.register_craft( {
output = "homedecor:bottle_green",
recipe = {

View File

@ -148,27 +148,26 @@ minetest.register_node("homedecor:telephone", {
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875}, -- NodeBox1
{-0.125, -0.5, -0.130, 0.125, -0.375, 0.1875}, -- NodeBox2
{-0.0625, -0.5, -0.0625, 0.0625, -0.3125, 0.1875}, -- NodeBox3
{0.0331951, -0.375, 0, 0.0625, -0.223757, 0.125}, -- NodeBox4
{-0.0625, -0.375, 0, -0.033195, -0.223757, 0.125}, -- NodeBox5
{-0.207469, -0.25, 0.0374656, 0.207469, -0.1875, 0.0873276}, -- NodeBox6
{0.125, -0.3125, 0, 0.25, -0.25, 0.125}, -- NodeBox7
{-0.25, -0.3125, 0, -0.125, -0.25, 0.125}, -- NodeBox8
{-0.0912863, -0.5, -0.0955001, 0.0995851, -0.339779, 0.1875}, -- NodeBox9
{-0.157676, -0.5, -0.161983, 0.157676, -0.406077, 0.1875}, -- NodeBox10
{0.124481, -0.290055, 0.0208449, 0.232365, -0.21547, 0.103948}, -- NodeBox11
{-0.232365, -0.290055, 0.0208449, -0.124481, -0.21547, 0.103948}, -- NodeBox12
{-0.174274, -0.472376, -0.174604, 0.174274, -0.422652, 0.187541}, -- NodeBox13
{-0.141079, -0.430939, -0.145079, 0.141079, -0.389503, 0.187521}, -- NodeBox14
{-0.107884, -0.389503, -0.114121, 0.112183, -0.356354, 0.187552}, -- NodeBox15
{-0.0756888, -0.344917, 0.187571, 0.085884, -0.321492, -0.0793901}, -- NodeBox16
{-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.15}, -- NodeBox1
{-0.125, -0.5, -0.130, 0.125, -0.3675, 0.15}, -- NodeBox2
{-0.175, -0.4375, -0.175, 0.175, -0.42, 0.15}, -- NodeBox3
{-0.16, -0.42, -0.16, 0.16, -0.4025, 0.15}, -- NodeBox4
{-0.145, -0.4025, -0.145, 0.145, -0.385, 0.15}, -- NodeBox5
{-0.11, -0.385, -0.115, 0.11, -0.35, 0.15}, -- NodeBox6
{-0.095, -0.5, -0.1, 0.095, -0.3325, 0.15}, -- NodeBox7
{-0.075, -0.345, 0.15, 0.075, -0.32, -0.075}, -- NodeBox8
{0.04, -0.375, 0.0125, 0.0625, -0.23, 0.11}, -- NodeBox9
{-0.0625, -0.375, 0.0125, -0.04, -0.23, 0.11}, -- NodeBox10
{-0.2075, -0.25, 0.0375, 0.2075, -0.21, 0.0875}, -- NodeBox11
{0.125, -0.3, 0, 0.25, -0.25, 0.125}, -- NodeBox12
{-0.25, -0.3, 0, -0.125, -0.25, 0.125}, -- NodeBox13
{0.125, -0.275, 0.017, 0.23, -0.225, 0.11}, -- NodeBox14
{-0.23, -0.275, 0.017, -0.125, -0.225, 0.11}, -- NodeBox15
}
},
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.1875, 0.25, -0.1875, 0.1875 }
}
fixed = { -0.25, -0.5, -0.1875, 0.25, -0.21, 0.15 }
}
})

View File

@ -239,7 +239,111 @@ minetest.register_node(":homedecor:openframe_bookshelf", {
}
}
})
--[[
local bedcolors = {
"red",
"green",
"blue",
"violet",
"brown",
"darkgrey",
"orange",
"yellow",
"pink",
}
for _, color in ipairs(bedcolors) do
minetest.register_node("homedecor:bed_"..color.."_head", {
tiles = {
"homedecor_bed_"..color.."_top1.png",
"homedecor_bed_bottom1.png",
"homedecor_bed_"..color.."_side1.png",
"homedecor_bed_"..color.."_side1.png^[transformFX",
"homedecor_bed_"..color.."_head1.png",
"homedecor_bed_"..color.."_head2.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, not_in_creative_inventory=1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.4375, -0.375, 0.5, 0.5}, -- NodeBox1
{0.375, -0.5, 0.4375, 0.5, 0.5, 0.5}, -- NodeBox2
{-0.5, 0.25, 0.4375, 0.5, 0.4375, 0.5}, -- NodeBox3
{-0.5, 0, 0.4375, 0.5, 0.1875, 0.5}, -- NodeBox4
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5}, -- NodeBox5
{-0.4375, -0.375, -0.5, -0.375, -0.125, 0.5}, -- NodeBox6
{0.375, -0.375, -0.5, 0.4375, -0.125, 0.5}, -- NodeBox7
{-0.375, -0.375, 0.25, 0.375, -0.3125, 0.375}, -- NodeBox8
{-0.375, -0.375, 0.0625, 0.375, -0.3125, 0.1875}, -- NodeBox9
{-0.375, -0.375, -0.125, 0.375, -0.3125, 0}, -- NodeBox10
{-0.375, -0.375, -0.3125, 0.375, -0.3125, -0.1875}, -- NodeBox11
{-0.375, -0.375, -0.5, 0.375, -0.3125, -0.375}, -- NodeBox12
{-0.375, -0.3125, -0.5, 0.375, -0.0625, 0.4375}, -- NodeBox13
{-0.3125, -0.125, 0.0625, 0.3125, 0.0625, 0.4375}, -- NodeBox14
}
},
selection_box = {
type = "fixed",
fixed = { 0, 0, 0, 0, 0, 0 }
}
})
minetest.register_node("homedecor:bed_"..color.."_foot", {
tiles = {
"homedecor_bed_"..color.."_top2.png",
"homedecor_bed_bottom2.png",
"homedecor_bed_"..color.."_side2.png",
"homedecor_bed_"..color.."_side2.png^[transformFX",
"homedecor_bed_"..color.."_foot2.png",
"homedecor_bed_"..color.."_foot1.png"
},
inventory_image = "homedecor_bed_"..color.."_inv.png",
description = S("Bed (%s)"):format(color),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.375, 0.1875, -0.4375}, -- NodeBox1
{0.375, -0.5, -0.5, 0.5, 0.1875, -0.4375}, -- NodeBox2
{-0.5, 0, -0.5, 0.5, 0.125, -0.4375}, -- NodeBox3
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375}, -- NodeBox4
{-0.4375, -0.375, -0.5, -0.375, -0.125, 0.5}, -- NodeBox5
{0.375, -0.375, -0.5, 0.4375, -0.125, 0.5}, -- NodeBox6
{-0.375, -0.375, 0.3125, 0.375, -0.3125, 0.4375}, -- NodeBox7
{-0.375, -0.375, 0.125, 0.375, -0.3125, 0.25}, -- NodeBox8
{-0.375, -0.375, -0.0625, 0.375, -0.3125, 0.0625}, -- NodeBox9
{-0.375, -0.375, -0.25, 0.375, -0.3125, -0.125}, -- NodeBox10
{-0.375, -0.375, -0.4375, 0.375, -0.3125, -0.3125}, -- NodeBox11
{-0.375, -0.3125, -0.4375, 0.375, -0.0625, 0.5}, -- NodeBox12
}
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 1.5 }
},
on_place = function(itemstack, placer, pointed_thing)
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:bed_"..color.."_foot", "homedecor:bed_"..color.."_head", false)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:bed_"..color.."_head" then
minetest.remove_node(pos2)
end
end
})
end
]]--
minetest.register_node("homedecor:wardrobe_top", {
tiles = {
"homedecor_wardrobe_top.png",
@ -296,31 +400,8 @@ minetest.register_node("homedecor:wardrobe_bottom", {
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:wardrobe_bottom", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:wardrobe_top", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
"homedecor:wardrobe_bottom", "homedecor:wardrobe_top")
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
@ -363,15 +444,6 @@ minetest.register_node("homedecor:wardrobe_bottom", {
end,
})
local fdir_to_right = {
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
{ 0, 1 },
}
minetest.register_node("homedecor:simple_bench", {
tiles = {
"homedecor_generic_wood.png",
@ -429,36 +501,13 @@ minetest.register_node("homedecor:bench_large_1_left", {
fixed = { -0.5, -0.5, -0.09375, 1.5, 0.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:bench_large_1_left", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:bench_large_1_right", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:bench_large_1_left", "homedecor:bench_large_1_right", true)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:bench_large_1_right" then
minetest.remove_node(pos2)
end
@ -538,36 +587,13 @@ minetest.register_node("homedecor:bench_large_2_left", {
fixed = { -0.5, -0.5, -0.15625, 1.5, 0.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:bench_large_2_left", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:bench_large_2_right", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:bench_large_2_left", "homedecor:bench_large_2_right", true)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:bench_large_2_right" then
minetest.remove_node(pos2)
end
@ -614,13 +640,6 @@ minetest.register_node("homedecor:bench_large_2_right", {
},
})
local fdir_to_fwd = {
{ 0, 1 },
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
}
minetest.register_node("homedecor:deckchair_head", {
tiles = {
"homedecor_deckchair_top_c1.png",
@ -690,36 +709,13 @@ minetest.register_node("homedecor:deckchair_foot", {
fixed = { -0.45, -0.5, -0.5, 0.45, 0.35, 1.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:deckchair_foot", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:deckchair_head", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:deckchair_foot", "homedecor:deckchair_head", false)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] }
local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:deckchair_head" then
minetest.remove_node(pos2)
end

View File

@ -67,6 +67,85 @@ function homedecor.get_nodedef_field(nodename, fieldname)
return minetest.registered_nodes[nodename][fieldname]
end
-- Stack one node above another
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = node1, param2 = fdir })
minetest.add_node(pos2, { name = node2, param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
end
-- Place one node right of or behind another
homedecor.fdir_to_right = {
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
{ 0, 1 },
}
homedecor.fdir_to_fwd = {
{ 0, 1 },
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
}
function homedecor.stack_sideways(itemstack, placer, pointed_thing, node1, node2, dir)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2
if dir then
pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
else
pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
end
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = node1, param2 = fdir })
minetest.add_node(pos2, { name = node2, param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
end
-- load various other components
dofile(homedecor.modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes

View File

@ -636,31 +636,8 @@ minetest.register_node("homedecor:doghouse_base", {
},
groups = {snappy=3},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:doghouse_base", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:doghouse_roof", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
"homedecor:doghouse_base", "homedecor:doghouse_roof")
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
@ -716,15 +693,6 @@ minetest.register_node("homedecor:doghouse_roof", {
groups = {snappy=3, not_in_creative_inventory=1},
})
local fdir_to_fwd = {
{ 0, 1 },
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
}
local swap_fdir = { 2, 3, 0, 1 }
minetest.register_node("homedecor:pool_table", {
tiles = {
"homedecor_pool_table_top1.png",
@ -773,45 +741,20 @@ minetest.register_node("homedecor:pool_table", {
fixed = { -0.5, -0.5, -0.5, 0.5, 0.3125, 1.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:pool_table", param2 = fdir })
print(fdir)
print(swap_fdir[fdir+1])
minetest.add_node(pos2, { name = "homedecor:pool_table2", param2 = swap_fdir[fdir+1] })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:pool_table", "homedecor:pool_table_2", false)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + fdir_to_fwd[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:pool_table2" then
local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:pool_table_2" then
minetest.remove_node(pos2)
end
end
})
minetest.register_node("homedecor:pool_table2", {
minetest.register_node("homedecor:pool_table_2", {
tiles = {
"homedecor_pool_table_top2.png",
"homedecor_pool_table_bottom2.png",
@ -827,29 +770,29 @@ minetest.register_node("homedecor:pool_table2", {
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, -0.25, 0.1875, -0.25}, -- NodeBox1
{0.25, -0.5, -0.375, 0.375, 0.1875, -0.25}, -- NodeBox2
{-0.25, -0.125, -0.3125, 0.25, -0.0625, 0}, -- NodeBox3
{-0.3125, -0.0625, -0.3125, -0.25, 0.1875, 0}, -- NodeBox4
{0.25, -0.0625, -0.3125, 0.3125, 0.1875, 0}, -- NodeBox5
{-0.3125, -0.125, 0, 0.3125, 0.1875, 0.0625}, -- NodeBox6
{0.25, -0.125, -0.25, 0.3125, 0.1875, 0.5}, -- NodeBox7
{-0.3125, -0.125, -0.25, -0.25, 0.1875, 0.5}, -- NodeBox8
{-0.5, 0.1875, -0.5, -0.4375, 0.25, 0.5}, -- NodeBox9
{-0.5, 0.1875, -0.5, 0.5, 0.25, -0.4375}, -- NodeBox10
{0.4375, 0.1875, -0.5, 0.5, 0.25, 0.5}, -- NodeBox11
{-0.3125, 0.1875, -0.3125, 0.3125, 0.25, 0.5}, -- NodeBox12
{-0.4375, 0.1875, -0.3125, 0.4375, 0.25, 0.4375}, -- NodeBox13
{-0.3125, 0.1875, -0.5, 0.3125, 0.25, -0.3125}, -- NodeBox14
{-0.25, -0.125, -0.325, 0.25, 0, -0.3125}, -- NodeBox15
{0.25, 0.125, -0.4375, 0.4375, 0.1875, 0.5}, -- NodeBox16
{-0.4375, 0.125, -0.4375, -0.25, 0.1875, 0.5}, -- NodeBox17
{-0.5, 0.25, -0.5, -0.4375, 0.3125, 0.5}, -- NodeBox18
{-0.5, 0.25, -0.5, 0.5, 0.3125, -0.4375}, -- NodeBox19
{0.4375, 0.25, -0.5, 0.5, 0.3125, 0.5}, -- NodeBox20
{-0.4375, 0.25, -0.3125, -0.375, 0.3125, 0.4375}, -- NodeBox23
{-0.3125, 0.25, -0.4375, 0.3125, 0.3125, -0.375}, -- NodeBox24
{0.375, 0.25, -0.3125, 0.4375, 0.3125, 0.4375}, -- NodeBox25
{-0.375, -0.5, 0.25, -0.25, 0.1875, 0.375}, -- NodeBox1
{0.25, -0.5, 0.25, 0.375, 0.1875, 0.375}, -- NodeBox2
{-0.25, -0.125, 0, 0.25, -0.0625, 0.3125}, -- NodeBox3
{-0.3125, -0.0625, 0, -0.25, 0.1875, 0.3125}, -- NodeBox4
{0.25, -0.0625, 0, 0.3125, 0.1875, 0.3125}, -- NodeBox5
{-0.3125, -0.125, -0.0625, 0.3125, 0.1875, 0}, -- NodeBox6
{0.25, -0.125, -0.5, 0.3125, 0.1875, 0.25}, -- NodeBox7
{-0.3125, -0.125, -0.5, -0.25, 0.1875, 0.25}, -- NodeBox8
{-0.5, 0.1875, -0.5, -0.4375, 0.25, 0.5}, -- NodeBox9
{-0.5, 0.1875, 0.4375, 0.5, 0.25, 0.5}, -- NodeBox10
{0.4375, 0.1875, -0.5, 0.5, 0.25, 0.5}, -- NodeBox11
{-0.3125, 0.1875, -0.5, 0.3125, 0.25, 0.3125}, -- NodeBox12
{-0.4375, 0.1875, -0.4375, 0.4375, 0.25, 0.3125}, -- NodeBox13
{-0.3125, 0.1875, 0.3125, 0.3125, 0.25, 0.5}, -- NodeBox14
{-0.25, -0.125, 0.3125, 0.25, 0, 0.325}, -- NodeBox15
{0.25, 0.125, -0.5, 0.4375, 0.1875, 0.4375}, -- NodeBox16
{-0.4375, 0.125, -0.5, -0.25, 0.1875, 0.4375}, -- NodeBox17
{-0.5, 0.25, -0.5, -0.4375, 0.3125, 0.5}, -- NodeBox18
{-0.5, 0.25, 0.4375, 0.5, 0.3125, 0.5}, -- NodeBox19
{0.4375, 0.25, -0.5, 0.5, 0.3125, 0.5}, -- NodeBox20
{-0.4375, 0.25, -0.4375, -0.375, 0.3125, 0.3125}, -- NodeBox23
{-0.3125, 0.25, 0.375, 0.3125, 0.3125, 0.4375}, -- NodeBox24
{0.375, 0.25, -0.4375, 0.4375, 0.3125, 0.3125}, -- NodeBox25
}
},
selection_box = {
@ -931,31 +874,8 @@ minetest.register_node("homedecor:well_base", {
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:well_base", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:well_top", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
"homedecor:well_base", "homedecor:well_top")
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
@ -1280,13 +1200,6 @@ minetest.register_node("homedecor:dartboard", {
sounds = default.node_sound_defaults(),
})
local fdir_to_right = {
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
{ 0, 1 },
}
minetest.register_node("homedecor:piano_left", {
tiles = {
"homedecor_piano_top_left.png",
@ -1320,36 +1233,13 @@ minetest.register_node("homedecor:piano_left", {
fixed = { -0.5, -0.5, -0.125, 1.5, 0.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:piano_left", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:piano_right", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:piano_left", "homedecor:piano_right", true)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:piano_right" then
minetest.remove_node(pos2)
end
@ -1451,3 +1341,17 @@ minetest.register_node("homedecor:toaster_loaf", {
drop = "homedecor:toaster"
})
-- convert old pool tables into newer model
minetest.register_abm({
nodenames = { "homedecor:pool_table2" },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local swap_fdir = { 2, 3, 0, 1 }
local fdir = swap_fdir[node.param2+1]
minetest.set_node(pos, {name = "homedecor:pool_table_2", param2 = fdir})
end
})

View File

@ -58,7 +58,6 @@ minetest.register_node("homedecor:refrigerator_steel_bottom", {
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
print("started on_place")
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
@ -177,7 +176,6 @@ minetest.register_node("homedecor:refrigerator_white_bottom", {
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
},
on_place = function(itemstack, placer, pointed_thing)
print("started on_place")
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]

View File

@ -408,13 +408,6 @@ minetest.register_node('homedecor:utility_table_legs', {
},
})
local fdir_to_right = {
{ 1, 0 },
{ 0, -1 },
{ -1, 0 },
{ 0, 1 },
}
minetest.register_node("homedecor:desk", {
drawtype = "nodebox",
description = "Desk",
@ -445,36 +438,13 @@ minetest.register_node("homedecor:desk", {
},
groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local pnode = minetest.get_node(pointed_thing.under)
local rnodedef = minetest.registered_nodes[pnode.name]
if not rnodedef["buildable_to"] then
pos = pointed_thing.above
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local tnode = minetest.get_node(pos)
local tnode2 = minetest.get_node(pos2)
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
and not minetest.is_protected(pos, placer:get_player_name())
and not minetest.is_protected(pos2, placer:get_player_name()) then
minetest.add_node(pos, { name = "homedecor:desk", param2 = fdir })
minetest.add_node(pos2, { name = "homedecor:desk_r", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
"homedecor:desk", "homedecor:desk_r", true)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local fdir = oldnode.param2
if not fdir or fdir > 3 then return end
local pos2 = { x = pos.x + fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + fdir_to_right[fdir+1][2] }
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
if minetest.get_node(pos2).name == "homedecor:desk_r" then
minetest.remove_node(pos2)
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 310 B