2016-09-06 08:32:12 -04:00
|
|
|
dmobs = {}
|
2016-07-20 18:11:19 +10:00
|
|
|
|
2016-07-02 09:39:08 +10:00
|
|
|
-- dmobs by D00Med
|
|
|
|
|
2016-09-08 07:11:19 +10:00
|
|
|
-- mounts api by D00Med and lib_mount api by blert2112
|
2016-07-20 18:11:19 +10:00
|
|
|
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/api.lua")
|
|
|
|
|
2016-09-09 07:27:48 -04:00
|
|
|
-- Enable dragons (disable to remove tamed dragons and dragon bosses)
|
2017-01-17 06:25:03 +10:00
|
|
|
dmobs.dragons = minetest.setting_getbool("dmobs.dragons")
|
2017-01-17 06:40:25 +10:00
|
|
|
if dmobs.dragons == nil then
|
2017-01-17 06:25:03 +10:00
|
|
|
dmobs.dragons = true
|
|
|
|
end
|
2017-01-17 06:28:53 +10:00
|
|
|
dmobs.regulars = minetest.setting_getbool("dmobs.regulars")
|
2017-01-17 06:40:25 +10:00
|
|
|
if dmobs.regulars == nil then
|
2017-01-17 06:28:53 +10:00
|
|
|
dmobs.regulars = true
|
|
|
|
end
|
|
|
|
|
2016-09-09 07:27:48 -04:00
|
|
|
|
|
|
|
-- Enable fireballs/explosions
|
2016-12-23 15:30:20 +00:00
|
|
|
dmobs.destructive = minetest.setting_getbool("dmobs.destructive") or false
|
2016-12-14 17:13:01 +00:00
|
|
|
|
2016-12-14 19:25:38 +00:00
|
|
|
-- Timer for the egg mechanics
|
|
|
|
dmobs.eggtimer = tonumber(minetest.setting_get("dmobs.eggtimer") ) or 100
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-12-14 17:13:01 +00:00
|
|
|
-- Table cloning to reduce code repetition
|
|
|
|
dmobs.deepclone = function(t) -- deep-copy a table -- from https://gist.github.com/MihailJP/3931841
|
|
|
|
if type(t) ~= "table" then return t end
|
|
|
|
|
|
|
|
local target = {}
|
|
|
|
|
|
|
|
for k, v in pairs(t) do
|
|
|
|
if k ~= "__index" and type(v) == "table" then -- omit circular reference
|
|
|
|
target[k] = dmobs.deepclone(v)
|
|
|
|
else
|
|
|
|
target[k] = v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return target
|
|
|
|
end
|
2016-12-14 13:36:47 +00:00
|
|
|
|
2016-12-14 17:13:01 +00:00
|
|
|
-- Start loading ----------------------------------------------------------------------------------
|
2016-12-14 13:36:47 +00:00
|
|
|
|
|
|
|
local function loadmob(mobname,dir)
|
|
|
|
dir = dir or "/mobs/"
|
|
|
|
dofile(minetest.get_modpath("dmobs")..dir..mobname..".lua")
|
|
|
|
end
|
|
|
|
|
|
|
|
-- regular mobs
|
|
|
|
|
|
|
|
local mobslist = {
|
|
|
|
-- friendlies
|
|
|
|
"pig",
|
|
|
|
"panda",
|
|
|
|
"tortoise",
|
|
|
|
"golem_friendly",
|
|
|
|
"nyan",
|
|
|
|
"gnorm",
|
|
|
|
"hedgehog",
|
|
|
|
"owl",
|
|
|
|
"whale",
|
|
|
|
"badger",
|
|
|
|
"butterfly",
|
2017-01-17 06:28:53 +10:00
|
|
|
"elephant",
|
2016-12-14 13:36:47 +00:00
|
|
|
|
|
|
|
-- baddies
|
|
|
|
"pig_evil",
|
|
|
|
"fox",
|
|
|
|
"rat",
|
|
|
|
"wasps",
|
|
|
|
"treeman",
|
|
|
|
"golem",
|
|
|
|
"skeleton",
|
|
|
|
"orc",
|
|
|
|
"ogre",
|
|
|
|
}
|
|
|
|
|
2016-12-23 15:27:32 +00:00
|
|
|
if dmobs.regulars then
|
|
|
|
for _,mobname in pairs(mobslist) do
|
|
|
|
loadmob(mobname)
|
|
|
|
end
|
2016-12-14 13:36:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- dragons!!
|
|
|
|
|
2016-12-14 17:13:01 +00:00
|
|
|
if not dmobs.dragons then
|
2016-12-14 13:36:47 +00:00
|
|
|
loadmob("dragon_normal","/dragons/")
|
|
|
|
else
|
|
|
|
loadmob("main","/dragons/")
|
|
|
|
loadmob("dragon1","/dragons/")
|
|
|
|
loadmob("dragon2","/dragons/")
|
|
|
|
loadmob("dragon3","/dragons/")
|
|
|
|
loadmob("dragon4","/dragons/")
|
2016-12-14 18:27:53 +00:00
|
|
|
loadmob("great_dragon","/dragons/")
|
2016-12-14 17:13:01 +00:00
|
|
|
loadmob("water_dragon","/dragons/")
|
|
|
|
loadmob("wyvern","/dragons/")
|
2016-12-14 18:20:58 +00:00
|
|
|
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/dragons/eggs.lua")
|
2016-12-14 13:36:47 +00:00
|
|
|
end
|
2016-12-23 15:27:32 +00:00
|
|
|
dofile(minetest.get_modpath("dmobs").."/arrows/dragonfire.lua")
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/arrows/dragonarrows.lua")
|
2016-12-14 17:13:01 +00:00
|
|
|
|
2016-12-14 18:20:58 +00:00
|
|
|
-- General arrow definitions
|
2016-12-14 17:13:01 +00:00
|
|
|
|
|
|
|
if dmobs.destructive == true then
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/arrows/fire_explosive.lua")
|
|
|
|
else
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/arrows/fire.lua")
|
|
|
|
end
|
|
|
|
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/nodes.lua")
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/arrows/sting.lua")
|
|
|
|
|
|
|
|
-- Spawning
|
|
|
|
|
|
|
|
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/spawn.lua")
|
|
|
|
dofile(minetest.get_modpath("dmobs").."/saddle.lua")
|