forked from Sokomine/yl_speak_up
allow to show usage of internal variables again
This commit is contained in:
parent
cbaf8d4640
commit
58b5aa2cbb
@ -983,7 +983,9 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields,
|
|||||||
"back_from_show_var_usage",
|
"back_from_show_var_usage",
|
||||||
"Back to select "..effect_name.." "..tostring(x_id)..
|
"Back to select "..effect_name.." "..tostring(x_id)..
|
||||||
" of option "..tostring(o_id)..
|
" of option "..tostring(o_id)..
|
||||||
" of dialog "..tostring(d_id))
|
" of dialog "..tostring(d_id),
|
||||||
|
-- internal variable?
|
||||||
|
(data and data.variable and data.variable < 3))
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -1007,7 +1009,9 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields,
|
|||||||
"back_from_error_msg",
|
"back_from_error_msg",
|
||||||
"Back to select "..effect_name.." "..tostring(x_id)..
|
"Back to select "..effect_name.." "..tostring(x_id)..
|
||||||
" of option "..tostring(o_id)..
|
" of option "..tostring(o_id)..
|
||||||
" of dialog "..tostring(d_id))
|
" of dialog "..tostring(d_id),
|
||||||
|
-- internal variable?
|
||||||
|
(data and data.variable and data.variable < 3))
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -384,7 +384,6 @@ end
|
|||||||
|
|
||||||
-- which NPC do use this variable?
|
-- which NPC do use this variable?
|
||||||
yl_speak_up.get_npc_users_of_variable = function(var_name)
|
yl_speak_up.get_npc_users_of_variable = function(var_name)
|
||||||
var_name = yl_speak_up.restore_complete_var_name(var_name, pname)
|
|
||||||
-- no variable, or nothing stored? then it's not used by any NPC either
|
-- no variable, or nothing stored? then it's not used by any NPC either
|
||||||
if(not(var_name)
|
if(not(var_name)
|
||||||
or not(yl_speak_up.player_vars[ var_name ])
|
or not(yl_speak_up.player_vars[ var_name ])
|
||||||
@ -427,9 +426,13 @@ end
|
|||||||
|
|
||||||
-- find out where this variable is used in NPCs
|
-- find out where this variable is used in NPCs
|
||||||
yl_speak_up.get_list_of_usage_of_variable = function(var_name, pname, check_preconditions,
|
yl_speak_up.get_list_of_usage_of_variable = function(var_name, pname, check_preconditions,
|
||||||
back_button_name, back_button_text)
|
back_button_name, back_button_text, is_internal_var)
|
||||||
|
-- TODO: check if the player really has read access to this variable
|
||||||
|
if(not(is_internal_var)) then
|
||||||
var_name = yl_speak_up.restore_complete_var_name(var_name, pname)
|
var_name = yl_speak_up.restore_complete_var_name(var_name, pname)
|
||||||
|
end
|
||||||
-- which NPC (might be several) is using this variable?
|
-- which NPC (might be several) is using this variable?
|
||||||
|
-- TODO: ..or if the player at least is owner of these NPC or has extended privs
|
||||||
local npc_list = yl_speak_up.get_npc_users_of_variable(var_name)
|
local npc_list = yl_speak_up.get_npc_users_of_variable(var_name)
|
||||||
-- list of all relevant preconditions, actions and effects
|
-- list of all relevant preconditions, actions and effects
|
||||||
local res = {}
|
local res = {}
|
||||||
@ -552,12 +555,15 @@ yl_speak_up.get_list_of_usage_of_variable = function(var_name, pname, check_prec
|
|||||||
" and changed in "..
|
" and changed in "..
|
||||||
minetest.colorize("#55FF55", tostring(count_changed).." (Ef)fects")..
|
minetest.colorize("#55FF55", tostring(count_changed).." (Ef)fects")..
|
||||||
".]")
|
".]")
|
||||||
else
|
elseif(not(is_internal_var)) then
|
||||||
-- TODO: make delete_unused_variable work
|
-- TODO: make delete_unused_variable work
|
||||||
table.insert(formspec,
|
table.insert(formspec,
|
||||||
"button[0.2,30.6;56.6,1.2;delete_unused_variable;"..
|
"button[0.2,30.6;56.6,1.2;delete_unused_variable;"..
|
||||||
minetest.formspec_escape("Delete this unused variable \""..
|
minetest.formspec_escape("Delete this unused variable \""..
|
||||||
tostring(var_name or "- ? -")).."\".]")
|
tostring(var_name or "- ? -")).."\".]")
|
||||||
|
else
|
||||||
|
table.insert(formspec,
|
||||||
|
"label[16.0,31.0;This is an internal variable and cannot be deleted.]")
|
||||||
end
|
end
|
||||||
return table.concat(formspec, "\n")
|
return table.concat(formspec, "\n")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user