added on_rightclick instead of punching for toilet and lamp; lamps are registered in a loop now; not craftable nodes no longer appear in creative inventory
This commit is contained in:
parent
930c301d88
commit
096a5c1f92
197
nodes.lua
197
nodes.lua
@ -30,7 +30,6 @@
|
||||
|
||||
]]--
|
||||
|
||||
--nodes
|
||||
|
||||
-- Deco Home
|
||||
|
||||
@ -141,9 +140,15 @@
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
|
||||
})
|
||||
|
||||
|
||||
--Table Lamp
|
||||
minetest.register_node("3dforniture:table_lamp_off",
|
||||
{ description = 'Table Lamp',
|
||||
lamp_states = {"off", "low", "med", "hi", "max"}
|
||||
light_level = 0
|
||||
-- not_in_creative_inventory will be set to this value (we only want the FIRST lamp there)
|
||||
nocr = 0
|
||||
for i, state in ipairs(lamp_states) do
|
||||
minetest.register_node("3dforniture:table_lamp_"..state,
|
||||
{ description = 'Table Lamp ('..state..')',
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"forniture_table_lamp_s.png",
|
||||
@ -176,165 +181,19 @@
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5,0.5, 0.5},
|
||||
},
|
||||
groups = {cracky=2,oddly_breakable_by_hand=1,},
|
||||
drop = "3dforniture:table_lamp_off",
|
||||
})
|
||||
|
||||
minetest.register_node("3dforniture:table_lamp_low",
|
||||
{ description = 'Table Lamp',
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_l.png",
|
||||
},
|
||||
paramtype = 'light',
|
||||
paramtype2 == 'facedir',
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
||||
--Lamp Base
|
||||
{-0.15,-0.5,-0.15, 0.15,-0.45,0.15},
|
||||
{-0.05,-0.45,-0.05, 0.05,-0.4,0.05},
|
||||
{-0.025,-0.4,-0.025, 0.025,-0.1,0.025},
|
||||
{-0.0125,-0.125,-0.2, 0.0125,-0.1,0.2},
|
||||
{-0.2,-0.125,-0.0125, 0.2,-0.1,0.0125},
|
||||
|
||||
--Lamp Shade
|
||||
{-0.2,-0.1,-0.2, -0.175,0.3,0.2},
|
||||
{0.175,-0.1,-0.2, 0.2,0.3,0.2},
|
||||
{-0.175,-0.1,-0.2, 0.175,0.3,-0.175},
|
||||
{-0.175,-0.1,0.175, 0.175,0.3,0.2},
|
||||
},
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = 4,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5,0.5, 0.5},
|
||||
},
|
||||
groups = {cracky=2,oddly_breakable_by_hand=1,},
|
||||
drop = "3dforniture:table_lamp_off",
|
||||
})
|
||||
|
||||
minetest.register_node("3dforniture:table_lamp_med",
|
||||
{ description = 'Table Lamp',
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_l.png",
|
||||
},
|
||||
paramtype = 'light',
|
||||
paramtype2 == 'facedir',
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
||||
--Lamp Base
|
||||
{-0.15,-0.5,-0.15, 0.15,-0.45,0.15},
|
||||
{-0.05,-0.45,-0.05, 0.05,-0.4,0.05},
|
||||
{-0.025,-0.4,-0.025, 0.025,-0.1,0.025},
|
||||
{-0.0125,-0.125,-0.2, 0.0125,-0.1,0.2},
|
||||
{-0.2,-0.125,-0.0125, 0.2,-0.1,0.0125},
|
||||
|
||||
--Lamp Shade
|
||||
{-0.2,-0.1,-0.2, -0.175,0.3,0.2},
|
||||
{0.175,-0.1,-0.2, 0.2,0.3,0.2},
|
||||
{-0.175,-0.1,-0.2, 0.175,0.3,-0.175},
|
||||
{-0.175,-0.1,0.175, 0.175,0.3,0.2},
|
||||
},
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = 8,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5,0.5, 0.5},
|
||||
},
|
||||
groups = {cracky=2,oddly_breakable_by_hand=1,},
|
||||
drop = "3dforniture:table_lamp_off",
|
||||
})
|
||||
|
||||
minetest.register_node("3dforniture:table_lamp_hi",
|
||||
{ description = 'Table Lamp',
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_l.png",
|
||||
},
|
||||
paramtype = 'light',
|
||||
paramtype2 == 'facedir',
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
||||
--Lamp Base
|
||||
{-0.15,-0.5,-0.15, 0.15,-0.45,0.15},
|
||||
{-0.05,-0.45,-0.05, 0.05,-0.4,0.05},
|
||||
{-0.025,-0.4,-0.025, 0.025,-0.1,0.025},
|
||||
{-0.0125,-0.125,-0.2, 0.0125,-0.1,0.2},
|
||||
{-0.2,-0.125,-0.0125, 0.2,-0.1,0.0125},
|
||||
|
||||
--Lamp Shade
|
||||
{-0.2,-0.1,-0.2, -0.175,0.3,0.2},
|
||||
{0.175,-0.1,-0.2, 0.2,0.3,0.2},
|
||||
{-0.175,-0.1,-0.2, 0.175,0.3,-0.175},
|
||||
{-0.175,-0.1,0.175, 0.175,0.3,0.2},
|
||||
},
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = 12,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5,0.5, 0.5},
|
||||
},
|
||||
groups = {cracky=2},
|
||||
drop = "3dforniture:table_lamp_off",
|
||||
})
|
||||
|
||||
minetest.register_node("3dforniture:table_lamp_max",
|
||||
{ description = 'Table Lamp',
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_s.png",
|
||||
"forniture_table_lamp_l.png",
|
||||
},
|
||||
paramtype = 'light',
|
||||
paramtype2 == 'facedir',
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
||||
--Lamp Base
|
||||
{-0.15,-0.5,-0.15, 0.15,-0.45,0.15},
|
||||
{-0.05,-0.45,-0.05, 0.05,-0.4,0.05},
|
||||
{-0.025,-0.4,-0.025, 0.025,-0.1,0.025},
|
||||
{-0.0125,-0.125,-0.2, 0.0125,-0.1,0.2},
|
||||
{-0.2,-0.125,-0.0125, 0.2,-0.1,0.0125},
|
||||
|
||||
--Lamp Shade
|
||||
{-0.2,-0.1,-0.2, -0.175,0.3,0.2},
|
||||
{0.175,-0.1,-0.2, 0.2,0.3,0.2},
|
||||
{-0.175,-0.1,-0.2, 0.175,0.3,-0.175},
|
||||
{-0.175,-0.1,0.175, 0.175,0.3,0.2},
|
||||
},
|
||||
},
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = 16,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5,0.5, 0.5},
|
||||
},
|
||||
groups = {cracky=2,oddly_breakable_by_hand=1,},
|
||||
groups = {cracky=2,oddly_breakable_by_hand=1, not_in_creative_inventory=nocr},
|
||||
drop = "3dforniture:table_lamp_off",
|
||||
|
||||
light_source = light_level,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
minetest.swap_node(pos,
|
||||
{name="3dforniture:table_lamp_"..lamp_states[i%#lamp_states +1]})
|
||||
end,
|
||||
|
||||
})
|
||||
light_level = light_level + 4
|
||||
nocr = 1
|
||||
end
|
||||
|
||||
-- Bathroom Kit
|
||||
|
||||
@ -362,7 +221,10 @@
|
||||
},
|
||||
},
|
||||
drop ="3dforniture:toilet",
|
||||
groups = {cracky=3,}
|
||||
groups = {cracky=3, not_in_creative_inventory=1},
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
minetest.swap_node(pos, {name="3dforniture:toilet_open", param2=node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("3dforniture:toilet_open",
|
||||
@ -394,8 +256,15 @@
|
||||
},
|
||||
},
|
||||
drop = "3dforniture:toilet",
|
||||
groups = {cracky = 3,},
|
||||
sounds = {dig = "3dforniture_dig_toilet", gain=0.5},
|
||||
groups = {cracky = 3, not_in_creative_inventory=1},
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
minetest.swap_node(pos, {name="3dforniture:toilet", param2=node.param2})
|
||||
minetest.sound_play("3dforniture_dig_toilet", {
|
||||
pos=pos,
|
||||
max_hear_distance = 10,
|
||||
gain = 0.5,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
--Sink
|
||||
@ -703,7 +572,7 @@
|
||||
groups = {cracky=1}
|
||||
})
|
||||
|
||||
--Torch Wakll
|
||||
--Torch Wall
|
||||
minetest.register_node("3dforniture:torch_wall",
|
||||
{ description = 'Torch Wall',
|
||||
drawtype = "nodebox",
|
||||
|
Loading…
x
Reference in New Issue
Block a user