spawn.lua : new implementation

feature/ethereal-compat
Grossam 2019-07-30 18:45:44 +02:00
parent 6cba5a9c4b
commit d02a353368
4 changed files with 105 additions and 39 deletions

View File

@ -4,4 +4,7 @@ Thanks to TenPlus1, blert2112, and taikedz
* 2019-07-28 :
* some little bugs corrected
* great dragons now need a gold block nest
* dragon_normal described as 'minor dragons' and now they can spawn
* ice dragons are now named "Blue dragon"
* hatched great dragons are tamed now
* great dragons now need a diamond block nest (you've to deserve greatness !)

View File

@ -10,7 +10,7 @@ Environements :
* Lightning : obsidian
* Poison : cactus
* Ice : ice
* Great : gold block
* Great : diamond block
By defeating special dragons, you can obtain elemental gems.

View File

@ -1,4 +1,4 @@
-- Hydra
-- Waterdragon (Hydra)
mobs:register_mob("dmobs:waterdragon", {
type = "monster",

135
spawn.lua
View File

@ -1,54 +1,117 @@
-- spawn.lua rewritten, using this latest function frim mobs_redo :
--
--mobs:spawn({
-- name = "dmobs:dragon",
-- nodes = {"air"},
-- neighbor = {"default:stone"},
-- min_light = 10,
-- max_light = 15,
-- interval = 300,
-- chance = 15000,
-- active_object_count = 2,
-- min_height = -100,
-- max_height = 11000,
--})
--
-- The fonction creates a rule defining how a mob will spawn.
-- Call it several times to create several rules.
-- mobs:spawn() seems to ignore unloaded nodes. So no need checking for loaded mods ?
--local eth = minetest.get_modpath("ethereal")
--local cr = minetest.get_modpath("caverealms")
--local nodes, neighbor = {}, {}
if dmobs.regulars then
-- friendlies
-- nodes = {"darkage:marble"}
-- neighbor = {"darkage:slate"}
mobs:spawn({name = "dmobs:nyan", nodes = {"air"}, neighbor = {"group:leaves"},
min_light = 10, max_light = 15, interval = 300, chance = 64000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:nyan", nodes = {"air"}, neighbor = {"ethereal:mushroom", "nyanland:meseleaves"},
min_light = 10, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:hedgehog", nodes = {"group:flora", "ethereal:prairie_dirt"},
neighbor = {}, min_light = 0, max_light = 8, interval = 300, chance = 8000, active_object_count = 3, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:whale", nodes = {"default:water_source"}, neighbor = {"group:sand"},
min_light = 0, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = -100, max_height = 0})
mobs:spawn({name = "dmobs:owl", nodes = {"group:tree"}, neighbor = {},
min_light = 0, max_light = 7, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:gnorm", nodes = {"default:dirt_with_grass", "ethereal:bamboo_dirt"}, neighbor = {},
min_light = 10, max_light = 15, interval = 300, chance = 32000, active_object_count = 2, min_height = -100, max_height = 0})
mobs:spawn({name = "dmobs:tortoise", nodes = {"default:water_source", "group:sand"}, neighbor = {},
min_light = 5, max_light = 10, interval = 300, chance = 8000, active_object_count = 2, min_height = -100, max_height = 500})
mobs:spawn({name = "dmobs:elephant", nodes = {"default:dirt_with_dry_grass", "ethereal:grove_dirt"}, neighbor = {},
min_light = 10, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:pig", nodes = {"default:dirt_with_grass", "ethereal:prairie_dirt", "nyanland:cloudstone"}, neighbor = {},
min_light = 10, max_light = 15, interval = 300, chance = 32000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:panda", nodes = {"default:dirt_with_grass", "ethereal:bamboo_dirt"}, neighbor = {},
min_light = 10, max_light = 15, interval = 300, chance = 32000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:register_spawn("dmobs:nyan", {"default:pine_needles","default:leaves"}, 20, 10, 50000, 2, 800)
mobs:register_spawn("dmobs:nyan", {"nyanland:meseleaves"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:hedgehog", {"default:dirt_with_grass","default:pine_needles"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:whale", {"default:water_source"}, 20, 10, 15000, -20, 1000)
mobs:register_spawn("dmobs:owl", {"default:leaves","default:tree"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:gnorm", {"default:dirt_with_grass","default:wood"}, 20, 10, 32000, 2, 800)
mobs:register_spawn("dmobs:tortoise", {"default:clay","default:sand"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:elephant", {"default:dirt_with_dry_grass","default:desert_sand"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:badger", {"default:dirt_with_grass","default:dirt"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:pig", {"default:pine_needles","default:leaves", "nyanland:cloudstone"}, 20, 10, 32000, 2, 800)
mobs:register_spawn("dmobs:panda", {"default:dirt_with_grass","ethereal:bamboo_dirt"}, 20, 10, 15000, 2, 800)
-- baddies
mobs:register_spawn("dmobs:wasp", {"default:dirt_with_grass"}, 20, 10, 32000, 2, 800)
mobs:register_spawn("dmobs:wasp", {"dmobs:hive"}, 20, 10, 16000, 2, 800)
mobs:register_spawn("dmobs:wasp_leader", {"default:dirt_with_grass","dmobs:hive"}, 20, 10, 64000, 2, 800)
mobs:spawn({name = "dmobs:wasp", nodes = {"air"}, neighbor = {"group:leaves"}, min_light = 10, max_light = 15, interval = 300, chance = 32000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:wasp", nodes = {"dmobs:hive"}, neighbor = {}, min_light = 10, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:wasp_leader", nodes = {"group:leaves", "dmobs:hive"}, neighbor = {}, min_light = 10, max_light = 15, interval = 300, chance = 64000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:register_spawn("dmobs:golem", {"default:stone"}, 7, 0, 16000, 2, 800)
mobs:register_spawn("dmobs:pig_evil", {"default:pine_needles","default:leaves"}, 20, 10, 32000, 2, 800)
mobs:register_spawn("dmobs:fox", {"default:dirt_with_grass","default:dirt"}, 20, 10, 32000, 2, 800)
mobs:spawn({name = "dmobs:golem", nodes = {"group:stone"}, neighbor = {}, min_light = 0,
max_light = 7, interval = 300, chance = 16000, active_object_count = 2, min_height = -32000, max_height = 100})
mobs:spawn({name = "dmobs:pig_evil", nodes = {"group:leave", "ethereal:bamboo_leaves"}, neighbor = {},
min_light = 10, max_light = 15, interval = 300, chance = 64000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:fox", nodes = {"group:leaves"}, neighbor = {},
min_light = 0, max_light = 10, interval = 300, chance = 32000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:rat", nodes = {"group:stone", "group:sand"}, neighbor = {},
min_light = 0, max_light = 10, interval = 300, chance = 32000, active_object_count = 2, min_height = -30000, max_height = 100})
mobs:spawn({name = "dmobs:treeman", nodes = {"group:leaves"}, neighbor = {},
min_light = 7, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:skeleton", nodes = {"group:stone"}, neighbor = {},
min_light = 0, max_light = 10, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 2000})
-- Orcs and ogres spawn more often when dragons are disabled
if not dmobs.dragons then
mobs:register_spawn("dmobs:orc", {"default:snow","default:snow_block", "default:desert_sand"}, 20, 10, 15000, 2, 800)
mobs:register_spawn("dmobs:ogre", {"default:snow","default:dirt_with_dry_grass", "default:desert_sand"}, 20, 10, 15000, 2, 800)
mobs:spawn({name = "dmobs:orc",
nodes = {"default:snow_block", "default:permafrost_with_moss", "default:permafrost_with_stone", "ethereal:cold_dirt"},
neighbor = {}, min_light = 0, max_light = 10, interval = 300, chance = 16000,
active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:ogre",
nodes = {"default:snow_block", "default:permafrost_with_moss", "default:permafrost_with_stone", "ethereal:cold_dirt"},
neighbor = {}, min_light = 0, max_light = 10, interval = 300, chance = 8000,
active_object_count = 2, min_height = 0, max_height = 2000})
else
mobs:register_spawn("dmobs:orc", {"default:snow","default:snow_block", "default:desert_sand"}, 20, 10, 3500, 2, 800)
mobs:register_spawn("dmobs:ogre", {"default:snow","default:dirt_with_dry_grass", "default:desert_sand"}, 20, 10, 350, 2, 800)
mobs:spawn({name = "dmobs:orc",
nodes = {"default:snow_block", "default:permafrost_with_moss", "default:permafrost_with_stone", "ethereal:cold_dirt"},
neighbor = {}, min_light = 0, max_light = 10, interval = 300, chance = 8000,
active_object_count = 2, min_height = 0, max_height = 2000})
mobs:spawn({name = "dmobs:ogre",
nodes = {"default:snow_block", "default:permafrost_with_moss", "default:permafrost_with_stone", "ethereal:cold_dirt"},
neighbor = {}, min_light = 0, max_light = 10, interval = 300, chance = 6000,
active_object_count = 2, min_height = 0, max_height = 2000})
end
mobs:register_spawn("dmobs:rat", {"default:stone","default:sand"}, 20, 0, 32000, 2, 800)
mobs:register_spawn("dmobs:treeman", {"default:leaves", "default:pine_needles"}, 7, 0, 16000, 2, 800)
mobs:register_spawn("dmobs:skeleton", {"default:stone"}, 7, 0, 16000, 2, 800)
end
-- dragons
-------------
-- dragons --
-------------
-- Generic dragon always spawn, the others only if enabled
mobs:register_spawn("dmobs:dragon", {"default:leaves","default:dirt_with_grass"}, 20, 10, 32000, 2, 800)
mobs:spawn({name = "dmobs:dragon", nodes = {"group:leaves"}, neighbor = {},
min_light = 5, max_light = 15, interval = 300, chance = 24000, active_object_count = 2, min_height = 0, max_height = 30000})
if dmobs.dragons then
mobs:register_spawn("dmobs:dragon1", {"default:leaves"}, 20, 10, 64000, 2, 800)
mobs:register_spawn("dmobs:dragon2", {"default:pine_needles"}, 20, 10, 64000, 2, 800)
mobs:register_spawn("dmobs:dragon3", {"default:acacia_leaves","default:dirt_with_dry_grass"}, 20, 10, 64000, 2, 800)
mobs:register_spawn("dmobs:dragon4", {"default:jungleleaves"}, 20, 10, 64000, 2, 800)
mobs:register_spawn("dmobs:waterdragon", {"default:water_source"}, 20, 10, 32000, 1, 800, false)
mobs:register_spawn("dmobs:wyvern", {"default:leaves"}, 20, 10, 32000, 1, 800, false)
mobs:register_spawn("dmobs:dragon_great", {"default:lava_source"}, 20, 0, 64000, -21000, 1000, false)
mobs:spawn({name = "dmobs:dragon1", nodes = {"ethereal:fiery_dirt", "default:desert_sand"}, neighbor = {},
min_light = 5, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 30000})
mobs:spawn({name = "dmobs:dragon2", nodes = {"ethereal:crystal_dirt", "default:dirt_with_dry_grass"}, neighbor = {},
min_light = 5, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 30000})
mobs:spawn({name = "dmobs:dragon3", nodes = {"ethereal:jungle_dirt", "default:jungleleaves"}, neighbor = {},
min_light = 0, max_light = 10, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 30000})
mobs:spawn({name = "dmobs:dragon4",
nodes = {"default:snow_block", "default:permafrost_with_moss", "default:permafrost_with_stone", "ethereal:cold_dirt"}, neighbor = {},
min_light = 5, max_light = 15, interval = 300, chance = 16000, active_object_count = 2, min_height = 0, max_height = 30000})
mobs:spawn({name = "dmobs:waterdragon", nodes = {"default:water_source"}, neighbor = {},
min_light = 0, max_light = 15, interval = 300, chance = 1, active_object_count = 2, min_height = -10, max_height = 100})
mobs:spawn({name = "dmobs:wyvern", nodes = {"group:leaves"}, neighbor = {},
min_light = 0, max_light = 10, interval = 300, chance = 8000, active_object_count = 2, min_height = 0, max_height = 30000})
mobs:spawn({name = "dmobs:dragon_great", nodes = {"ethereal:jungle_dirt", "default:jungleleaves"}, neighbor = {},
min_light = 0, max_light = 10, interval = 300, chance = 8000, active_object_count = 2, min_height = -30000, max_height = 30000})
end