use mesh nodes for standing lamp and "3dforniture" table lamp

rewrote the surrounding code a bit to clean it up
all new textures, got rid of related, obsolete files.
This commit is contained in:
Vanessa Ezekowitz 2015-01-03 01:52:39 -05:00
parent 8b14e599a1
commit 88e5c28d39
107 changed files with 4085 additions and 110 deletions

View File

@ -66,6 +66,35 @@ function homedecor.get_nodedef_field(nodename, fieldname)
return minetest.registered_nodes[nodename][fieldname]
end
-- Place a two-node-tall single object (e.g. a floor lamp)
function homedecor.place_twonode_vertical(itemstack, placer, pointed_thing, node)
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 = node, param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
end
end
-- Stack one node above another
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2)

View File

@ -400,132 +400,80 @@ minetest.register_node('homedecor:lattice_lantern_small', {
local repl = { off="low", low="med", med="hi", hi="max", max="off", }
local lamp_colors = { "", "blue", "green", "pink", "red", "violet" }
local tlamp_cbox = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }
}
local slamp_cbox = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 }
}
local function reg_lamp(suffix, nxt, tilesuffix, light, color)
local lampcolor = "_"..color
local standingcolor = "_"..color
local colordesc = " ("..color..")"
if color == "" then
lampcolor = ""
standingcolor = "_white"
colordesc = " (white)"
end
minetest.register_node("homedecor:table_lamp"..lampcolor.."_"..suffix, {
description = S("Table Lamp "..colordesc),
drawtype = "nodebox",
tiles = {
"forniture_table_lamp_s"..tilesuffix..".png",
"forniture_table_lamp_s"..tilesuffix..".png",
"forniture_table_lamp"..lampcolor.."_l"..tilesuffix..".png",
},
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{ -0.1500, -0.500, -0.1500, 0.1500, -0.45, 0.1500 },
{ -0.0500, -0.450, -0.0500, 0.0500, -0.40, 0.0500 },
{ -0.0250, -0.400, -0.0250, 0.0250, -0.10, 0.0250 },
{ -0.0125, -0.125, -0.2000, 0.0125, -0.10, 0.2000 },
{ -0.2000, -0.125, -0.0125, 0.2000, -0.10, 0.0125 },
{ -0.2000, -0.100, -0.2000, -0.1750, 0.30, 0.2000 },
{ 0.1750, -0.100, -0.2000, 0.2000, 0.30, 0.2000 },
{ -0.1750, -0.100, -0.2000, 0.1750, 0.30, -0.1750 },
{ -0.1750, -0.100, 0.1750, 0.1750, 0.30, 0.2000 },
description = S("Table Lamp "..colordesc),
drawtype = "mesh",
mesh = "homedecor_table_lamp.obj",
tiles = { "homedecor_table_standing_lamp"..lampcolor.."_"..suffix..".png" },
paramtype = "light",
walkable = false,
light_source = light,
selection_box = tlamp_cbox,
collision_box = tlamp_cbox,
groups = {cracky=2,oddly_breakable_by_hand=1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
},
walkable = false,
light_source = light,
selection_box = {
type = "fixed",
fixed = { -0.2, -0.5, -0.2, 0.2, 0.30, 0.2 },
},
groups = {cracky=2,oddly_breakable_by_hand=1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
drop = "homedecor:table_lamp"..lampcolor.."_off",
on_punch = function(pos, node, puncher)
node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node)
nodeupdate(pos)
end,
drop = "homedecor:table_lamp"..lampcolor.."_off",
on_punch = function(pos, node, puncher)
node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node)
nodeupdate(pos)
end,
})
if lampcolor == "" then
minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
end
-- standing lamps
minetest.register_node("homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, {
description = S("Standing Lamp"..colordesc),
drawtype = "nodebox",
tiles = {
"forniture_table_lamp_s"..tilesuffix..".png",
"homedecor_standing_lamp_bottom_sides.png",
},
inventory_image = "homedecor_standing_lamp"..standingcolor.."_inv.png",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{ -0.1500, -0.500, -0.1500, 0.1500, -0.45, 0.1500 },
{ -0.0500, -0.450, -0.0500, 0.0500, -0.40, 0.0500 },
{ -0.0250, -0.400, -0.0250, 0.0250, 0.50, 0.0250 },
minetest.register_node("homedecor:standing_lamp"..lampcolor.."_"..suffix, {
description = S("Standing Lamp"..colordesc),
drawtype = "mesh",
mesh = "homedecor_standing_lamp.obj",
tiles = { "homedecor_table_standing_lamp"..lampcolor.."_"..suffix..".png" },
inventory_image = "homedecor_standing_lamp"..lampcolor.."_inv.png",
paramtype = "light",
walkable = false,
light_source = light,
groups = {cracky=2,oddly_breakable_by_hand=1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
},
walkable = false,
light_source = light,
selection_box = {
type = "fixed",
fixed = { 0, 0, 0, 0, 0, 0}
},
groups = {cracky=2,oddly_breakable_by_hand=1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
selection_box = slamp_cbox,
collision_box = slamp_cbox,
on_place = function(itemstack, placer, pointed_thing)
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
"homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, "homedecor:standing_lamp_top"..lampcolor.."_"..suffix)
end,
return homedecor.place_twonode_vertical(itemstack, placer, pointed_thing,
"homedecor:standing_lamp"..lampcolor.."_"..suffix)
end,
on_punch = function(pos, node, puncher)
node.name = "homedecor:standing_lamp"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node)
nodeupdate(pos)
end,
})
minetest.register_node("homedecor:standing_lamp_top"..lampcolor.."_"..suffix, {
drawtype = "nodebox",
tiles = {
"forniture_table_lamp_s"..tilesuffix..".png",
"forniture_table_lamp_s"..tilesuffix..".png",
"forniture_standing_lamp"..lampcolor.."_l"..tilesuffix..".png"
},
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{ -0.0250, -0.500, -0.0250, 0.0250, 0.10, 0.0250 },
{ -0.0125, 0.0625, -0.2000, 0.0125, 0.10, 0.2000 },
{ -0.2000, 0.0625, -0.0125, 0.2000, 0.10, 0.0125 },
{ -0.2000, 0.100, -0.2000, -0.1750, 0.50, 0.2000 },
{ 0.1750, 0.100, -0.2000, 0.2000, 0.50, 0.2000 },
{ -0.1750, 0.100, -0.2000, 0.1750, 0.50, -0.1750 },
{ -0.1750, 0.100, 0.1750, 0.1750, 0.50, 0.2000 },
},
},
walkable = false,
light_source = light,
selection_box = {
type = "fixed",
fixed = { -0.2, -1.5, -0.2, 0.2, 0.5, 0.2 },
},
groups = {snappy=3, not_in_creative_inventory=1},
on_punch = function(pos, node, puncher)
node.name = "homedecor:standing_lamp_top"..lampcolor.."_"..repl[suffix]
minetest.set_node(pos, node)
nodeupdate(pos)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local pos2 = { x = pos.x, y=pos.y - 1, z = pos.z }
if minetest.get_node(pos2).name == "homedecor:standing_lamp_bottom"..lampcolor.."_off" then
minetest.remove_node(pos2)
end
end,
drop = "homedecor:standing_lamp_bottom"..lampcolor.."_off"
})
-- "bottom" in the node name is obsolete now, as "top" node doesn't exist anymore.
minetest.register_alias("homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, "homedecor:standing_lamp"..lampcolor.."_"..suffix)
minetest.register_alias("homedecor:standing_lamp_top"..lampcolor.."_"..suffix, "air")
-- for old maps that had 3dfornit`ure
if lampcolor == "" then
minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
end
end
for _, color in ipairs(lamp_colors) do

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Some files were not shown because too many files have changed in this diff Show More