From 337f8c46b72f3920afc26c93f9466cf39634eb38 Mon Sep 17 00:00:00 2001 From: Hector Franqui Date: Tue, 29 Aug 2017 14:55:38 -0400 Subject: [PATCH] Small bug fixes and log cleanups. --- dialogue.lua | 2 +- relationships.lua | 2 +- utils.lua | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dialogue.lua b/dialogue.lua index 41e623c..825d3fc 100644 --- a/dialogue.lua +++ b/dialogue.lua @@ -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. diff --git a/relationships.lua b/relationships.lua index 91cfdbe..874c849 100644 --- a/relationships.lua +++ b/relationships.lua @@ -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 diff --git a/utils.lua b/utils.lua index 2391b73..a6bbde0 100644 --- a/utils.lua +++ b/utils.lua @@ -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.