diff options
author | Beha <shacknetisp@mail.com> | 2018-09-25 11:09:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 11:09:48 -0400 |
commit | 4f389f287c3d7c5ea286b0b8a2984bc4be9537f0 (patch) | |
tree | 821d93edec8d7db2a2c63a761956e1e736b54925 | |
parent | fab6941d5e8d29500fd1f2c231e527f0ab1b2083 (diff) | |
parent | 54ddb29a0431d9bb09e3480b2bd471b10b91733d (diff) | |
download | elevator-4f389f287c3d7c5ea286b0b8a2984bc4be9537f0.tar.gz elevator-4f389f287c3d7c5ea286b0b8a2984bc4be9537f0.tar.bz2 elevator-4f389f287c3d7c5ea286b0b8a2984bc4be9537f0.zip |
Merge pull request #5 from CloudyProton/patch-1
Do not show floor set label option to non-owners
-rw-r--r-- | init.lua | 43 |
1 files changed, 32 insertions, 11 deletions
@@ -481,29 +481,50 @@ for _,mode in ipairs({"on", "off"}) do end formspecs[sender:get_player_name()] = {pos, tpnames} if #tpnames > 0 then - formspec = "size[4,6]" - .."label[0,0;Click once to travel.]" - .."textlist[-0.1,0.5;4,4;target;"..table.concat(tpnames_l, ",").."]" - .."field[0.25,5.25;4,0;label;;"..minetest.formspec_escape(meta:get_string("label")).."]" - .."button_exit[-0.05,5.5;4,1;setlabel;Set label]" + if not minetest.is_protected(pos, sender:get_player_name()) then + formspec = "size[4,6]" + .."label[0,0;Click once to travel.]" + .."textlist[-0.1,0.5;4,4;target;"..table.concat(tpnames_l, ",").."]" + .."field[0.25,5.25;4,0;label;;"..minetest.formspec_escape(meta:get_string("label")).."]" + .."button_exit[-0.05,5.5;4,1;setlabel;Set label]" + else + formspec = "size[4,4.4]" + .."label[0,0;Click once to travel.]" + .."textlist[-0.1,0.5;4,4;target;"..table.concat(tpnames_l, ",").."]" + end else - formspec = "size[4,2]" - .."label[0,0;No targets available.]" - .."field[0.25,1.25;4,0;label;;"..minetest.formspec_escape(meta:get_string("label")).."]" - .."button_exit[-0.05,1.5;4,1;setlabel;Set label]" + if not minetest.is_protected(pos, sender:get_player_name()) then + formspec = "size[4,2]" + .."label[0,0;No targets available.]" + .."field[0.25,1.25;4,0;label;;"..minetest.formspec_escape(meta:get_string("label")).."]" + .."button_exit[-0.05,1.5;4,1;setlabel;Set label]" + else + formspec = "size[4,0.4]" + .."label[0,0;No targets available.]" + end end minetest.show_formspec(sender:get_player_name(), "elevator:elevator", formspec) elseif not elevator.motors[meta:get_string("motor")] then - formspec = "size[4,2]" + if not minetest.is_protected(pos, sender:get_player_name()) then + formspec = "size[4,2]" .."label[0,0;This elevator is inactive.]" .."field[0.25,1.25;4,0;label;;"..minetest.formspec_escape(meta:get_string("label")).."]" .."button_exit[-0.05,1.5;4,1;setlabel;Set label]" + else + formspec = "size[4,0.4]" + .."label[0,0;This elevator is inactive.]" + end minetest.show_formspec(sender:get_player_name(), "elevator:elevator", formspec) elseif boxes[meta:get_string("motor")] then - formspec = "size[4,2]" + if not minetest.is_protected(pos, sender:get_player_name()) then + formspec = "size[4,2]" .."label[0,0;This elevator is in use.]" .."field[0.25,1.25;4,0;label;;"..minetest.formspec_escape(meta:get_string("label")).."]" .."button_exit[-0.05,1.5;4,1;setlabel;Set label]" + else + formspec = "size[4,0.4]" + .."label[0,0;This elevator is in use.]" + end minetest.show_formspec(sender:get_player_name(), "elevator:elevator", formspec) end end, |