Log cleanups.

This commit is contained in:
Hector Franqui 2017-08-25 09:33:25 -04:00
parent 4c102a70a4
commit 11e871a932

11
npc.lua
View File

@ -1226,7 +1226,7 @@ mobs:register_mob("advanced_npc:npc", {
local item = clicker:get_wielded_item() local item = clicker:get_wielded_item()
local name = clicker:get_player_name() local name = clicker:get_player_name()
npc.log("INFO", "Right-clicked NPC: "..dump(self)) npc.log("DEBUG", "Right-clicked NPC: "..dump(self))
-- Receive gift or start chat. If player has no item in hand -- Receive gift or start chat. If player has no item in hand
-- then it is going to start chat directly -- then it is going to start chat directly
@ -1373,14 +1373,13 @@ mobs:register_mob("advanced_npc:npc", {
if schedule ~= nil then if schedule ~= nil then
-- Check if schedule for this time exists -- Check if schedule for this time exists
if schedule[time] ~= nil then if schedule[time] ~= nil then
npc.log("WARNING", "Found schedule for time "..dump(time)..": "..dump(schedule[time]))
npc.log("DEBUG", "Adding actions to action queue") npc.log("DEBUG", "Adding actions to action queue")
-- Add to action queue all actions on schedule -- Add to action queue all actions on schedule
for i = 1, #schedule[time] do for i = 1, #schedule[time] do
-- Check if schedule has a check function -- Check if schedule has a check function
if schedule[time][i].check then if schedule[time][i].check then
-- Add parameters for check function and run for first time -- Add parameters for check function and run for first time
npc.log("INFO", "NPC "..dump(self.npc_name).." is starting check on "..minetest.pos_to_string(self.object:getpos())) npc.log("DEBUG", "NPC "..dump(self.npc_name).." is starting check on "..minetest.pos_to_string(self.object:getpos()))
local check_params = schedule[time][i] local check_params = schedule[time][i]
-- Calculates how many times check will be executed -- Calculates how many times check will be executed
local execution_times = check_params.count local execution_times = check_params.count
@ -1399,7 +1398,7 @@ mobs:register_mob("advanced_npc:npc", {
-- Execute check for the first time -- Execute check for the first time
npc.schedule_check(self) npc.schedule_check(self)
else else
npc.log("INFO", "Executing schedule entry: "..dump(schedule[time][i])) npc.log("DEBUG", "Executing schedule entry: "..dump(schedule[time][i]))
-- Run usual schedule entry -- Run usual schedule entry
-- Check chance -- Check chance
local execution_chance = math.random(1, 100) local execution_chance = math.random(1, 100)
@ -1434,13 +1433,13 @@ mobs:register_mob("advanced_npc:npc", {
end end
else else
-- TODO: Change to debug -- TODO: Change to debug
npc.log("WARNING", "Skipping schedule entry for time "..dump(time)..": "..dump(schedule[time][i])) npc.log("DEBUG", "Skipping schedule entry for time "..dump(time)..": "..dump(schedule[time][i]))
end end
end end
end end
-- Clear execution queue -- Clear execution queue
self.schedules.temp_executed_queue = {} self.schedules.temp_executed_queue = {}
npc.log("WARNING", "New action queue: "..dump(self.actions)) npc.log("DEBUG", "New action queue: "..dump(self.actions))
end end
end end
else else