Fix incorrect privilege handling in tabs
This commit is contained in:
parent
b960d65805
commit
433b075cd9
14
init.lua
14
init.lua
@ -260,7 +260,7 @@ end
|
|||||||
|
|
||||||
--[[ This creates the edit tab of the formspec
|
--[[ This creates the edit tab of the formspec
|
||||||
fields: A template used to fill the default values of the formspec. ]]
|
fields: A template used to fill the default values of the formspec. ]]
|
||||||
function ltool.tab_edit(fields, has_priv)
|
function ltool.tab_edit(fields, has_ledit_priv)
|
||||||
if(fields==nil) then
|
if(fields==nil) then
|
||||||
fields = ltool.default_edit_fields
|
fields = ltool.default_edit_fields
|
||||||
end
|
end
|
||||||
@ -276,7 +276,7 @@ function ltool.tab_edit(fields, has_priv)
|
|||||||
|
|
||||||
-- Show save/clear buttons depending on privs
|
-- Show save/clear buttons depending on privs
|
||||||
local leditbuttons
|
local leditbuttons
|
||||||
if has_priv then
|
if has_ledit_priv then
|
||||||
leditbuttons = "button[2,8.7;4,0;edit_save;Save tree to database]"..
|
leditbuttons = "button[2,8.7;4,0;edit_save;Save tree to database]"..
|
||||||
"button[6,8.7;4,0;edit_clear;Clear fields]"
|
"button[6,8.7;4,0;edit_clear;Clear fields]"
|
||||||
|
|
||||||
@ -360,12 +360,12 @@ function ltool.tab_database(index, playername)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--[[ This creates the "Plant" tab part of the main formspec ]]
|
--[[ This creates the "Plant" tab part of the main formspec ]]
|
||||||
function ltool.tab_plant(tree, fields, has_priv)
|
function ltool.tab_plant(tree, fields, has_lplant_priv)
|
||||||
if(tree ~= nil) then
|
if(tree ~= nil) then
|
||||||
local seltree = "label[0,-0.2;Selected tree: "..minetest.formspec_escape(tree.name).."]"
|
local seltree = "label[0,-0.2;Selected tree: "..minetest.formspec_escape(tree.name).."]"
|
||||||
if not has_priv then
|
if not has_lplant_priv then
|
||||||
return seltree..
|
return seltree..
|
||||||
"label[0,0.3;Planting of trees is not allowed. You need to have the “ledit” privilege.]"
|
"label[0,0.3;Planting of trees is not allowed. You need to have the “lplant” privilege.]"
|
||||||
end
|
end
|
||||||
if(fields==nil) then
|
if(fields==nil) then
|
||||||
fields = {}
|
fields = {}
|
||||||
@ -418,7 +418,7 @@ but it is added anyways in case this gets fixed in later Minetest versions. ]]
|
|||||||
"tooltip[sapling;This gives you an item which you can place manually in the world later]"
|
"tooltip[sapling;This gives you an item which you can place manually in the world later]"
|
||||||
else
|
else
|
||||||
local notreestr = "No tree in database selected or database is empty."
|
local notreestr = "No tree in database selected or database is empty."
|
||||||
if has_priv then
|
if has_lplant_priv then
|
||||||
return "label[0,0;"..notreestr.."]"
|
return "label[0,0;"..notreestr.."]"
|
||||||
else
|
else
|
||||||
return "label[0,0;"..notreestr.."\nYou are not allowed to plant trees anyway as you don't have the “lplant” privilege.]"
|
return "label[0,0;"..notreestr.."\nYou are not allowed to plant trees anyway as you don't have the “lplant” privilege.]"
|
||||||
@ -871,7 +871,7 @@ function ltool.process_form(player,formname,fields)
|
|||||||
if(ltool.number_of_trees > 0) then
|
if(ltool.number_of_trees > 0) then
|
||||||
contents = ltool.tab_plant(seltree, ltool.playerinfos[playername].treeform.plant.fields, privs.lplant)
|
contents = ltool.tab_plant(seltree, ltool.playerinfos[playername].treeform.plant.fields, privs.lplant)
|
||||||
else
|
else
|
||||||
contents = ltool.tab_plant(nil)
|
contents = ltool.tab_plant(nil, nil, privs.lplant)
|
||||||
end
|
end
|
||||||
subformname = "plant"
|
subformname = "plant"
|
||||||
elseif(tab==4) then
|
elseif(tab==4) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user