Lots of whitespace and debug log fixes
This commit is contained in:
parent
d13fc429ec
commit
e058deb494
@ -1,8 +1,8 @@
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Mob Framework Mod by Sapier
|
-- Mob Framework Mod by Sapier
|
||||||
--
|
--
|
||||||
-- You may copy, use, modify or do nearly anything except removing this
|
-- 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.
|
-- And of course you are NOT allowed to pretend you have written it.
|
||||||
--
|
--
|
||||||
--! @file init.lua
|
--! @file init.lua
|
||||||
@ -16,7 +16,7 @@
|
|||||||
--! e.g. add additional spawn algorithms, movement generators, environments ...
|
--! 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
|
--! @brief this functions are used to add a mob to mob framework
|
||||||
--
|
--
|
||||||
-- Contact sapier a t gmx net
|
-- 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 .. "/mgen_flee/main_flee.lua")
|
||||||
dofile (mobf_modpath .. "/mov_gen_none.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
|
--! @brief define tools used for more than one mob
|
||||||
function mobf_init_basic_tools()
|
function mobf_init_basic_tools()
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "animalmaterials:lasso 5",
|
output = "animalmaterials:lasso 5",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -121,7 +121,7 @@ function mobf_init_basic_tools()
|
|||||||
{'',"wool:white",''},
|
{'',"wool:white",''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "animalmaterials:net 1",
|
output = "animalmaterials:net 1",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -130,7 +130,7 @@ function mobf_init_basic_tools()
|
|||||||
{"wool:white",'',"wool:white"},
|
{"wool:white",'',"wool:white"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'animalmaterials:sword_deamondeath',
|
output = 'animalmaterials:sword_deamondeath',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -147,86 +147,86 @@ end
|
|||||||
function mobf_init_framework()
|
function mobf_init_framework()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing mob framework")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing mob framework")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobf_init_basic_tools()
|
mobf_init_basic_tools()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Reading mob blacklist")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Reading mob blacklist")
|
||||||
local mobf_mob_blacklist_string = minetest.world_setting_get("mobf_blacklist")
|
local mobf_mob_blacklist_string = minetest.world_setting_get("mobf_blacklist")
|
||||||
|
|
||||||
if mobf_mob_blacklist_string ~= nil then
|
if mobf_mob_blacklist_string ~= nil then
|
||||||
mobf_rtd.registred_mob = minetest.deserialize(mobf_mob_blacklist_string)
|
mobf_rtd.registred_mob = minetest.deserialize(mobf_mob_blacklist_string)
|
||||||
|
|
||||||
if mobf_rtd.registred_mob == nil then
|
if mobf_rtd.registred_mob == nil then
|
||||||
minetest.log(LOGLEVEL_ERROR,"MOBF: Error on serializing blacklist!")
|
minetest.log(LOGLEVEL_ERROR,"MOBF: Error on serializing blacklist!")
|
||||||
mobf_rtd.registred_mob = {}
|
mobf_rtd.registred_mob = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize timesource...")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize timesource...")
|
||||||
mobf_init_timesource()
|
mobf_init_timesource()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize statistics...")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize statistics...")
|
||||||
mobf_init_statistics()
|
mobf_init_statistics()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize asynchronous job handling...")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize asynchronous job handling...")
|
||||||
mobf_job_queue.initialize()
|
mobf_job_queue.initialize()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize factions support...")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize factions support...")
|
||||||
mobf_factions.init()
|
mobf_factions.init()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize external mod dependencys...")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize external mod dependencys...")
|
||||||
mobf_init_mod_deps()
|
mobf_init_mod_deps()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing probabilistic movement generator")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing probabilistic movement generator")
|
||||||
movement_gen.initialize()
|
movement_gen.initialize()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing weaponry..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing weaponry..")
|
||||||
mobf_init_weapons()
|
mobf_init_weapons()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing debug hooks..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing debug hooks..")
|
||||||
mobf_debug.init()
|
mobf_debug.init()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing mob preservation..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initializing mob preservation..")
|
||||||
mob_preserve.init()
|
mob_preserve.init()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize path handling subsystem..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize path handling subsystem..")
|
||||||
mobf_path.init()
|
mobf_path.init()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize lifebar subsystem..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize lifebar subsystem..")
|
||||||
mobf_lifebar.init()
|
mobf_lifebar.init()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize mobf supplied modules..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Initialize mobf supplied modules..")
|
||||||
mobf_init_modules()
|
mobf_init_modules()
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_NOTICE,"MOBF: Register rightclick button handler..")
|
minetest.log(LOGLEVEL_NOTICE,"MOBF: Register rightclick button handler..")
|
||||||
minetest.register_on_player_receive_fields(mobf.rightclick_button_handler)
|
minetest.register_on_player_receive_fields(mobf.rightclick_button_handler)
|
||||||
|
|
||||||
-- register privilege to change mobf settings
|
-- register privilege to change mobf settings
|
||||||
minetest.register_privilege("mobfw_admin",
|
minetest.register_privilege("mobfw_admin",
|
||||||
{
|
{
|
||||||
description = "Player may change mobf settings",
|
description = "Player may change mobf settings",
|
||||||
give_to_singleplayer = true
|
give_to_singleplayer = true
|
||||||
})
|
})
|
||||||
|
|
||||||
print("MOD: mob framework mod "..mobf_version.." loaded")
|
print("MOD: mob framework mod "..mobf_version.." loaded")
|
||||||
end
|
end
|
||||||
|
|
||||||
--! @brief initialize mod dependencys
|
--! @brief initialize mod dependencys
|
||||||
function mobf_init_mod_deps()
|
function mobf_init_mod_deps()
|
||||||
local modlist = minetest.get_modnames()
|
local modlist = minetest.get_modnames()
|
||||||
|
|
||||||
for i=1,#modlist,1 do
|
for i=1,#modlist,1 do
|
||||||
if modlist[i] == "fire" then
|
if modlist[i] == "fire" then
|
||||||
mobf_rtd.fire_enabled = true
|
mobf_rtd.fire_enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if modlist[i] == "inventory_plus" then
|
if modlist[i] == "inventory_plus" then
|
||||||
mobf_rtd.inventory_plus_enabled = true
|
mobf_rtd.inventory_plus_enabled = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--! @brief initialize mobf submodules
|
--! @brief initialize mobf submodules
|
||||||
@ -257,7 +257,7 @@ function mobf_init_modules()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
--combat hook
|
--combat hook
|
||||||
mobf.register_on_step_callback({
|
mobf.register_on_step_callback({
|
||||||
name = "combat",
|
name = "combat",
|
||||||
@ -270,7 +270,7 @@ function mobf_init_modules()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
--attention hook
|
--attention hook
|
||||||
mobf.register_on_step_callback({
|
mobf.register_on_step_callback({
|
||||||
name = "attention",
|
name = "attention",
|
||||||
@ -344,7 +344,7 @@ function mobf_init_modules()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
--on punch callbacks
|
--on punch callbacks
|
||||||
mobf.register_on_punch_callback({
|
mobf.register_on_punch_callback({
|
||||||
@ -360,13 +360,13 @@ function mobf_init_modules()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
mobf.register_on_punch_callback({
|
mobf.register_on_punch_callback({
|
||||||
name = "riding",
|
name = "riding",
|
||||||
handler = mobf_ride.on_punch_callback,
|
handler = mobf_ride.on_punch_callback,
|
||||||
configcheck = mobf_ride.is_enabled
|
configcheck = mobf_ride.is_enabled
|
||||||
})
|
})
|
||||||
|
|
||||||
mobf.register_on_punch_callback({
|
mobf.register_on_punch_callback({
|
||||||
name = "punching",
|
name = "punching",
|
||||||
handler = fighting.hit,
|
handler = fighting.hit,
|
||||||
@ -374,8 +374,8 @@ function mobf_init_modules()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
--on rightclick callbacks
|
--on rightclick callbacks
|
||||||
mobf.register_on_rightclick_callback({
|
mobf.register_on_rightclick_callback({
|
||||||
name = "tradercallback",
|
name = "tradercallback",
|
||||||
@ -383,7 +383,7 @@ function mobf_init_modules()
|
|||||||
handler = mob_inventory.trader_callback,
|
handler = mob_inventory.trader_callback,
|
||||||
configcheck = mob_inventory.config_check
|
configcheck = mob_inventory.config_check
|
||||||
})
|
})
|
||||||
|
|
||||||
mobf.register_on_rightclick_callback({
|
mobf.register_on_rightclick_callback({
|
||||||
name = "debugcallback",
|
name = "debugcallback",
|
||||||
visiblename = "Show debuginfo",
|
visiblename = "Show debuginfo",
|
||||||
@ -400,7 +400,7 @@ function mobf_init_modules()
|
|||||||
handler = mobf_path.mob_rightclick_callback,
|
handler = mobf_path.mob_rightclick_callback,
|
||||||
configcheck = mobf_path.config_check
|
configcheck = mobf_path.config_check
|
||||||
})
|
})
|
||||||
|
|
||||||
mobf.register_on_rightclick_callback({
|
mobf.register_on_rightclick_callback({
|
||||||
name = "factions",
|
name = "factions",
|
||||||
visiblename = "Factions",
|
visiblename = "Factions",
|
||||||
|
@ -277,13 +277,13 @@ function mobf.activate_handler(self,staticdata)
|
|||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
|
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.log(LOGLEVEL_ERROR,"MOBF: mob at nil pos!")
|
mobf_bug_warning(LOGLEVEL_ERROR,"MOBF: mob at nil pos!")
|
||||||
end
|
end
|
||||||
|
|
||||||
local current_node = minetest.get_node(pos)
|
local current_node = minetest.get_node(pos)
|
||||||
|
|
||||||
if current_node == nil then
|
if current_node == nil then
|
||||||
minetest.log(LOGLEVEL_ERROR,
|
mobf_bug_warning(LOGLEVEL_ERROR,
|
||||||
"MOBF: trying to activate mob in nil node! removing")
|
"MOBF: trying to activate mob in nil node! removing")
|
||||||
|
|
||||||
spawning.remove_uninitialized(self,staticdata)
|
spawning.remove_uninitialized(self,staticdata)
|
||||||
@ -314,7 +314,7 @@ function mobf.activate_handler(self,staticdata)
|
|||||||
spawner = self.dynamic_data.spawning.spawner
|
spawner = self.dynamic_data.spawning.spawner
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.log(LOGLEVEL_WARNING,
|
mobf_bug_warning(LOGLEVEL_WARNING,
|
||||||
"MOBF: trying to activate mob \"" ..self.data.name ..
|
"MOBF: trying to activate mob \"" ..self.data.name ..
|
||||||
" at " .. printpos(pos) ..
|
" at " .. printpos(pos) ..
|
||||||
"\" within something else!" ..
|
"\" within something else!" ..
|
||||||
@ -325,12 +325,12 @@ function mobf.activate_handler(self,staticdata)
|
|||||||
if luaentity ~= nil then
|
if luaentity ~= nil then
|
||||||
if luaentity.data ~= nil and
|
if luaentity.data ~= nil and
|
||||||
luaentity.data.name ~= nil then
|
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
|
else
|
||||||
print(i .. " " .. dump(luaentity))
|
dbg_mobf.mobf_core_helper_lvl3(i .. " " .. dump(luaentity))
|
||||||
end
|
end
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
spawning.remove_uninitialized(self,staticdata)
|
spawning.remove_uninitialized(self,staticdata)
|
||||||
|
@ -348,7 +348,7 @@ function mobf_spawner_around(mob_name,pos,range)
|
|||||||
end
|
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
|
--! @brief is there a line of sight between two specified positions
|
||||||
--
|
--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user