Small bug fixes and log cleanups.

This commit is contained in:
Hector Franqui 2017-08-29 14:55:38 -04:00
parent 4ec8ad7f7f
commit 337f8c46b7
3 changed files with 11 additions and 3 deletions

View File

@ -325,7 +325,7 @@ function npc.dialogue.select_random_dialogues_for_npc(self, phase)
for i = 1, number_of_dialogues do
local key_id = math.random(1, #keys)
result.normal[i] = keys[key_id]
minetest.log("Adding dialogue: "..dump(dialogues[keys[key_id]]))
npc.log("DEBUG", "Adding dialogue: "..dump(dialogues[keys[key_id]]))
end
-- Add item hints.

View File

@ -209,7 +209,7 @@ function npc.relationships.get_dialogues_for_gift_item(item_name, dialogue_type,
if phase ~= nil then
tags[5] = phase
end
minetest.log("Searching with tags: "..dump(tags))
npc.log("DEBUG","Searching with tags: "..dump(tags))
return npc.dialogue.search_dialogue_by_tags(tags, true)
end

View File

@ -30,12 +30,20 @@ end
function npc.utils.get_map_keys(map)
local result = {}
for key, value in pairs(map) do
for key, _ in pairs(map) do
table.insert(result, key)
end
return result
end
function npc.utils.get_map_values(map)
local result = {}
for _, value in pairs(map) do
table.insert(result, value)
end
return result
end
-- This function searches for a node given the conditions specified in the
-- query object, starting from the given start_pos and up to a certain, specified
-- range.