diff --git a/dirt_monster.lua b/dirt_monster.lua index d8e6d66..e0c6717 100644 --- a/dirt_monster.lua +++ b/dirt_monster.lua @@ -58,6 +58,7 @@ if minetest.get_modpath("ethereal") then spawn_on = "ethereal:gray_dirt" end +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:dirt_monster", nodes = {spawn_on}, @@ -68,6 +69,7 @@ mobs:spawn({ min_height = 0, day_toggle = false, }) +end mobs:register_egg("mobs_monster:dirt_monster", S("Dirt Monster"), "default_dirt.png", 1) diff --git a/dungeon_master.lua b/dungeon_master.lua index d27cd9a..440afd5 100644 --- a/dungeon_master.lua +++ b/dungeon_master.lua @@ -65,6 +65,7 @@ mobs:register_mob("mobs_monster:dungeon_master", { }) +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:dungeon_master", nodes = {"default:stone", "default:sandstone", "nether:netherrack"}, @@ -73,6 +74,7 @@ mobs:spawn({ active_object_count = 1, max_height = -70, }) +end mobs:register_egg("mobs_monster:dungeon_master", S("Dungeon Master"), "fire_basic_flame.png", 1, true) diff --git a/init.lua b/init.lua index a0bbf51..ab1b5ba 100644 --- a/init.lua +++ b/init.lua @@ -1,23 +1,44 @@ -- Load support for intllib. -local path = minetest.get_modpath(minetest.get_current_modname()) +local path = minetest.get_modpath(minetest.get_current_modname()) .. "/" + local S = minetest.get_translator and minetest.get_translator("mobs_monster") or - dofile(path .. "/intllib.lua") + dofile(path .. "intllib.lua") + mobs.intllib = S + +-- Check for custom mob spawn file +local input = io.open(path .. "spawn.lua", "r") + +if input then + mobs.custom_spawn_monster = true + input:close() + input = nil +end + + -- Monsters -dofile(path .. "/dirt_monster.lua") -- PilzAdam -dofile(path .. "/dungeon_master.lua") -dofile(path .. "/oerkki.lua") -dofile(path .. "/sand_monster.lua") -dofile(path .. "/stone_monster.lua") -dofile(path .. "/tree_monster.lua") -dofile(path .. "/lava_flan.lua") -- Zeg9 -dofile(path .. "/mese_monster.lua") -dofile(path .. "/spider.lua") -- AspireMint -dofile(path .. "/minotaur.lua") -- NALC(sys4 fork MFF) Kalabasa +dofile(path .. "dirt_monster.lua") -- PilzAdam +dofile(path .. "dungeon_master.lua") +dofile(path .. "oerkki.lua") +dofile(path .. "sand_monster.lua") +dofile(path .. "stone_monster.lua") +dofile(path .. "tree_monster.lua") +dofile(path .. "lava_flan.lua") -- Zeg9 +dofile(path .. "mese_monster.lua") +dofile(path .. "spider.lua") -- AspireMint +dofile(path .. "minotaur.lua") -- NALC(sys4 fork MFF) Kalabasa + + +-- Load custom spawning +if mobs.custom_spawn_monster then + dofile(path .. "spawn.lua") +end + -- Lucky Blocks -dofile(path .. "/lucky_block.lua") +dofile(path .. "lucky_block.lua") + print (S("[MOD] Mobs Redo Monsters loaded")) diff --git a/lava_flan.lua b/lava_flan.lua index 55de98f..f63a90c 100644 --- a/lava_flan.lua +++ b/lava_flan.lua @@ -89,6 +89,7 @@ mobs:register_mob("mobs_monster:lava_flan", { }) +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:lava_flan", nodes = {"default:lava_source"}, @@ -96,6 +97,7 @@ mobs:spawn({ active_object_count = 1, max_height = 0, }) +end mobs:register_egg("mobs_monster:lava_flan", S("Lava Flan"), "default_lava.png", 1) diff --git a/mese_monster.lua b/mese_monster.lua index 6342bdb..ddf2448 100644 --- a/mese_monster.lua +++ b/mese_monster.lua @@ -58,6 +58,7 @@ mobs:register_mob("mobs_monster:mese_monster", { }) +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:mese_monster", nodes = {"default:stone", "default:sandstone"}, @@ -66,6 +67,7 @@ mobs:spawn({ active_object_count = 1, max_height = -20, }) +end mobs:register_egg("mobs_monster:mese_monster", S("Mese Monster"), "default_mese_block.png", 1) diff --git a/oerkki.lua b/oerkki.lua index 25595b7..ac1f117 100644 --- a/oerkki.lua +++ b/oerkki.lua @@ -61,6 +61,7 @@ mobs:register_mob("mobs_monster:oerkki", { }) +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:oerkki", nodes = {"default:stone"}, @@ -68,6 +69,7 @@ mobs:spawn({ chance = 7000, max_height = -10, }) +end mobs:register_egg("mobs_monster:oerkki", S("Oerkki"), "default_obsidian.png", 1) diff --git a/sand_monster.lua b/sand_monster.lua index 413bd52..12c9193 100644 --- a/sand_monster.lua +++ b/sand_monster.lua @@ -117,7 +117,7 @@ mobs:register_mob("mobs_monster:sand_monster", { ]] }) - +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:sand_monster", nodes = {"default:desert_sand"}, @@ -125,6 +125,7 @@ mobs:spawn({ active_object_count = 2, min_height = 0, }) +end mobs:register_egg("mobs_monster:sand_monster", S("Sand Monster"), "default_desert_sand.png", 1) diff --git a/spawn_example.lua b/spawn_example.lua new file mode 100644 index 0000000..7babd08 --- /dev/null +++ b/spawn_example.lua @@ -0,0 +1,173 @@ + +--[[ Spawn Template, defaults to values shown if line not provided + +mobs:spawn({ + + name = "", + + - Name of mob, must be provided e.g. "mymod:my_mob" + + nodes = {"group:soil, "group:stone"}, + + - Nodes to spawn on top of. + + neighbors = {"air"}, + + - Nodes to spawn beside. + + min_light = 0, + + - Minimum light level. + + max_light = 15, + + - Maximum light level, 15 is sunlight only. + + interval = 30, + + - Spawn interval in seconds. + + chance = 5000, + + - Spawn chance, 1 in every 5000 nodes. + + active_object_count = 1, + + - Active mobs of this type in area. + + min_height = -31000, + + - Minimum height level. + + max_height = 31000, + + - Maximum height level. + + day_toggle = nil, + + - Daytime toggle, true to spawn during day, false for night, nil for both + + on_spawn = nil, + + - On spawn function to run when mob spawns in world + + on_map_load = nil, + + - On map load, when true mob only spawns in newly generated map areas +}) +]]-- + + +-- Dirt Monster + +mobs:spawn({ + name = "mobs_monster:dirt_monster", + nodes = {"default:dirt_with_grass"}, + min_light = 0, + max_light = 7, + chance = 6000, + active_object_count = 2, + min_height = 0, + day_toggle = false, +}) + +-- Dungeon Master + +mobs:spawn({ + name = "mobs_monster:dungeon_master", + nodes = {"default:stone"}, + max_light = 5, + chance = 9000, + active_object_count = 1, + max_height = -70, +}) + +-- Lava Flan + +mobs:spawn({ + name = "mobs_monster:lava_flan", + nodes = {"default:lava_source"}, + chance = 1500, + active_object_count = 1, + max_height = 0, +}) + +-- Mese Monster + +mobs:spawn({ + name = "mobs_monster:mese_monster", + nodes = {"default:stone"}, + max_light = 7, + chance = 5000, + active_object_count = 1, + max_height = -20, +}) + +-- Oerkki + +mobs:spawn({ + name = "mobs_monster:oerkki", + nodes = {"default:stone"}, + max_light = 7, + chance = 7000, + max_height = -10, +}) + +-- Sand Monster + +mobs:spawn({ + name = "mobs_monster:sand_monster", + nodes = {"default:desert_sand"}, + chance = 7000, + active_object_count = 2, + min_height = 0, +}) + +-- Spider (above ground) + +mobs:spawn({ + name = "mobs_monster:spider", + nodes = { + "default:dirt_with_rainforest_litter", "default:snowblock", + "default:snow", "ethereal:crystal_dirt", "ethereal:cold_dirt" + }, + min_light = 0, + max_light = 8, + chance = 7000, + active_object_count = 1, + min_height = 25, + max_height = 31000, +}) + +-- Spider (below ground) +mobs:spawn({ + name = "mobs_monster:spider", + nodes = {"default:stone_with_mese", "default:mese", "default:stone"}, + min_light = 0, + max_light = 7, + chance = 7000, + active_object_count = 1, + min_height = -31000, + max_height = -40, +}) + +-- Stone Monster + +mobs:spawn({ + name = "mobs_monster:stone_monster", + nodes = {"default:stone", "default:desert_stone", "default:sandstone"}, + max_light = 7, + chance = 7000, + max_height = 0, +}) + +-- Tree Monster + +mobs:spawn({ + name = "mobs_monster:tree_monster", + nodes = {"default:leaves", "default:jungleleaves"}, + max_light = 7, + chance = 7000, + min_height = 0, + day_toggle = false, +}) diff --git a/spider.lua b/spider.lua index f462a20..33ab2e8 100644 --- a/spider.lua +++ b/spider.lua @@ -179,6 +179,7 @@ mobs:register_mob("mobs_monster:spider", { }) +if not mobs.custom_spawn_monster then -- above ground spawn mobs:spawn({ name = "mobs_monster:spider", @@ -205,6 +206,7 @@ mobs:spawn({ min_height = -31000, max_height = -40, }) +end mobs:register_egg("mobs_monster:spider", S("Spider"), "mobs_cobweb.png", 1) diff --git a/stone_monster.lua b/stone_monster.lua index 2e03396..e605c74 100644 --- a/stone_monster.lua +++ b/stone_monster.lua @@ -64,6 +64,7 @@ mobs:register_mob("mobs_monster:stone_monster", { }) +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:stone_monster", nodes = {"default:stone", "default:desert_stone", "default:sandstone"}, @@ -71,6 +72,7 @@ mobs:spawn({ chance = 7000, max_height = 0, }) +end mobs:register_egg("mobs_monster:stone_monster", S("Stone Monster"), "default_stone.png", 1) diff --git a/tree_monster.lua b/tree_monster.lua index 0466580..8f1fde4 100644 --- a/tree_monster.lua +++ b/tree_monster.lua @@ -69,6 +69,7 @@ mobs:register_mob("mobs_monster:tree_monster", { }) +if not mobs.custom_spawn_monster then mobs:spawn({ name = "mobs_monster:tree_monster", nodes = {"default:leaves", "default:jungleleaves", "moretrees:beech_leaves"}, @@ -77,6 +78,7 @@ mobs:spawn({ min_height = 0, day_toggle = false, }) +end mobs:register_egg("mobs_monster:tree_monster", S("Tree Monster"), "default_tree_top.png", 1)