Commit 4018a5c8 authored by tenplus1's avatar tenplus1
Browse files

Added spawn.lua check for custom mob spawns, example file included

parent 144c8512
......@@ -57,6 +57,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},
......@@ -67,6 +68,7 @@ mobs:spawn({
min_height = 0,
day_toggle = false,
})
end
mobs:register_egg("mobs_monster:dirt_monster", S("Dirt Monster"), "default_dirt.png", 1)
......
......@@ -62,6 +62,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"},
......@@ -70,6 +71,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)
......
-- 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 .. "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
-- 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"))
......@@ -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)
......
......@@ -56,6 +56,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"},
......@@ -64,6 +65,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)
......
......@@ -60,6 +60,7 @@ mobs:register_mob("mobs_monster:oerkki", {
})
if not mobs.custom_spawn_monster then
mobs:spawn({
name = "mobs_monster:oerkki",
nodes = {"default:stone"},
......@@ -67,6 +68,7 @@ mobs:spawn({
chance = 7000,
max_height = -10,
})
end
mobs:register_egg("mobs_monster:oerkki", S("Oerkki"), "default_obsidian.png", 1)
......
......@@ -116,7 +116,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"},
......@@ -124,6 +124,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)
......
--[[ 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,
})
......@@ -178,6 +178,7 @@ mobs:register_mob("mobs_monster:spider", {
})
if not mobs.custom_spawn_monster then
-- above ground spawn
mobs:spawn({
name = "mobs_monster:spider",
......@@ -204,6 +205,7 @@ mobs:spawn({
min_height = -31000,
max_height = -40,
})
end
mobs:register_egg("mobs_monster:spider", S("Spider"), "mobs_cobweb.png", 1)
......
......@@ -62,6 +62,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"},
......@@ -69,6 +70,7 @@ mobs:spawn({
chance = 7000,
max_height = 0,
})
end
mobs:register_egg("mobs_monster:stone_monster", S("Stone Monster"), "default_stone.png", 1)
......
......@@ -67,6 +67,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"},
......@@ -75,6 +76,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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment