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
förälder 8b14e599a1
incheckning 88e5c28d39
107 ändrade filer med 4085 tillägg och 110 borttagningar

Visa fil

@@ -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)

Visa fil

@@ -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,
})
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"
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,
})
-- "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

Filskillnaden har hållits tillbaka eftersom den är för stor Load Diff

Filskillnaden har hållits tillbaka eftersom den är för stor Load Diff

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 211 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 215 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 212 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 213 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 211 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 237 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 246 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 304 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 247 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 243 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 162 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 168 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 163 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 161 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 167 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 271 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 303 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 268 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 259 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 236 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 241 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 246 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 241 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 245 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 255 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 249 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 263 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 254 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 313 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 248 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 318 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 325 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 378 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 316 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 325 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 394 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 411 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 325 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 406 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 334 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 220 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 267 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 225 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 261 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 270 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 434 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 408 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 430 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 416 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 343 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 328 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 375 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 358 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 364 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 383 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 311 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 309 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 309 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 306 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 309 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 339 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 420 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 305 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 410 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 414 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 1.2 KiB

Efter

Bredd:  |  Höjd:  |  Storlek: 1.7 KiB

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 82 B

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 1.2 KiB

Efter

Bredd:  |  Höjd:  |  Storlek: 1.6 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 1.7 KiB

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 1.3 KiB

Efter

Bredd:  |  Höjd:  |  Storlek: 1.5 KiB

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 1.2 KiB

Efter

Bredd:  |  Höjd:  |  Storlek: 1.3 KiB

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 1.3 KiB

Efter

Bredd:  |  Höjd:  |  Storlek: 1.7 KiB

Binary file not shown.

Före

Bredd:  |  Höjd:  |  Storlek: 1.3 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 13 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 12 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 13 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 13 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 12 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 13 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 13 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 12 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 15 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 13 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 14 KiB

Binary file not shown.

Efter

Bredd:  |  Höjd:  |  Storlek: 12 KiB

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