made check_variable accessible for excec_eval_preconditions.lua

This commit is contained in:
Sokomine 2022-01-05 19:17:59 +01:00
parent 9039fe08b9
commit 7b8e7f7322
2 changed files with 4 additions and 4 deletions

View File

@ -93,11 +93,11 @@ yl_speak_up.eval_precondition = function(player, n_id, p, other_options_true_or_
-- broken precondition
return false
-- "(internal) hour of ingame day", -- 2
elseif(p.p_variable == check_variable[2]) then
elseif(p.p_variable == yl_speak_up.precondition_check_variable[2]) then
-- timeofday is between 0..1; translate to 24 hours
var_val = math.floor((minetest.get_timeofday() * 24)+0.5)
-- "(internal) player's health points", -- 3
elseif(p.p_variable == check_variable[3]) then
elseif(p.p_variable == yl_speak_up.precondition_check_variable[3]) then
var_val = player:get_hp()
else
local pname = player:get_player_name()

View File

@ -148,7 +148,7 @@ local values_operator = {"", "==", "~=", ">=", ">", "<=", "<", "not", "is_set",
"quest_step_done", "quest_step_not_done"}
-- some internal ones...
local check_variable = {
yl_speak_up.precondition_check_variable = {
-- "- please select -", -- this is automaticly added to the var list
"(internal) hour of ingame day", -- 2
"(internal) player's health points", -- 3
@ -159,7 +159,7 @@ local check_variable = {
yl_speak_up.get_sorted_player_var_list_read_access = function(pname)
local var_list = {}
-- copy the values from check_variable
for i, v in ipairs(check_variable) do
for i, v in ipairs(yl_speak_up.precondition_check_variable) do
table.insert(var_list, v)
end
-- get the list of variables the player can read