added vars with access rights to lists of available vars

This commit is contained in:
Sokomine 2021-07-29 19:56:47 +02:00
parent 30d14ed999
commit c8345cee4d

View File

@ -138,8 +138,20 @@ yl_speak_up.get_quest_variables = function(pname, has_write_access)
table.insert(liste, k)
end
end
else
local right = "read_access"
if(has_write_access) then
right = "write_access"
end
-- insert those vars owned by other players where this one has access
for k, v in pairs(yl_speak_up.player_vars) do
if( k[ "$META$"]
and k[ "$META$"][ right ]
and k[ "$META$"][ right ][ pname ]) then
table.insert(liste, k)
end
end
end
-- TODO: insert those vars owned by other players where this one has read access to
table.sort(liste)
return liste
end
@ -489,6 +501,9 @@ end
-- does the opposite of the function above; adds "$ PNAME " if needed
yl_speak_up.add_pname_to_var = function(var_name, pname)
if(not(var_name)) then
return ""
end
local parts = string.split(var_name, " ")
if(parts and parts[1] and parts[1] ~= "$") then
return "$ "..tostring(pname).." "..tostring(var_name)