actually print the debug output for variable changes

This commit is contained in:
Sokomine 2021-08-03 19:18:42 +02:00
parent 7117131207
commit c5aca7d9a8

View File

@ -124,6 +124,21 @@ yl_speak_up.set_quest_variable_value = function(player_name, variable_name, new_
if(not(variable_name) or not(player_name) or not(yl_speak_up.player_vars[ k ])) then
return false
end
if(yl_speak_up.player_vars[ k ]["$META$"]
and yl_speak_up.player_vars[ k ]["$META$"][ "debug" ]
and type(yl_speak_up.player_vars[ k ]["$META$"][ "debug" ]) == "table") then
for p, _ in pairs(yl_speak_up.player_vars[ k ]["$META$"][ "debug" ]) do
minetest.chat_send_player(p, "[Variable "..
minetest.colorize("#FFFF00", tostring(k))..
", player "..
minetest.colorize("#FFFF00", tostring(player_name))..
"] old value: \""..
minetest.colorize("#FFFF00",
tostring(yl_speak_up.player_vars[ k ][ player_name ]))..
"\" new value: \""..
minetest.colorize("#FFFF00", tostring(new_value)).."\".")
end
end
if(new_value ~= nil) then
new_value = tostring(new_value)
end