forked from mtcontrib/homedecor_modpack
switch over all punch-operated objects
to use on_rightclick instead, for consistency with other parts of minetest, minetest_game, etc.
This commit is contained in:
parent
8ea285e683
commit
f09481c3f0
@ -27,7 +27,7 @@ homedecor.register("toilet", {
|
|||||||
node_box = toilet_cbox,
|
node_box = toilet_cbox,
|
||||||
groups = {cracky=3},
|
groups = {cracky=3},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
on_punch = function (pos, node, puncher)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
node.name = "homedecor:toilet_open"
|
node.name = "homedecor:toilet_open"
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
end
|
end
|
||||||
@ -47,7 +47,7 @@ homedecor.register("toilet_open", {
|
|||||||
drop = "homedecor:toilet",
|
drop = "homedecor:toilet",
|
||||||
groups = {cracky=3},
|
groups = {cracky=3},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
on_punch = function (pos, node, puncher)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
node.name = "homedecor:toilet"
|
node.name = "homedecor:toilet"
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
minetest.sound_play("homedecor_toilet_flush", {
|
minetest.sound_play("homedecor_toilet_flush", {
|
||||||
|
@ -59,7 +59,7 @@ homedecor.register("desk_fan", {
|
|||||||
meta:set_string("active", "no")
|
meta:set_string("active", "no")
|
||||||
add_mesh_desk_fan_entity(pos)
|
add_mesh_desk_fan_entity(pos)
|
||||||
end,
|
end,
|
||||||
on_punch = function(pos)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local entities = minetest.get_objects_inside_radius(pos, 0.1)
|
local entities = minetest.get_objects_inside_radius(pos, 0.1)
|
||||||
local entity = entities[1] or add_mesh_desk_fan_entity(pos)
|
local entity = entities[1] or add_mesh_desk_fan_entity(pos)
|
||||||
|
@ -71,7 +71,7 @@ homedecor.register("doorbell", {
|
|||||||
{-0.03125, 0.0625, 0.45, 0.03125, 0.125, 0.4675}, -- NodeBox2
|
{-0.03125, 0.0625, 0.45, 0.03125, 0.125, 0.4675}, -- NodeBox2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.sound_play("homedecor_doorbell", {
|
minetest.sound_play("homedecor_doorbell", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
|
@ -11,7 +11,7 @@ homedecor.register("speaker", {
|
|||||||
},
|
},
|
||||||
groups = { snappy = 3 },
|
groups = { snappy = 3 },
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.set_node(pos, {name = "homedecor:speaker_open", param2 = node.param2})
|
minetest.set_node(pos, {name = "homedecor:speaker_open", param2 = node.param2})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -27,7 +27,7 @@ homedecor.register("speaker_open", {
|
|||||||
},
|
},
|
||||||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.set_node(pos, {name = "homedecor:speaker", param2 = node.param2})
|
minetest.set_node(pos, {name = "homedecor:speaker", param2 = node.param2})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -134,20 +134,19 @@ homedecor.register("beer_tap", {
|
|||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 }
|
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 }
|
||||||
},
|
},
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local wielditem = puncher:get_wielded_item()
|
local inv = clicker:get_inventory()
|
||||||
local inv = puncher:get_inventory()
|
|
||||||
|
|
||||||
local wieldname = wielditem:get_name()
|
local wieldname = itemstack:get_name()
|
||||||
if wieldname == "vessels:drinking_glass" then
|
if wieldname == "vessels:drinking_glass" then
|
||||||
if inv:room_for_item("main", "homedecor:beer_mug 1") then
|
if inv:room_for_item("main", "homedecor:beer_mug 1") then
|
||||||
wielditem:take_item()
|
itemstack:take_item()
|
||||||
puncher:set_wielded_item(wielditem)
|
clicker:set_wielded_item(itemstack)
|
||||||
inv:add_item("main", "homedecor:beer_mug 1")
|
inv:add_item("main", "homedecor:beer_mug 1")
|
||||||
minetest.chat_send_player(puncher:get_player_name(),
|
minetest.chat_send_player(clicker:get_player_name(),
|
||||||
S("Ahh, a frosty cold beer - look in your inventory for it!"))
|
S("Ahh, a frosty cold beer - look in your inventory for it!"))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(puncher:get_player_name(),
|
minetest.chat_send_player(clicker:get_player_name(),
|
||||||
S("No room in your inventory to add a beer mug!"))
|
S("No room in your inventory to add a beer mug!"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -196,21 +195,21 @@ homedecor.register("soda_machine", {
|
|||||||
expand = { top="placeholder" },
|
expand = { top="placeholder" },
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local wielditem = puncher:get_wielded_item()
|
local wielditem = clicker:get_wielded_item()
|
||||||
local wieldname = wielditem:get_name()
|
local wieldname = wielditem:get_name()
|
||||||
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} }
|
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} }
|
||||||
local fdir = node.param2
|
local fdir = node.param2
|
||||||
local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] }
|
local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] }
|
||||||
if wieldname == "homedecor:coin" then
|
if wieldname == "homedecor:coin" then
|
||||||
wielditem:take_item()
|
wielditem:take_item()
|
||||||
puncher:set_wielded_item(wielditem)
|
clicker:set_wielded_item(wielditem)
|
||||||
minetest.spawn_item(pos_drop, "homedecor:soda_can")
|
minetest.spawn_item(pos_drop, "homedecor:soda_can")
|
||||||
minetest.sound_play("insert_coin", {
|
minetest.sound_play("insert_coin", {
|
||||||
pos=pos, max_hear_distance = 5
|
pos=pos, max_hear_distance = 5
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(puncher:get_player_name(), S("Please insert a coin in the machine."))
|
minetest.chat_send_player(clicker:get_player_name(), S("Please insert a coin in the machine."))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -513,7 +513,7 @@ homedecor.register("ceiling_lamp", {
|
|||||||
light_source = default.LIGHT_MAX,
|
light_source = default.LIGHT_MAX,
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
walkable = false,
|
walkable = false,
|
||||||
on_punch = function(pos, node, puncher)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.set_node(pos, {name = "homedecor:ceiling_lamp_off"})
|
minetest.set_node(pos, {name = "homedecor:ceiling_lamp_off"})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -529,7 +529,7 @@ homedecor.register("ceiling_lamp_off", {
|
|||||||
},
|
},
|
||||||
groups = {snappy=3, not_in_creative_inventory=1},
|
groups = {snappy=3, not_in_creative_inventory=1},
|
||||||
walkable = false,
|
walkable = false,
|
||||||
on_punch = function(pos, node, puncher)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.set_node(pos, {name = "homedecor:ceiling_lamp"})
|
minetest.set_node(pos, {name = "homedecor:ceiling_lamp"})
|
||||||
end,
|
end,
|
||||||
drop = "homedecor:ceiling_lamp"
|
drop = "homedecor:ceiling_lamp"
|
||||||
|
@ -127,7 +127,7 @@ minetest.register_node("plasmascreen:tv", {
|
|||||||
return true -- "API: If return true no item is taken from itemstack"
|
return true -- "API: If return true no item is taken from itemstack"
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.set_node(pos, {name = "plasmascreen:tv_off", param2 = node.param2})
|
minetest.set_node(pos, {name = "plasmascreen:tv_off", param2 = node.param2})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -155,7 +155,7 @@ minetest.register_node("plasmascreen:tv_off", {
|
|||||||
return true -- "API: If return true no item is taken from itemstack"
|
return true -- "API: If return true no item is taken from itemstack"
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_punch = function(pos, node, puncher, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
minetest.set_node(pos, {name = "plasmascreen:tv", param2 = node.param2})
|
minetest.set_node(pos, {name = "plasmascreen:tv", param2 = node.param2})
|
||||||
end,
|
end,
|
||||||
drop = "plasmascreen:tv"
|
drop = "plasmascreen:tv"
|
||||||
|
Loading…
Reference in New Issue
Block a user