diff --git a/actions/actions.lua b/actions/actions.lua index b1b689b..9845b28 100644 --- a/actions/actions.lua +++ b/actions/actions.lua @@ -201,7 +201,7 @@ function npc.actions.freeze(self, args) local freeze_mobs_api = args.freeze local disable_rightclick = args.disable_rightclick if disable_rightclick ~= nil then - npc.log("INFO", "Enabling interactions for NPC "..self.npc_name..": "..dump(not(disable_rightclick))) + --npc.log("INFO", "Enabling interactions for NPC "..self.npc_name..": "..dump(not(disable_rightclick))) self.enable_rightclick_interaction = not(disable_rightclick) end -- minetest.log("Received: "..dump(freeze_mobs_api)) @@ -751,7 +751,7 @@ end function npc.actions.use_furnace(self, args) local pos = get_pos_argument(self, args.pos) if pos == nil then - npc.log("WARNING", "Got nil position in 'use_furnace' using args.pos: "..dump(args.pos)) +-- npc.log("WARNING", "Got nil position in 'use_furnace' using args.pos: "..dump(args.pos)) return end @@ -787,16 +787,16 @@ function npc.actions.use_furnace(self, args) local fuel_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack(fuel_item.item_string)}}).time local total_fuel_time = fuel_time * npc.get_item_count(fuel_item.item_string) - npc.log("DEBUG", "Fuel time: "..dump(fuel_time)) + --npc.log("DEBUG", "Fuel time: "..dump(fuel_time)) -- Get item to cook's cooking time local cook_result = minetest.get_craft_result({method="cooking", width=1, items={ItemStack(src_item.item_string)}}) local total_cook_time = cook_result.time * npc.get_item_count(item) - npc.log("DEBUG", "Cook: "..dump(cook_result)) + --npc.log("DEBUG", "Cook: "..dump(cook_result)) - npc.log("DEBUG", "Total cook time: "..total_cook_time - ..", total fuel burn time: "..dump(total_fuel_time)) +-- npc.log("DEBUG", "Total cook time: "..total_cook_time +-- ..", total fuel burn time: "..dump(total_fuel_time)) -- Check if there is enough fuel to cook all items if total_cook_time > total_fuel_time then @@ -844,7 +844,7 @@ function npc.actions.use_furnace(self, args) npc.add_action(self, npc.actions.cmd.PUT_ITEM, args) -- Now, set NPC to wait until furnace is done. - npc.log("DEBUG", "Setting wait action for "..dump(total_cook_time)) +-- npc.log("DEBUG", "Setting wait action for "..dump(total_cook_time)) npc.add_action(self, npc.actions.cmd.SET_INTERVAL, {interval=total_cook_time, freeze=freeze}) -- Reset timer @@ -853,7 +853,7 @@ function npc.actions.use_furnace(self, args) -- If freeze is false, then we will have to find the way back to the furnace -- once cooking is done. if freeze == false then - npc.log("DEBUG", "Adding walk to position to wandering: "..dump(pos)) +-- npc.log("DEBUG", "Adding walk to position to wandering: "..dump(pos)) npc.add_task(self, npc.actions.cmd.WALK_TO_POS, {end_pos=pos, walkable={}}) end @@ -870,7 +870,7 @@ function npc.actions.use_furnace(self, args) npc.log("DEBUG", "Taking item back: "..minetest.pos_to_string(pos)) npc.add_action(self, npc.actions.cmd.TAKE_ITEM, args) - npc.log("DEBUG", "Inventory: "..dump(self.inventory)) +-- npc.log("DEBUG", "Inventory: "..dump(self.inventory)) -- Set furnace as unused if flag is enabled if enable_usage_marking then @@ -890,7 +890,7 @@ end function npc.actions.use_bed(self, args) local pos = get_pos_argument(self, args.pos) if pos == nil then - npc.log("WARNING", "Got nil position in 'use_bed' using args.pos: "..dump(args.pos)) +-- npc.log("WARNING", "Got nil position in 'use_bed' using args.pos: "..dump(args.pos)) return end local action = args.action @@ -973,7 +973,7 @@ end function npc.actions.use_sittable(self, args) local pos = get_pos_argument(self, args.pos) if pos == nil then - npc.log("WARNING", "Got nil position in 'use_sittable' using args.pos: "..dump(args.pos)) +-- npc.log("WARNING", "Got nil position in 'use_sittable' using args.pos: "..dump(args.pos)) return end local action = args.action @@ -1068,7 +1068,7 @@ function npc.actions.walk_to_pos(self, args) local use_access_node = args.use_access_node or true local end_pos, node_pos = get_pos_argument(self, args.end_pos, use_access_node) if end_pos == nil then - npc.log("WARNING", "Got nil position in 'walk_to_pos' using args.pos: "..dump(args.end_pos)) +-- npc.log("WARNING", "Got nil position in 'walk_to_pos' using args.pos: "..dump(args.end_pos)) return end local enforce_move = args.enforce_move or true @@ -1128,7 +1128,7 @@ function npc.actions.walk_to_pos(self, args) if use_access_node == true then dir = npc.actions.get_direction(end_pos, node_pos) end - minetest.log("Dir: "..dump(dir)) +-- minetest.log("Dir: "..dump(dir)) -- Change dir if using access_node npc.add_action(self, npc.actions.cmd.STAND, {dir = dir}) break @@ -1146,6 +1146,8 @@ function npc.actions.walk_to_pos(self, args) -- Open door npc.add_action(self, npc.actions.cmd.USE_OPENABLE, {pos=path[i+1].pos, dir=dir, action=npc.actions.const.doors.action.OPEN}) + door_opened = true + else door_opened = true end @@ -1170,9 +1172,10 @@ function npc.actions.walk_to_pos(self, args) -- Add extra walk step to ensure that one is standing at other side of openable node -- npc.add_action(self, npc.actions.cmd.WALK_STEP, {dir = dir, speed = speed, target_pos = path[i+2].pos}) -- Stop to close the door - npc.add_action(self, npc.actions.cmd.STAND, {dir=(dir + 2) % 4 })--, pos=pos_on_close}) + --npc.add_action(self, npc.actions.cmd.STAND, {dir=(dir + 2) % 4 })--, pos=pos_on_close}) + npc.add_action(self, npc.actions.cmd.STAND, {dir=dir })--, pos=pos_on_close}) -- Close door - npc.add_action(self, npc.actions.cmd.USE_OPENABLE, {pos=path[i+1].pos, action=npc.actions.const.doors.action.CLOSE}) + npc.add_action(self, npc.actions.cmd.USE_OPENABLE, {pos=path[i+1].pos, dir=dir, action=npc.actions.const.doors.action.CLOSE}) door_opened = false end diff --git a/actions/pathfinder.lua b/actions/pathfinder.lua index e055aed..860a045 100644 --- a/actions/pathfinder.lua +++ b/actions/pathfinder.lua @@ -67,7 +67,7 @@ function pathfinder.get_decorated_path(path) type=pathfinder.is_good_node(node, {})}) end - npc.log("DEBUG", "Detailed path: "..dump(path_detail)) + --npc.log("DEBUG", "Detailed path: "..dump(path_detail)) return path_detail end diff --git a/actions/places.lua b/actions/places.lua index a8e44e0..6561835 100644 --- a/actions/places.lua +++ b/actions/places.lua @@ -179,8 +179,8 @@ function npc.places.add_owned_accessible_place(self, nodes, place_type, walkable -- Assign node to NPC npc.places.add_owned(self, place_type, place_type, nodes[i].node_pos, empty_nodes[1].pos) - npc.log("DEBUG", "Added node at "..minetest.pos_to_string(nodes[i].node_pos) - .." to NPC "..dump(self.npc_name)) +-- npc.log("DEBUG", "Added node at "..minetest.pos_to_string(nodes[i].node_pos) +-- .." to NPC "..dump(self.npc_name)) break end end @@ -227,12 +227,12 @@ function npc.places.mark_place_used(pos, value) local meta = minetest.get_meta(pos) local used = meta:get_string("advanced_npc:used") if value == used then - npc.log("WARNING", "Attempted to set 'used' property of node at " - ..minetest.pos_to_string(pos).." to the same value: '"..dump(value).."'") +-- npc.log("WARNING", "Attempted to set 'used' property of node at " +-- ..minetest.pos_to_string(pos).." to the same value: '"..dump(value).."'") return false else meta:set_string("advanced_npc:used", value) - npc.log("DEBUG", "'Used' value at pos "..minetest.pos_to_string(pos)..": "..dump(meta:get_string("advanced_npc:used"))) +-- npc.log("DEBUG", "'Used' value at pos "..minetest.pos_to_string(pos)..": "..dump(meta:get_string("advanced_npc:used"))) return true end end diff --git a/data/gift_items_data.lua b/data/gift_items_data.lua index cd0b286..1678e8d 100644 --- a/data/gift_items_data.lua +++ b/data/gift_items_data.lua @@ -233,7 +233,7 @@ npc.relationships.register_disliked_item("default:cobble", "male", { hints = {"If I really hate something, that's cobblestone!"} }) -npc.log("DEBUG", "Registered gift items: "..dump(npc.relationships.gift_items)) -npc.log("DEBUG", "Registered dialogues: "..dump(npc.dialogue.registered_dialogues)) +--npc.log("DEBUG", "Registered gift items: "..dump(npc.relationships.gift_items)) +--npc.log("DEBUG", "Registered dialogues: "..dump(npc.dialogue.registered_dialogues)) npc.log("INFO", "Registered gift items count: "..dump(#npc.relationships.gift_items)) -npc.log("INFO", "Registered dialogues count: "..dump(#npc.dialogue.registered_dialogues)) \ No newline at end of file +npc.log("INFO", "Registered dialogues count: "..dump(#npc.dialogue.registered_dialogues)) diff --git a/dialogue.lua b/dialogue.lua index f4e4d33..da124cc 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] - npc.log("DEBUG", "Adding dialogue: "..dump(dialogues[keys[key_id]])) + --npc.log("DEBUG", "Adding dialogue: "..dump(dialogues[keys[key_id]])) end -- Add item hints. @@ -352,7 +352,7 @@ function npc.dialogue.select_random_dialogues_for_npc(self, phase) end end - npc.log("DEBUG", "Dialogue results:"..dump(result)) + --npc.log("DEBUG", "Dialogue results:"..dump(result)) return result end @@ -446,7 +446,7 @@ function npc.dialogue.start_dialogue(self, player, show_married_dialogue) dialogue = self.dialogues.normal[math.random(1, #self.dialogues.normal)] elseif chance >= 90 then -- Check if gift items hints are enabled - minetest.log("Self gift data enable: "..dump(self.gift_data.enable_gift_items_hints)) + --minetest.log("Self gift data enable: "..dump(self.gift_data.enable_gift_items_hints)) if self.gift_data.enable_gift_items_hints then -- Choose a random dialogue line from the favorite/disliked item hints dialogue = self.dialogues.hints[math.random(1, 4)] @@ -669,7 +669,7 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) elseif player_response.is_custom_trade_dialogue == true then -- Functions for a custom trade should be available from the same dialogue -- object as they are created on demand - minetest.log("Player response: "..dump(player_response.options[i])) + --minetest.log("Player response: "..dump(player_response.options[i])) player_response.options[i].action(player_response.npc, player) else -- Get dialogue from registered dialogues diff --git a/npc.lua b/npc.lua index 52652fc..bd94ba9 100755 --- a/npc.lua +++ b/npc.lua @@ -556,9 +556,9 @@ function npc.initialize(entity, pos, is_lua_entity, npc_stats, occupation_name) -- Set initialized flag on ent.initialized = true --npc.log("WARNING", "Spawned entity: "..dump(ent)) - npc.log("INFO", "Successfully initialized NPC with name "..dump(ent.npc_name) - ..", sex: "..ent.sex..", is child: "..dump(ent.is_child) - ..", texture: "..dump(ent.textures)) +-- npc.log("INFO", "Successfully initialized NPC with name "..dump(ent.npc_name) +-- ..", sex: "..ent.sex..", is child: "..dump(ent.is_child) +-- ..", texture: "..dump(ent.textures)) -- Refreshes entity ent.object:set_properties(ent) end @@ -745,10 +745,10 @@ end -- This function removes the first action in the action queue -- and then executes it function npc.execute_action(self) - npc.log("DEBUG_ACTION", "Current actions queue: "..dump(self.actions.queue)) + --npc.log("DEBUG_ACTION", "Current actions queue: "..dump(self.actions.queue)) -- Check if an action was interrupted if self.actions.current_action_state == npc.action_state.interrupted then - npc.log("DEBUG_ACTION", "Re-inserting interrupted action for NPC: '"..dump(self.npc_name).."': "..dump(self.actions.state_before_lock.interrupted_action)) + --npc.log("DEBUG_ACTION", "Re-inserting interrupted action for NPC: '"..dump(self.npc_name).."': "..dump(self.actions.state_before_lock.interrupted_action)) -- Insert into queue the interrupted action table.insert(self.actions.queue, 1, self.actions.state_before_lock.interrupted_action) -- Clear the action @@ -780,7 +780,7 @@ function npc.execute_action(self) -- If the entry is a task, then push all this new operations in -- stack fashion if action_obj.is_task == true then - npc.log("DEBUG_ACTION", "Executing task for NPC '"..dump(self.npc_name).."': "..dump(action_obj)) + --npc.log("DEBUG_ACTION", "Executing task for NPC '"..dump(self.npc_name).."': "..dump(action_obj)) -- Backup current queue local backup_queue = self.actions.queue -- Remove this "task" action from queue @@ -796,7 +796,7 @@ function npc.execute_action(self) table.insert(self.actions.queue, backup_queue[i]) end else - npc.log("DEBUG_ACTION", "Executing action for NPC '"..dump(self.npc_name).."': "..dump(action_obj)) + --npc.log("DEBUG_ACTION", "Executing action for NPC '"..dump(self.npc_name).."': "..dump(action_obj)) -- Store the action that is being executed self.actions.state_before_lock.interrupted_action = action_obj -- Store current position @@ -854,7 +854,7 @@ function npc.lock_actions(self) -- Freeze mobs_redo API self.freeze = false - npc.log("DEBUG_ACTION", "Locking NPC "..dump(self.npc_id).." actions") + --npc.log("DEBUG_ACTION", "Locking NPC "..dump(self.npc_id).." actions") end function npc.unlock_actions(self) @@ -883,7 +883,7 @@ function npc.unlock_actions(self) self.freeze = true end - npc.log("DEBUG_ACTION", "Unlocked NPC "..dump(self.npc_id).." actions") + --npc.log("DEBUG_ACTION", "Unlocked NPC "..dump(self.npc_id).." actions") end --------------------------------------------------------------------------------------- @@ -1044,8 +1044,8 @@ function npc.schedule_change_property(self, property, args) local itemlist_entry = itemlist[i] local current_itemstring = itemlist[i].name if itemlist_entry.random == true then - current_itemstring = current_itemstring - .." "..dump(math.random(itemlist_entry.min, itemlist_entry.max)) +-- current_itemstring = current_itemstring +-- .." "..dump(math.random(itemlist_entry.min, itemlist_entry.max)) else current_itemstring = current_itemstring.." "..tostring(itemlist_entry.count) end @@ -1118,7 +1118,7 @@ end -- None-action: array of entries {action=, args={}}. -- Will be executed when no node is found. function npc.schedule_check(self) - npc.log("DEBUG_SCHEDULE", "Prev Actions queue: "..dump(self.actions.queue)) + --npc.log("DEBUG_SCHEDULE", "Prev Actions queue: "..dump(self.actions.queue)) local range = self.schedules.current_check_params.range local walkable_nodes = self.schedules.current_check_params.walkable_nodes local nodes = self.schedules.current_check_params.nodes @@ -1129,7 +1129,7 @@ function npc.schedule_check(self) -- Search nodes local found_nodes = npc.places.find_node_nearby(start_pos, nodes, range) -- Check if any node was found - npc.log("DEBUG_SCHEDULE", "Found nodes using radius: "..dump(found_nodes)) + --npc.log("DEBUG_SCHEDULE", "Found nodes using radius: "..dump(found_nodes)) if found_nodes and #found_nodes > 0 then local node_pos local node @@ -1155,7 +1155,7 @@ function npc.schedule_check(self) -- Set node as a place -- Note: Code below isn't *adding* a node, but overwriting the -- place with "schedule_target_pos" place type - npc.log("DEBUG_SCHEDULE", "Found "..dump(node.name).." at pos: "..minetest.pos_to_string(node_pos)) + --npc.log("DEBUG_SCHEDULE", "Found "..dump(node.name).." at pos: "..minetest.pos_to_string(node_pos)) npc.places.add_shared_accessible_place( self, {owner="", node_pos=node_pos}, npc.places.PLACE_TYPE.SCHEDULE.TARGET, true, walkable_nodes) -- Get actions related to node and enqueue them @@ -1209,7 +1209,7 @@ function npc.schedule_check(self) -- Speed is default wandering speed. Target pos is node_pos -- Calculate dir if dir is random local dir = npc.actions.get_direction(start_pos, node_pos) - minetest.log("actions: "..dump(actions[node.name][i])) + --minetest.log("actions: "..dump(actions[node.name][i])) if actions[node.name][i].args.dir == "random" then dir = math.random(0,7) elseif type(actions[node.name][i].args.dir) == "number" then @@ -1271,7 +1271,7 @@ function npc.schedule_check(self) < self.schedules.current_check_params.execution_times then npc.add_schedule_check(self) end - npc.log("DEBUG_SCHEDULE", "Actions queue: "..dump(self.actions.queue)) + --npc.log("DEBUG_SCHEDULE", "Actions queue: "..dump(self.actions.queue)) else -- No nodes found, enqueue none_actions for i = 1, #none_actions do @@ -1289,7 +1289,7 @@ function npc.schedule_check(self) npc.add_schedule_check(self) end -- No nodes found - npc.log("DEBUG_SCHEDULE", "Actions queue: "..dump(self.actions.queue)) + --npc.log("DEBUG_SCHEDULE", "Actions queue: "..dump(self.actions.queue)) end end @@ -1333,7 +1333,7 @@ function npc.rightclick_interaction(self, clicker) local item = clicker:get_wielded_item() local name = clicker:get_player_name() - npc.log("DEBUG", "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 -- then it is going to start chat directly @@ -1389,7 +1389,7 @@ function npc.step(self, dtime) self.texture = {self.selected_texture} self.base_texture = {self.selected_texture} self.object:set_properties(self) - npc.log("WARNING", "Corrected textures on NPC child "..dump(self.npc_name)) + --npc.log("WARNING", "Corrected textures on NPC child "..dump(self.npc_name)) -- Set interval to large interval so this code isn't called frequently npc.texture_check.interval = 60 end @@ -1476,7 +1476,7 @@ function npc.step(self, dtime) time = (time) - (time % 1) -- Check if there is a schedule entry for this time -- Note: Currently only one schedule is supported, for day 0 - npc.log("DEBUG_SCHEDULE", "Time: "..dump(time)) + --npc.log("DEBUG_SCHEDULE", "Time: "..dump(time)) local schedule = self.schedules.generic[0] if schedule ~= nil then -- Check if schedule for this time exists @@ -1487,7 +1487,7 @@ function npc.step(self, dtime) -- Check if schedule has a check function if schedule[time][i].check then -- Add parameters for check function and run for first time - npc.log("DEBUG", "NPC "..dump(self.npc_id).." is starting check on "..minetest.pos_to_string(self.object:getpos())) + --npc.log("DEBUG", "NPC "..dump(self.npc_id).." is starting check on "..minetest.pos_to_string(self.object:getpos())) local check_params = schedule[time][i] -- Calculates how many times check will be executed local execution_times = check_params.count @@ -1509,8 +1509,8 @@ function npc.step(self, dtime) -- Enqueue the schedule check npc.add_schedule_check(self) else - npc.log("DEBUG_SCHEDULE", "Executing schedule entry for NPC "..dump(self.npc_id)..": " - ..dump(schedule[time][i])) + --npc.log("DEBUG_SCHEDULE", "Executing schedule entry for NPC "..dump(self.npc_id)..": " + --..dump(schedule[time][i])) -- Run usual schedule entry -- Check chance local execution_chance = math.random(1, 100) @@ -1545,13 +1545,13 @@ function npc.step(self, dtime) end else -- TODO: Change to debug - npc.log("DEBUG", "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 -- Clear execution queue self.schedules.temp_executed_queue = {} - npc.log("DEBUG", "New action queue: "..dump(self.actions.queue)) + --npc.log("DEBUG", "New action queue: "..dump(self.actions.queue)) end end else diff --git a/occupations/occupations.lua b/occupations/occupations.lua index df2b50f..ce9f7f2 100644 --- a/occupations/occupations.lua +++ b/occupations/occupations.lua @@ -260,7 +260,7 @@ function npc.occupations.register_occupation(name, def) -- Add to the dialogue tags the "occupation name" table.insert(dialogue.tags, name) -- Register dialogue - npc.log("INFO", "Registering dialogue for occupation "..dump(name)..": "..dump(dialogue)) + --npc.log("INFO", "Registering dialogue for occupation "..dump(name)..": "..dump(dialogue)) local key = npc.dialogue.register_dialogue(dialogue) -- Add key to set of dialogue keys table.insert(dialogue_keys, key) @@ -287,7 +287,7 @@ function npc.occupations.register_occupation(name, def) -- Save the definition npc.occupations.registered_occupations[name] = def - npc.log("INFO", "Successfully registered occupation with name: "..dump(name)) + --npc.log("INFO", "Successfully registered occupation with name: "..dump(name)) end -- This function scans all registered occupations and filter them by @@ -345,11 +345,11 @@ function npc.occupations.initialize_occupation_values(self, occupation_name) local def = npc.occupations.registered_occupations[occupation_name] if not def then - npc.log("WARNING", "No definition found for occupation name: "..dump(occupation_name)) + --npc.log("WARNING", "No definition found for occupation name: "..dump(occupation_name)) return end - npc.log("INFO", "Overriding NPC values using occupation '"..dump(occupation_name).."' values") + --npc.log("INFO", "Overriding NPC values using occupation '"..dump(occupation_name).."' values") -- Initialize textures, else it will leave the current textures if def.textures and table.getn(def.textures) > 0 then @@ -439,7 +439,7 @@ function npc.occupations.initialize_occupation_values(self, occupation_name) end -- Initialize properties - minetest.log("def.properties: "..dump(def.properties)) + --minetest.log("def.properties: "..dump(def.properties)) if def.properties then -- Initialize trader status if def.properties.initial_trader_status then diff --git a/relationships.lua b/relationships.lua index 23d1ce1..2eaa321 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 - npc.log("DEBUG","Searching with tags: "..dump(tags)) + --npc.log("DEBUG","Searching with tags: "..dump(tags)) return npc.dialogue.search_dialogue_by_tags(tags, true) end @@ -237,7 +237,7 @@ function npc.relationships.get_response_for_disliked_item(item_name, sex) end for i = 1, #items do - minetest.log(dump(items[i])) + --minetest.log(dump(items[i])) if items[i].item == item_name then --minetest.log("Returning: "..dump(items[i].response)) return items[i].response @@ -641,7 +641,7 @@ function npc.relationships.receive_gift(self, clicker) clicker:set_wielded_item(item) end - npc.log("DEBUG", "NPC: "..dump(self)) + --npc.log("DEBUG", "NPC: "..dump(self)) -- Reset gift timer reset_gift_timer(self, clicker_name) return true diff --git a/spawner.lua b/spawner.lua index f660eeb..f32e415 100644 --- a/spawner.lua +++ b/spawner.lua @@ -212,8 +212,8 @@ function npc.spawner.determine_npc_occupation(building_type, workplace_nodes, np building_type, surrounding_buildings_map ) - npc.log("DEBUG", "Found occupations: "..dump(occupation_names).."\nfor local building type: " - ..dump(building_type).."\nAnd surrounding building types: "..dump(surrounding_buildings_map)) + --npc.log("DEBUG", "Found occupations: "..dump(occupation_names).."\nfor local building type: " + --..dump(building_type).."\nAnd surrounding building types: "..dump(surrounding_buildings_map)) -- Insert default occupation into result table.insert(result, {name=npc.occupations.basic_name, node={node_pos={}}}) @@ -272,10 +272,10 @@ function npc.spawner.determine_npc_occupation(building_type, workplace_nodes, np -- used by another NPC, then, use it local meta = minetest.get_meta(workplace_nodes[j].node_pos) local worker_data = minetest.deserialize(meta:get_string("work_data") or "") - npc.log("DEBUG", "Found worker data: "..dump(worker_data)) + --npc.log("DEBUG", "Found worker data: "..dump(worker_data)) -- If no worker data is found, then create it if not worker_data then - npc.log("INFO", "Found suitable occupation and workplace: "..dump(result)) + --npc.log("INFO", "Found suitable occupation and workplace: "..dump(result)) table.insert(result, {name=occupation_names[i], node=workplace_nodes[j]}) end end @@ -381,7 +381,7 @@ function npc.spawner.spawn_npc_on_plotmarker(pos) else -- Start another timer to spawn more NPC local new_delay = math.random(npc.spawner.spawn_delay) - npc.log("INFO", "Spawning one more NPC in "..dump(npc.spawner.spawn_delay).."s") + --npc.log("INFO", "Spawning one more NPC in "..dump(npc.spawner.spawn_delay).."s") timer:start(new_delay) end end @@ -404,7 +404,7 @@ function npc.spawner.spawn_npc(pos, area_info, occupation_name, occupation_workp -- this is a manually spawned NPC local can_spawn = false if npc_count and spawned_npc_count then - npc.log("INFO", "Currently spawned "..dump(spawned_npc_count).." of "..dump(npc_count).." NPCs") + --npc.log("INFO", "Currently spawned "..dump(spawned_npc_count).." of "..dump(npc_count).." NPCs") if spawned_npc_count < npc_count then can_spawn = true end @@ -429,7 +429,7 @@ function npc.spawner.spawn_npc(pos, area_info, occupation_name, occupation_workp npc.initialize(ent, pos, nil, nil, occupation) end -- If node_data is present, assign nodes - minetest.log("Node data: "..dump(node_data)) + --minetest.log("Node data: "..dump(node_data)) if node_data then npc.spawner.assign_places(ent:get_luaentity(), entrance, node_data, pos) end @@ -448,7 +448,7 @@ function npc.spawner.spawn_npc(pos, area_info, occupation_name, occupation_workp workplace = occupation_workplace_pos, born_day = minetest.get_day_count() } - minetest.log("Area info: "..dump(area_info)) + --minetest.log("Area info: "..dump(area_info)) table.insert(area_info.npcs, entry) -- Update and store stats -- Increase total of NPCs for specific sex @@ -569,9 +569,9 @@ function npc.spawner.assign_places(self, entrance, node_data, pos) if #node_data.workplace_type > 0 then -- First, find the workplace_node that was marked for i = 1, #node_data.workplace_type do - minetest.log("In assign places: workplace nodes: "..dump(node_data.workplace_type)) - minetest.log("Condition? "..dump(node_data.workplace_type[i].occupation - and node_data.workplace_type[i].occupation == self.occupation_name)) + --minetest.log("In assign places: workplace nodes: "..dump(node_data.workplace_type)) + --minetest.log("Condition? "..dump(node_data.workplace_type[i].occupation +-- and node_data.workplace_type[i].occupation == self.occupation_name)) if node_data.workplace_type[i].occupation and node_data.workplace_type[i].occupation == self.occupation_name then -- Walkable nodes from occupation @@ -592,7 +592,7 @@ function npc.spawner.assign_places(self, entrance, node_data, pos) end end - npc.log("DEBUG", "Places for NPC "..self.npc_name..": "..dump(self.places_map)) +--npc.log("DEBUG", "Places for NPC "..self.npc_name..": "..dump(self.places_map)) -- Make NPC go into their house -- If entrance is available let NPC @@ -626,7 +626,7 @@ function npc.spawner.calculate_npc_spawning_on_plotmarker(pos) -- Check number of beds local beds_count = #node_data.bed_type--#spawner.filter_first_floor_nodes(node_data.bed_type, pos) - npc.log("DEBUG", "Found "..dump(beds_count).." beds in the building at "..minetest.pos_to_string(pos)) + --npc.log("DEBUG", "Found "..dump(beds_count).." beds in the building at "..minetest.pos_to_string(pos)) local npc_count = 0 -- If number of beds is zero or beds/2 is less than one, spawn -- a single NPC. @@ -637,7 +637,7 @@ function npc.spawner.calculate_npc_spawning_on_plotmarker(pos) -- Spawn (beds_count/2) NPCs npc_count = ((beds_count / 2) - ((beds_count / 2) % 1)) end - npc.log("INFO", "Will spawn "..dump(npc_count).." NPCs at "..minetest.pos_to_string(pos)) + --npc.log("INFO", "Will spawn "..dump(npc_count).." NPCs at "..minetest.pos_to_string(pos)) -- Store amount of NPCs to spawn meta:set_int("npc_count", npc_count) -- Store amount of NPCs spawned @@ -873,14 +873,14 @@ if minetest.get_modpath("mg_villages") ~= nil then --minetest.set_node({x=pos.x,y=pos.y,z=pos.z + (z_sign * z_size)}, {name = "wool:blue"}) --minetest.get_meta({x=pos.x,y=pos.y,z=pos.z + (z_sign * z_size)}):set_string("infotext", minetest.get_meta(pos):get_string("infotext")..", Axis: z, Sign: "..dump(z_sign)) - npc.log("DEBUG", "Start pos: "..minetest.pos_to_string(start_pos)) - npc.log("DEBUG", "Plot: "..dump(minetest.get_meta(start_pos):get_string("infotext"))) + --npc.log("DEBUG", "Start pos: "..minetest.pos_to_string(start_pos)) + --npc.log("DEBUG", "Plot: "..dump(minetest.get_meta(start_pos):get_string("infotext"))) - npc.log("DEBUG", "Brotate: "..dump(brotate)) - npc.log("DEBUG", "X_sign: "..dump(x_sign)) - npc.log("DEBUG", "X_adj: "..dump(x_sign*x_size)) - npc.log("DEBUG", "Z_sign: "..dump(z_sign)) - npc.log("DEBUG", "Z_adj: "..dump(z_sign*z_size)) + --npc.log("DEBUG", "Brotate: "..dump(brotate)) + --npc.log("DEBUG", "X_sign: "..dump(x_sign)) + --npc.log("DEBUG", "X_adj: "..dump(x_sign*x_size)) + --npc.log("DEBUG", "Z_sign: "..dump(z_sign)) + --npc.log("DEBUG", "Z_adj: "..dump(z_sign*z_size)) local end_pos = {x=pos.x + (x_sign * x_size), y=pos.y + y_size, z=pos.z + (z_sign * z_size)} @@ -1099,7 +1099,7 @@ minetest.register_chatcommand("restore_area", { privs = {server = true}, func = function(name, param) local args = npc.utils.split(param, " ") - minetest.log("Params: "..dump(args)) + --minetest.log("Params: "..dump(args)) if #args < 2 then minetest.chat_send_player("Please specify horizontal and vertical radius.") return diff --git a/trade/trade.lua b/trade/trade.lua index 5903482..35d38ff 100644 --- a/trade/trade.lua +++ b/trade/trade.lua @@ -440,7 +440,7 @@ function npc.trade.get_dedicated_trade_offers(self) local trade_list = self.trader_data.trade_list - npc.log("INFO", "NPC Inventory: "..dump(self.inventory)) + --npc.log("INFO", "NPC Inventory: "..dump(self.inventory)) for item_name, trade_info in pairs(trade_list) do -- Abort if more than 12 buy or sell offers are made @@ -451,8 +451,8 @@ function npc.trade.get_dedicated_trade_offers(self) -- If it is, create a sell offer, else create a buy offer if possible. -- Also, avoid creating sell offers immediately if the item was just bought local item = npc.inventory_contains(self, item_name) - minetest.log("Searched item: "..dump(item_name)) - minetest.log("Found: "..dump(item)) + --minetest.log("Searched item: "..dump(item_name)) + --minetest.log("Found: "..dump(item)) if item ~= nil and trade_info.last_offer_type ~= npc.trade.OFFER_BUY then -- Check if item can be sold if trade_info.item_sold_count == nil @@ -764,4 +764,4 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) end end -end) \ No newline at end of file +end)