From e058deb4947a800ce169fdb20be8a4af1a4079c8 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 24 Nov 2013 15:36:15 +0100 Subject: [PATCH] Lots of whitespace and debug log fixes --- mobf/init.lua | 80 ++++++++++++++++---------------- mobf/mobf.lua | 12 ++--- mobf/utils/generic_functions.lua | 2 +- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/mobf/init.lua b/mobf/init.lua index 13ba08a..ed856a4 100644 --- a/mobf/init.lua +++ b/mobf/init.lua @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------- -- Mob Framework Mod by Sapier --- +-- -- You may copy, use, modify or do nearly anything except removing this --- copyright notice. +-- copyright notice. -- And of course you are NOT allowed to pretend you have written it. -- --! @file init.lua @@ -16,7 +16,7 @@ --! e.g. add additional spawn algorithms, movement generators, environments ... -- -- ---! @defgroup framework_mob Mob Framework API +--! @defgroup framework_mob Mob Framework API --! @brief this functions are used to add a mob to mob framework -- -- Contact sapier a t gmx net @@ -109,10 +109,10 @@ dofile (mobf_modpath .. "/mgen_pathbased/main.lua") dofile (mobf_modpath .. "/mgen_flee/main_flee.lua") dofile (mobf_modpath .. "/mov_gen_none.lua") -mobf_version = "2.9.0" +mobf_version = "2.2.90" --! @brief define tools used for more than one mob -function mobf_init_basic_tools() +function mobf_init_basic_tools() minetest.register_craft({ output = "animalmaterials:lasso 5", recipe = { @@ -121,7 +121,7 @@ function mobf_init_basic_tools() {'',"wool:white",''}, } }) - + minetest.register_craft({ output = "animalmaterials:net 1", recipe = { @@ -130,7 +130,7 @@ function mobf_init_basic_tools() {"wool:white",'',"wool:white"}, } }) - + minetest.register_craft({ output = 'animalmaterials:sword_deamondeath', recipe = { @@ -147,86 +147,86 @@ end function mobf_init_framework() minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing mob framework") - - - + + + mobf_init_basic_tools() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Reading mob blacklist") local mobf_mob_blacklist_string = minetest.world_setting_get("mobf_blacklist") - + if mobf_mob_blacklist_string ~= nil then mobf_rtd.registred_mob = minetest.deserialize(mobf_mob_blacklist_string) - + if mobf_rtd.registred_mob == nil then minetest.log(LOGLEVEL_ERROR,"MOBF: Error on serializing blacklist!") mobf_rtd.registred_mob = {} end end - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize timesource...") mobf_init_timesource() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize statistics...") mobf_init_statistics() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize asynchronous job handling...") mobf_job_queue.initialize() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize factions support...") mobf_factions.init() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize external mod dependencys...") mobf_init_mod_deps() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing probabilistic movement generator") movement_gen.initialize() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing weaponry..") mobf_init_weapons() minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing debug hooks..") mobf_debug.init() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing mob preservation..") mob_preserve.init() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize path handling subsystem..") mobf_path.init() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize lifebar subsystem..") mobf_lifebar.init() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize mobf supplied modules..") mobf_init_modules() - + minetest.log(LOGLEVEL_NOTICE,"MOBF: Register rightclick button handler..") minetest.register_on_player_receive_fields(mobf.rightclick_button_handler) - + -- register privilege to change mobf settings - minetest.register_privilege("mobfw_admin", + minetest.register_privilege("mobfw_admin", { description = "Player may change mobf settings", give_to_singleplayer = true }) - + print("MOD: mob framework mod "..mobf_version.." loaded") end --! @brief initialize mod dependencys function mobf_init_mod_deps() local modlist = minetest.get_modnames() - + for i=1,#modlist,1 do if modlist[i] == "fire" then mobf_rtd.fire_enabled = true end - + if modlist[i] == "inventory_plus" then mobf_rtd.inventory_plus_enabled = true end - end + end end --! @brief initialize mobf submodules @@ -257,7 +257,7 @@ function mobf_init_modules() return false end }) - + --combat hook mobf.register_on_step_callback({ name = "combat", @@ -270,7 +270,7 @@ function mobf_init_modules() return false end }) - + --attention hook mobf.register_on_step_callback({ name = "attention", @@ -344,7 +344,7 @@ function mobf_init_modules() return true end }) - + --on punch callbacks mobf.register_on_punch_callback({ @@ -360,13 +360,13 @@ function mobf_init_modules() return false end }) - + mobf.register_on_punch_callback({ name = "riding", handler = mobf_ride.on_punch_callback, configcheck = mobf_ride.is_enabled }) - + mobf.register_on_punch_callback({ name = "punching", handler = fighting.hit, @@ -374,8 +374,8 @@ function mobf_init_modules() return true end }) - - + + --on rightclick callbacks mobf.register_on_rightclick_callback({ name = "tradercallback", @@ -383,7 +383,7 @@ function mobf_init_modules() handler = mob_inventory.trader_callback, configcheck = mob_inventory.config_check }) - + mobf.register_on_rightclick_callback({ name = "debugcallback", visiblename = "Show debuginfo", @@ -400,7 +400,7 @@ function mobf_init_modules() handler = mobf_path.mob_rightclick_callback, configcheck = mobf_path.config_check }) - + mobf.register_on_rightclick_callback({ name = "factions", visiblename = "Factions", diff --git a/mobf/mobf.lua b/mobf/mobf.lua index 28d4835..93c61c3 100644 --- a/mobf/mobf.lua +++ b/mobf/mobf.lua @@ -277,13 +277,13 @@ function mobf.activate_handler(self,staticdata) local pos = self.object:getpos() if pos == nil then - minetest.log(LOGLEVEL_ERROR,"MOBF: mob at nil pos!") + mobf_bug_warning(LOGLEVEL_ERROR,"MOBF: mob at nil pos!") end local current_node = minetest.get_node(pos) if current_node == nil then - minetest.log(LOGLEVEL_ERROR, + mobf_bug_warning(LOGLEVEL_ERROR, "MOBF: trying to activate mob in nil node! removing") spawning.remove_uninitialized(self,staticdata) @@ -314,7 +314,7 @@ function mobf.activate_handler(self,staticdata) spawner = self.dynamic_data.spawning.spawner end - minetest.log(LOGLEVEL_WARNING, + mobf_bug_warning(LOGLEVEL_WARNING, "MOBF: trying to activate mob \"" ..self.data.name .. " at " .. printpos(pos) .. "\" within something else!" .. @@ -325,12 +325,12 @@ function mobf.activate_handler(self,staticdata) if luaentity ~= nil then if luaentity.data ~= nil and luaentity.data.name ~= nil then - print(i .. " " .. luaentity.data.name .. printpos(objectlist[i]:getpos())) + dbg_mobf.mobf_core_helper_lvl3(i .. " " .. luaentity.data.name .. printpos(objectlist[i]:getpos())) else - print(i .. " " .. dump(luaentity)) + dbg_mobf.mobf_core_helper_lvl3(i .. " " .. dump(luaentity)) end else - print(i .. " " .. tostring(objectlist[i]) .. printpos(objectlist[i]:getpos())) + dbg_mobf.mobf_core_helper_lvl3(i .. " " .. tostring(objectlist[i]) .. printpos(objectlist[i]:getpos())) end end spawning.remove_uninitialized(self,staticdata) diff --git a/mobf/utils/generic_functions.lua b/mobf/utils/generic_functions.lua index f355d5b..a397646 100644 --- a/mobf/utils/generic_functions.lua +++ b/mobf/utils/generic_functions.lua @@ -348,7 +348,7 @@ function mobf_spawner_around(mob_name,pos,range) end ------------------------------------------------------------------------------- --- name: mobf_line_of_sightX(pos1,pos2) +-- name: mobf_line_of_sight(pos1,pos2) -- --! @brief is there a line of sight between two specified positions --