mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-27 02:19:33 +01:00
Add rightclick support to pplates
This commit is contained in:
parent
d8c16b1f31
commit
7c87ed2d6c
1 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,16 @@ local pp_box_on = {
|
|||
fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
|
||||
}
|
||||
|
||||
local function pp_on_rightclick(pos, node)
|
||||
local basename = minetest.registered_nodes[node.name].pressureplate_basename
|
||||
if node.name == basename .. "_off" then
|
||||
minetest.set_node(pos, { name = basename .. "_on" })
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
else
|
||||
minetest.get_meta(pos):set_string("deact_time", "")
|
||||
end
|
||||
end
|
||||
|
||||
local function pp_on_timer(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local basename = minetest.registered_nodes[node.name].pressureplate_basename
|
||||
|
@ -164,6 +174,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
|
|||
walkable = false,
|
||||
description = description,
|
||||
on_timer = pp_on_timer,
|
||||
on_rightclick = pp_on_rightclick,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(PRESSURE_PLATE_INTERVAL)
|
||||
end,
|
||||
|
|
Loading…
Reference in a new issue