forked from nalc/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,
|
||||
groups = {cracky=3},
|
||||
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"
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ homedecor.register("toilet_open", {
|
|||
drop = "homedecor:toilet",
|
||||
groups = {cracky=3},
|
||||
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"
|
||||
minetest.set_node(pos, node)
|
||||
minetest.sound_play("homedecor_toilet_flush", {
|
||||
|
|
|
@ -59,7 +59,7 @@ homedecor.register("desk_fan", {
|
|||
meta:set_string("active", "no")
|
||||
add_mesh_desk_fan_entity(pos)
|
||||
end,
|
||||
on_punch = function(pos)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local entities = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
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
|
||||
}
|
||||
},
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
minetest.sound_play("homedecor_doorbell", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
|
|
|
@ -11,7 +11,7 @@ homedecor.register("speaker", {
|
|||
},
|
||||
groups = { snappy = 3 },
|
||||
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})
|
||||
end
|
||||
})
|
||||
|
@ -27,7 +27,7 @@ homedecor.register("speaker_open", {
|
|||
},
|
||||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
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})
|
||||
end
|
||||
})
|
||||
|
|
|
@ -134,20 +134,19 @@ homedecor.register("beer_tap", {
|
|||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 }
|
||||
},
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
local wielditem = puncher:get_wielded_item()
|
||||
local inv = puncher:get_inventory()
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local inv = clicker:get_inventory()
|
||||
|
||||
local wieldname = wielditem:get_name()
|
||||
local wieldname = itemstack:get_name()
|
||||
if wieldname == "vessels:drinking_glass" then
|
||||
if inv:room_for_item("main", "homedecor:beer_mug 1") then
|
||||
wielditem:take_item()
|
||||
puncher:set_wielded_item(wielditem)
|
||||
itemstack:take_item()
|
||||
clicker:set_wielded_item(itemstack)
|
||||
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!"))
|
||||
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!"))
|
||||
end
|
||||
end
|
||||
|
@ -196,21 +195,21 @@ homedecor.register("soda_machine", {
|
|||
expand = { top="placeholder" },
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rotate = screwdriver.rotate_simple,
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
local wielditem = puncher:get_wielded_item()
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local wielditem = clicker:get_wielded_item()
|
||||
local wieldname = wielditem:get_name()
|
||||
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} }
|
||||
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] }
|
||||
if wieldname == "homedecor:coin" then
|
||||
wielditem:take_item()
|
||||
puncher:set_wielded_item(wielditem)
|
||||
clicker:set_wielded_item(wielditem)
|
||||
minetest.spawn_item(pos_drop, "homedecor:soda_can")
|
||||
minetest.sound_play("insert_coin", {
|
||||
pos=pos, max_hear_distance = 5
|
||||
})
|
||||
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
|
||||
})
|
||||
|
|
|
@ -513,7 +513,7 @@ homedecor.register("ceiling_lamp", {
|
|||
light_source = default.LIGHT_MAX,
|
||||
groups = {snappy=3},
|
||||
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"})
|
||||
end,
|
||||
})
|
||||
|
@ -529,7 +529,7 @@ homedecor.register("ceiling_lamp_off", {
|
|||
},
|
||||
groups = {snappy=3, not_in_creative_inventory=1},
|
||||
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"})
|
||||
end,
|
||||
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"
|
||||
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})
|
||||
end
|
||||
})
|
||||
|
@ -155,7 +155,7 @@ minetest.register_node("plasmascreen:tv_off", {
|
|||
return true -- "API: If return true no item is taken from itemstack"
|
||||
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})
|
||||
end,
|
||||
drop = "plasmascreen:tv"
|
||||
|
|
Loading…
Reference in New Issue
Block a user