aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeha <shacknetisp@mail.com>2021-06-16 11:43:36 -0400
committerBeha <shacknetisp@mail.com>2021-06-16 11:44:09 -0400
commitd4910281f89c2515812e1b4f3d2be71d022ceca0 (patch)
treeefbd66733ad07eef62d513d2bdd9fedb1a371367
parent563a3502cc57ec194a28f68329bf0acd4823a247 (diff)
downloadelevator-d4910281f89c2515812e1b4f3d2be71d022ceca0.tar.gz
elevator-d4910281f89c2515812e1b4f3d2be71d022ceca0.tar.bz2
elevator-d4910281f89c2515812e1b4f3d2be71d022ceca0.zip
Do not open elevator formspec when holding elevator component.
Closes #14.
-rw-r--r--components.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/components.lua b/components.lua
index 8ebe5f9..649e5f6 100644
--- a/components.lua
+++ b/components.lua
@@ -300,6 +300,14 @@ for _,mode in ipairs({"on", "off"}) do
if not sender or not sender:is_player() then
return
end
+ -- Don't do anything when the player is holding elevator components.
+ if ({
+ ["elevator:elevator_off"] = true,
+ ["elevator:shaft"] = true,
+ ["elevator:motor"] = true,
+ })[sender:get_wielditem():get_name()] then
+ return
+ end
local formspec
local meta = minetest.get_meta(pos)
elevator.formspecs[sender:get_player_name()] = {pos}