mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 00:20:17 +01:00
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
|
||||
|
||||
|
||||
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)
|
||||
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",
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "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,
|
||||
},
|
||||
drop = "homedecor:table_lamp_off",
|
||||
homedecor_table_lamp_next = nxt,
|
||||
on_punch = homedecor_table_lamp_on_punch,
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "homedecor:table_lamp_"..repl[suffix]
|
||||
minetest.env:set_node(pos, node)
|
||||
nodeupdate(pos)
|
||||
end,
|
||||
})
|
||||
minetest.register_alias("3dforniture:table_lamp_"..suffix,
|
||||
"homedecor:table_lamp_"..suffix)
|
||||
minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
|
||||
end
|
||||
|
||||
reg_lamp("off", "low", "Table Lamp", "", nil )
|
||||
|
Loading…
Reference in New Issue
Block a user