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

Rewrote 3dforniture lamp code and fixed the light level ordering bug

This commit is contained in:
Vanessa Ezekowitz 2013-04-21 05:04:24 -04:00
parent 1195132fb0
commit 57ef8401fe

View File

@ -121,16 +121,7 @@ for i in ipairs(chaircolors) do
end end
function homedecor_table_lamp_on_punch(pos, node, puncher)
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 s = minetest.registered_nodes[node.name].homedecor_table_lamp_next
if (not s) or (not repl[s]) then return end
node.name = "homedecor:table_lamp_"..repl[s]
minetest.env:set_node(pos, node)
nodeupdate(pos)
end
local function reg_lamp(suffix, nxt, desc, tilesuffix, light) local function reg_lamp(suffix, nxt, desc, tilesuffix, light)
minetest.register_node("homedecor:table_lamp_"..suffix, { minetest.register_node("homedecor:table_lamp_"..suffix, {
@ -142,7 +133,6 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light)
"forniture_table_lamp_l"..tilesuffix..".png", "forniture_table_lamp_l"..tilesuffix..".png",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -167,11 +157,13 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light)
not_in_creative_inventory=((desc == nil) and 1) or nil, not_in_creative_inventory=((desc == nil) and 1) or nil,
}, },
drop = "homedecor:table_lamp_off", drop = "homedecor:table_lamp_off",
homedecor_table_lamp_next = nxt, on_punch = function(pos, node, puncher)
on_punch = homedecor_table_lamp_on_punch, node.name = "homedecor:table_lamp_"..repl[suffix]
minetest.env:set_node(pos, node)
nodeupdate(pos)
end,
}) })
minetest.register_alias("3dforniture:table_lamp_"..suffix, minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
"homedecor:table_lamp_"..suffix)
end end
reg_lamp("off", "low", "Table Lamp", "", nil ) reg_lamp("off", "low", "Table Lamp", "", nil )