1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

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] return minetest.registered_nodes[nodename][fieldname]
end 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 -- Stack one node above another
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2) 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 repl = { off="low", low="med", med="hi", hi="max", max="off", }
local lamp_colors = { "", "blue", "green", "pink", "red", "violet" } 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 function reg_lamp(suffix, nxt, tilesuffix, light, color)
local lampcolor = "_"..color local lampcolor = "_"..color
local standingcolor = "_"..color
local colordesc = " ("..color..")" local colordesc = " ("..color..")"
if color == "" then if color == "" then
lampcolor = "" lampcolor = ""
standingcolor = "_white"
colordesc = " (white)" colordesc = " (white)"
end end
minetest.register_node("homedecor:table_lamp"..lampcolor.."_"..suffix, { minetest.register_node("homedecor:table_lamp"..lampcolor.."_"..suffix, {
description = S("Table Lamp "..colordesc), description = S("Table Lamp "..colordesc),
drawtype = "nodebox", drawtype = "mesh",
tiles = { mesh = "homedecor_table_lamp.obj",
"forniture_table_lamp_s"..tilesuffix..".png", tiles = { "homedecor_table_standing_lamp"..lampcolor.."_"..suffix..".png" },
"forniture_table_lamp_s"..tilesuffix..".png", paramtype = "light",
"forniture_table_lamp"..lampcolor.."_l"..tilesuffix..".png", walkable = false,
}, light_source = light,
paramtype = "light", selection_box = tlamp_cbox,
node_box = { collision_box = tlamp_cbox,
type = "fixed", groups = {cracky=2,oddly_breakable_by_hand=1,
fixed = { not_in_creative_inventory=((light ~= nil) and 1) or nil,
{ -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 },
}, },
}, drop = "homedecor:table_lamp"..lampcolor.."_off",
walkable = false, on_punch = function(pos, node, puncher)
light_source = light, node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix]
selection_box = { minetest.set_node(pos, node)
type = "fixed", nodeupdate(pos)
fixed = { -0.2, -0.5, -0.2, 0.2, 0.30, 0.2 }, end,
},
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,
}) })
if lampcolor == "" then
minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
end
-- standing lamps -- standing lamps
minetest.register_node("homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, { minetest.register_node("homedecor:standing_lamp"..lampcolor.."_"..suffix, {
description = S("Standing Lamp"..colordesc), description = S("Standing Lamp"..colordesc),
drawtype = "nodebox", drawtype = "mesh",
tiles = { mesh = "homedecor_standing_lamp.obj",
"forniture_table_lamp_s"..tilesuffix..".png", tiles = { "homedecor_table_standing_lamp"..lampcolor.."_"..suffix..".png" },
"homedecor_standing_lamp_bottom_sides.png", inventory_image = "homedecor_standing_lamp"..lampcolor.."_inv.png",
}, paramtype = "light",
inventory_image = "homedecor_standing_lamp"..standingcolor.."_inv.png", walkable = false,
paramtype = "light", light_source = light,
node_box = { groups = {cracky=2,oddly_breakable_by_hand=1,
type = "fixed", not_in_creative_inventory=((light ~= nil) and 1) or nil,
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 },
}, },
}, selection_box = slamp_cbox,
walkable = false, collision_box = slamp_cbox,
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,
},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return homedecor.stack_vertically(itemstack, placer, pointed_thing, return homedecor.place_twonode_vertical(itemstack, placer, pointed_thing,
"homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, "homedecor:standing_lamp_top"..lampcolor.."_"..suffix) "homedecor:standing_lamp"..lampcolor.."_"..suffix)
end, end,
}) on_punch = function(pos, node, puncher)
node.name = "homedecor:standing_lamp"..lampcolor.."_"..repl[suffix]
minetest.register_node("homedecor:standing_lamp_top"..lampcolor.."_"..suffix, { minetest.set_node(pos, node)
drawtype = "nodebox", nodeupdate(pos)
tiles = { end,
"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 end
for _, color in ipairs(lamp_colors) do 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