forked from mtcontrib/homedecor_modpack
Rewrote 3dforniture lamp code and fixed the light level ordering bug
This commit is contained in:
parent
1195132fb0
commit
57ef8401fe
@ -121,16 +121,7 @@ for i in ipairs(chaircolors) do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local repl = { off="low", low="med", med="hi", hi="max", max="off", }
|
||||||
function homedecor_table_lamp_on_punch(pos, node, puncher)
|
|
||||||
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,18 +157,20 @@ 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 )
|
||||||
reg_lamp("low", "med", nil, "l", 3)
|
reg_lamp("low", "med", nil, "l", 3 )
|
||||||
reg_lamp("med", "hi", nil, "m", 7)
|
reg_lamp("med", "hi" , nil, "m", 7 )
|
||||||
reg_lamp("hi", "max", nil, "h", 11)
|
reg_lamp("hi" , "max", nil, "h", 11 )
|
||||||
reg_lamp("max", "off", nil, "x", 14)
|
reg_lamp("max", "off", nil, "x", 14 )
|
||||||
|
|
||||||
-- Aliases for 3dforniture mod.
|
-- Aliases for 3dforniture mod.
|
||||||
minetest.register_alias("3dforniture:table", "homedecor:table")
|
minetest.register_alias("3dforniture:table", "homedecor:table")
|
||||||
|
Loading…
Reference in New Issue
Block a user