diff options
author | luk3yx <luk3yx@users.noreply.github.com> | 2020-04-02 18:03:53 +1300 |
---|---|---|
committer | luk3yx <luk3yx@users.noreply.github.com> | 2020-04-02 18:03:53 +1300 |
commit | df0d86d66d24685ea9c98129f37eb2aef5399c34 (patch) | |
tree | 6f9f3dda41064bbb7c9e196f68cbfb59c5b1cb2b | |
parent | 4924457eac47fc3a1c6c47834ed064b1b2089923 (diff) | |
download | elevator-df0d86d66d24685ea9c98129f37eb2aef5399c34.tar.gz elevator-df0d86d66d24685ea9c98129f37eb2aef5399c34.tar.bz2 elevator-df0d86d66d24685ea9c98129f37eb2aef5399c34.zip |
Fix #8.
-rw-r--r-- | components.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/components.lua b/components.lua index d018ee0..7c182ae 100644 --- a/components.lua +++ b/components.lua @@ -255,7 +255,8 @@ for _,mode in ipairs({"on", "off"}) do local formspec local meta = minetest.get_meta(pos) elevator.formspecs[sender:get_player_name()] = {pos} - if on then + local motorhash = meta:get_string("motor") + if on and elevator.motors[motorhash] then if vector.distance(sender:getpos(), pos) > 1 or minetest.get_node(sender:getpos()).name ~= nodename then minetest.chat_send_player(sender:get_player_name(), "You are not inside the booth.") return @@ -263,7 +264,6 @@ for _,mode in ipairs({"on", "off"}) do -- Build the formspec from the motor table. local tpnames = {} local tpnames_l = {} - local motorhash = meta:get_string("motor") local motor = elevator.motors[motorhash] for ji,jv in ipairs(motor.pnames) do if tonumber(jv) ~= pos.y then @@ -296,7 +296,7 @@ for _,mode in ipairs({"on", "off"}) do end end minetest.show_formspec(sender:get_player_name(), "elevator:elevator", formspec) - elseif not elevator.motors[meta:get_string("motor")] then + elseif not elevator.motors[motorhash] then if not minetest.is_protected(pos, sender:get_player_name()) then formspec = "size[4,2]" .."label[0,0;This elevator is inactive.]" @@ -307,7 +307,7 @@ for _,mode in ipairs({"on", "off"}) do .."label[0,0;This elevator is inactive.]" end minetest.show_formspec(sender:get_player_name(), "elevator:elevator", formspec) - elseif elevator.boxes[meta:get_string("motor")] then + elseif elevator.boxes[motorhash] then if not minetest.is_protected(pos, sender:get_player_name()) then formspec = "size[4,2]" .."label[0,0;This elevator is in use.]" |