added custom spawn check and examples

This commit is contained in:
tenplus1 2024-08-16 18:30:17 +01:00
parent 3a05a29b02
commit 85b633d3f6
12 changed files with 368 additions and 155 deletions

View File

@ -67,21 +67,6 @@ if croc_walkers then
mobs:register_mob("mobs_crocs:crocodile", table.copy(croc_def))
mobs:register_egg("mobs_crocs:crocodile", "Crocodile (walk)", "default_grass.png", 1)
mobs:spawn({
name = "mobs_crocs:crocodile",
nodes = {
(mod_mcl and "group:shovely" or "group:crumbly")
},
neighbors = {
"group:water", "dryplants:juncus", "dryplants:reedmace",
(mod_mcl and "mcl_core:reeds" or "default:papyrus")
},
interval = 30,
chance = croc_spawn_chance,
min_height = 0,
max_height = 10
})
end
@ -95,20 +80,6 @@ if croc_floaters then
mobs:register_mob("mobs_crocs:crocodile_float", table.copy(croc_def))
mobs:register_egg("mobs_crocs:crocodile_float", "Crocodile (float)", "default_grass.png", 1)
mobs:spawn({
name = "mobs_crocs:crocodile_float",
nodes = {"group:water"},
neighbors = {
(mcl_core and "group:shovely" or "group:crumbly"),
"group:seaplants", "dryplants:juncus", "dryplants:reedmace",
(mod_mcl and "mcl_core:reeds" or "default:papyrus")
},
interval = 30,
chance = croc_spawn_chance,
min_height = -3,
max_height = 10
})
end
@ -125,17 +96,63 @@ if croc_swimmers then
mobs:register_mob("mobs_crocs:crocodile_swim", table.copy(croc_def))
mobs:register_egg("mobs_crocs:crocodile_swim", "Crocodile (swim)", "default_grass.png", 1)
mobs:spawn({
name = "mobs_crocs:crocodile_swim",
nodes = {"group:water"},
neighbors = {(mcl_core and "group:shovely" or "group:crumbly")},
interval = 30,
chance = croc_spawn_chance,
min_height = -8,
max_height = 10
})
end
-- Check for custom spawn.lua
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local input = io.open(MP .. "spawn.lua", "r")
if input then
input:close() ; input = nil ; dofile(MP .. "spawn.lua")
else
if croc_walkers then
mobs:spawn({
name = "mobs_crocs:crocodile",
nodes = {
(mod_mcl and "group:shovely" or "group:crumbly")
},
neighbors = {
"group:water", "dryplants:juncus", "dryplants:reedmace",
(mod_mcl and "mcl_core:reeds" or "default:papyrus")
},
interval = 30,
chance = croc_spawn_chance,
min_height = 0,
max_height = 10
})
end
if croc_floaters then
mobs:spawn({
name = "mobs_crocs:crocodile_float",
nodes = {"group:water"},
neighbors = {
(mcl_core and "group:shovely" or "group:crumbly"),
"group:seaplants", "dryplants:juncus", "dryplants:reedmace",
(mod_mcl and "mcl_core:reeds" or "default:papyrus")
},
interval = 30,
chance = croc_spawn_chance,
min_height = -3,
max_height = 10
})
end
if croc_swimmers then
mobs:spawn({
name = "mobs_crocs:crocodile_swim",
nodes = {"group:water"},
neighbors = {(mcl_core and "group:shovely" or "group:crumbly")},
interval = 30,
chance = croc_spawn_chance,
min_height = -8,
max_height = 10
})
end
end
print("[MOD] Mobs Redo Crocs loaded")

View File

@ -0,0 +1,52 @@
-- load settings
local croc_walkers = minetest.settings:get_bool("mobs_crocs.enable_walkers", true)
local croc_floaters = minetest.settings:get_bool("mobs_crocs.enable_floaters", true)
local croc_swimmers = minetest.settings:get_bool("mobs_crocs.enable_swimmers", true)
-- spawn examples
if croc_walkers then
mobs:spawn({
name = "mobs_crocs:crocodile",
nodes = {"group:crumbly"},
neighbors = {
"group:water", "dryplants:juncus", "dryplants:reedmace", "default:papyrus"
},
interval = 30,
chance = 20000,
min_height = 0,
max_height = 10
})
end
if croc_floaters then
mobs:spawn({
name = "mobs_crocs:crocodile_float",
nodes = {"group:water"},
neighbors = {
"group:crumbly", "group:seaplants", "dryplants:juncus",
"dryplants:reedmace", "default:papyrus"
},
interval = 30,
chance = 20000,
min_height = -3,
max_height = 10
})
end
if croc_swimmers then
mobs:spawn({
name = "mobs_crocs:crocodile_swim",
nodes = {"group:water"},
neighbors = {"group:crumbly"},
interval = 30,
chance = 20000,
min_height = -8,
max_height = 10
})
end

View File

@ -84,22 +84,6 @@ mobs:register_mob("mobs_fish:clownfish", {
end
})
-- spawn in world
mobs:spawn({
name = "mobs_fish:clownfish",
nodes = {"group:water"},
neighbors = {
(mod_mcl and "group:shovely" or "group:crumbly"),
"group:seaplants", "group:seacoral"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
max_height = l_water_level,
active_object_count = 5
})
-- spawn egg
mobs:register_egg("mobs_fish:clownfish", "Clownfish", "animal_clownfish_clownfish_item.png", 0)
@ -156,27 +140,50 @@ mobs:register_mob("mobs_fish:tropical", {
end
})
-- spawn in world
mobs:spawn({
name = "mobs_fish:tropical",
nodes = {"group:water"},
neighbors = {
(mod_mcl and "group:shovely" or "group:crumbly"),
"group:seaplants", "group:seacoral"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
max_height = l_water_level,
active_object_count = 5
})
-- spawn egg
mobs:register_egg("mobs_fish:tropical", "Tropical fish",
"animal_fish_blue_white_fish_blue_white_item.png", 0)
-- Check for custom spawn.lua
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local input = io.open(MP .. "spawn.lua", "r")
if input then
input:close() ; input = nil ; dofile(MP .. "spawn.lua")
else
-- clownfish
mobs:spawn({
name = "mobs_fish:clownfish",
nodes = {"group:water"},
neighbors = {
(mod_mcl and "group:shovely" or "group:crumbly"),
"group:seaplants", "group:seacoral"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
max_height = l_water_level,
active_object_count = 5
})
-- tropical fish
mobs:spawn({
name = "mobs_fish:tropical",
nodes = {"group:water"},
neighbors = {
(mod_mcl and "group:shovely" or "group:crumbly"),
"group:seaplants", "group:seacoral"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
max_height = l_water_level,
active_object_count = 5
})
end
-- helper function
local function add_food_group(item)

View File

@ -0,0 +1,24 @@
-- Fish spawn examples
mobs:spawn({
name = "mobs_fish:clownfish",
nodes = {"group:water"},
neighbors = {"group:crumbly", "group:seaplants", "group:seacoral"},
min_light = 5,
interval = 30,
chance = 10000,
max_height = -1,
active_object_count = 5
})
mobs:spawn({
name = "mobs_fish:tropical",
nodes = {"group:water"},
neighbors = {"group:crumbly", "group:seaplants", "group:seacoral"},
min_light = 5,
interval = 30,
chance = 10000,
max_height = -1,
active_object_count = 5
})

View File

@ -37,17 +37,24 @@ mobs:register_mob("mobs_jellyfish:jellyfish", {
end
})
-- spawn in world
-- Check for custom spawn.lua
mobs:spawn({
name = "mobs_jellyfish:jellyfish",
nodes = {(mod_mcl and "mcl_core:water_source" or "default:water_source")},
neighbors = {"group:water"},
min_light = 5,
interval = 30,
chance = 10000,
max_height = 0
})
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local input = io.open(MP .. "spawn.lua", "r")
if input then
input:close() ; input = nil ; dofile(MP .. "spawn.lua")
else
mobs:spawn({
name = "mobs_jellyfish:jellyfish",
nodes = {(mod_mcl and "mcl_core:water_source" or "default:water_source")},
neighbors = {"group:water"},
min_light = 5,
interval = 30,
chance = 10000,
max_height = 0
})
end
-- spawn egg

View File

@ -0,0 +1,12 @@
-- Jellyfish spawn example
mobs:spawn({
name = "mobs_jellyfish:jellyfish",
nodes = {"default:water_source"},
neighbors = {"group:water"},
min_light = 5,
interval = 30,
chance = 10000,
max_height = 0
})

View File

@ -1,8 +0,0 @@
-- SETTINGS
ENABLE_SHARK_LARGE = true
ENABLE_SHARK_MEDIUM = true
ENABLE_SHARK_SMALL = true
HELP_WITH_EXPERIMENT = false

View File

@ -23,17 +23,19 @@ local l_spawn_chance = 60000
-- load settings
dofile(minetest.get_modpath("mobs_sharks") .. "/SETTINGS.txt")
local ENABLE_LARGE = minetest.settings:get_bool("mobs_sharks.enable_large") ~= false
local ENABLE_MEDIUM = minetest.settings:get_bool("mobs_sharks.enable_medium") ~= false
local ENABLE_SMALL = minetest.settings:get_bool("mobs_sharks.enable_small") ~= false
if not ENABLE_SHARK_LARGE then
if not ENABLE_LARGE then
l_spawn_chance = l_spawn_chance - 20000
end
if not ENABLE_SHARK_MEDIUM then
if not ENABLE_MEDIUM then
l_spawn_chance = l_spawn_chance - 20000
end
if not ENABLE_SHARK_SMALL then
if not ENABLE_SMALL then
l_spawn_chance = l_spawn_chance - 20000
end
@ -43,7 +45,7 @@ local mod_mcl = minetest.get_modpath("mcl_core")
-- large
if ENABLE_SHARK_LARGE then
if ENABLE_LARGE then
mobs:register_mob("mobs_sharks:shark_lg", {
type = "monster",
@ -83,22 +85,13 @@ if ENABLE_SHARK_LARGE then
}
})
mobs:spawn({
name = "mobs_sharks:shark_lg",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
mobs:register_egg("mobs_sharks:shark_lg", "Shark (large)",
"mob_shark_shark_item.png", 0)
end
-- medium
if ENABLE_SHARK_MEDIUM then
if ENABLE_MEDIUM then
mobs:register_mob("mobs_sharks:shark_md", {
type = "monster",
@ -138,22 +131,13 @@ if ENABLE_SHARK_MEDIUM then
}
})
mobs:spawn({
name = "mobs_sharks:shark_md",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
mobs:register_egg("mobs_sharks:shark_md", "Shark (medium)",
"mob_shark_shark_item.png", 0)
end
-- small
if ENABLE_SHARK_SMALL then
if ENABLE_SMALL then
mobs:register_mob("mobs_sharks:shark_sm", {
type = "monster",
@ -193,18 +177,53 @@ if ENABLE_SHARK_SMALL then
}
})
mobs:spawn({
name = "mobs_sharks:shark_sm",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
mobs:register_egg("mobs_sharks:shark_sm", "Shark (small)",
"mob_shark_shark_item.png", 0)
end
-- Check for custom spawn.lua
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local input = io.open(MP .. "spawn.lua", "r")
if input then
input:close() ; input = nil ; dofile(MP .. "spawn.lua")
else
if ENABLE_SMALL then
mobs:spawn({
name = "mobs_sharks:shark_sm",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
end
if ENABLE_MEDIUM then
mobs:spawn({
name = "mobs_sharks:shark_md",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
end
if ENABLE_LARGE then
mobs:spawn({
name = "mobs_sharks:shark_lg",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
end
end
print("[MOD] Mobs Redo Sharks loaded")

3
mobs_sharks/settingtypes.txt Executable file
View File

@ -0,0 +1,3 @@
mobs_sharks.enable_large (Enable Large Sharks) bool true
mobs_sharks.enable_medium (Enable Medium Sharks) bool true
mobs_sharks.enable_small (Enable Small Sharks) bool true

View File

@ -0,0 +1,44 @@
-- load settings
local ENABLE_LARGE = minetest.settings:get_bool("mobs_sharks.enable_large") ~= false
local ENABLE_MEDIUM = minetest.settings:get_bool("mobs_sharks.enable_medium") ~= false
local ENABLE_SMALL = minetest.settings:get_bool("mobs_sharks.enable_small") ~= false
-- Shark spawn examples
if ENABLE_SMALL then
mobs:spawn({
name = "mobs_sharks:shark_sm",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = 20000,
max_height = 0
})
end
if ENABLE_MEDIUM then
mobs:spawn({
name = "mobs_sharks:shark_md",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = 20000,
max_height = 0
})
end
if ENABLE_LARGE then
mobs:spawn({
name = "mobs_sharks:shark_lg",
nodes = {"group:water"},
neighbors = {"group:water", "seawrecks:woodship", "seawrecks:uboot"},
interval = 30,
chance = 20000,
max_height = 0
})
end

View File

@ -80,24 +80,6 @@ mobs:register_mob("mobs_turtles:turtle", {
end
})
-- spawn in world
mobs:spawn({
name = "mobs_turtles:turtle",
nodes = {(mod_mcl and "group:shovely" or "group:crumbly")},
neighbors = {
(mod_mcl and "groups:shovely" or "group:crumbly"),
(mod_mcl and "mcl_core:reeds" or "default:papyrus"),
(mod_mcl and "mcl_core:cactus" or "default:cactus"),
"dryplants:juncus", "dryplants:reedmace"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
min_height = 1,
max_height = 10
})
-- spawn egg
mobs:register_egg("mobs_turtles:turtle", "Turtle", "default_grass.png", 1)
@ -146,23 +128,47 @@ mobs:register_mob("mobs_turtles:seaturtle", {
end
})
-- spawn in world
mobs:spawn({
name = "mobs_turtles:seaturtle",
nodes = {"group:water"},
neighbors = {
"group:water", "group:seaplants", "seawrecks:woodship", "seawrecks:uboot"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
-- spawn egg
mobs:register_egg("mobs_turtles:seaturtle", "Sea Turtle", "default_water.png", 1)
-- Check for custom spawn.lua
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local input = io.open(MP .. "spawn.lua", "r")
if input then
input:close() ; input = nil ; dofile(MP .. "spawn.lua")
else
-- land turtle
mobs:spawn({
name = "mobs_turtles:turtle",
nodes = {(mod_mcl and "group:shovely" or "group:crumbly")},
neighbors = {
(mod_mcl and "groups:shovely" or "group:crumbly"),
(mod_mcl and "mcl_core:reeds" or "default:papyrus"),
(mod_mcl and "mcl_core:cactus" or "default:cactus"),
"dryplants:juncus", "dryplants:reedmace"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
min_height = 1,
max_height = 10
})
-- sea turtle
mobs:spawn({
name = "mobs_turtles:seaturtle",
nodes = {"group:water"},
neighbors = {
"group:water", "group:seaplants", "seawrecks:woodship", "seawrecks:uboot"
},
min_light = 5,
interval = 30,
chance = l_spawn_chance,
max_height = 0
})
end
print("[MOD] Mobs Redo Turtles loaded")

View File

@ -0,0 +1,30 @@
-- Turtle spawn examples
-- land turtle
mobs:spawn({
name = "mobs_turtles:turtle",
nodes = {"group:crumbly"},
neighbors = {
"group:crumbly", "default:papyrus", "default:cactus",
"dryplants:juncus", "dryplants:reedmace"
},
min_light = 5,
interval = 30,
chance = 30000,
min_height = 1,
max_height = 10
})
-- sea turtle
mobs:spawn({
name = "mobs_turtles:seaturtle",
nodes = {"group:water"},
neighbors = {
"group:water", "group:seaplants", "seawrecks:woodship", "seawrecks:uboot"
},
min_light = 5,
interval = 30,
chance = 30000,
max_height = 0
})