commit
34be057e41
|
@ -1,2 +1,4 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
|
@ -5,8 +5,23 @@ local l_skins = {
|
||||||
{"animal_bat.png"},
|
{"animal_bat.png"},
|
||||||
{"animal_bat.png^[colorize:black:150"}
|
{"animal_bat.png^[colorize:black:150"}
|
||||||
}
|
}
|
||||||
local l_spawnnear = {"default:stone"}
|
|
||||||
local l_spawnchance = 300000
|
local mod_config = config.settings_model('mobs_bat', {
|
||||||
|
bat = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({ "air" }),
|
||||||
|
near = config.types.list({ "default:stone" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(6, { min=0 }),
|
||||||
|
min_height = config.types.int(-25000, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_bat:bat", {
|
mobs:register_mob("mobs_bat:bat", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
|
@ -51,6 +66,23 @@ mobs:register_mob("mobs_bat:bat", {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
if mod_config.bat.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_bat:bat", {"air"}, l_spawnnear, 0, 6, 30, l_spawnchance, 2, -25000, 5000)
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_bat:bat",
|
||||||
|
mod_config.bat.spawn.on,
|
||||||
|
mod_config.bat.spawn.near,
|
||||||
|
mod_config.bat.spawn.min_light,
|
||||||
|
mod_config.bat.spawn.max_light,
|
||||||
|
mod_config.bat.spawn.interval,
|
||||||
|
mod_config.bat.spawn.chance,
|
||||||
|
mod_config.bat.spawn.active_object_count,
|
||||||
|
mod_config.bat.spawn.min_height,
|
||||||
|
mod_config.bat.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_bat:bat", "Bat", "animal_bat_inv.png", 0)
|
mobs:register_egg("mobs_bat:bat", "Bat", "animal_bat_inv.png", 0)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the bat mob
|
||||||
|
mobs_bat.bat.spawn.enabled (Enable bat spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the bat mob can spawn on top of
|
||||||
|
mobs_bat.bat.spawn.on (Nodes the bat will spawn on) string air
|
||||||
|
|
||||||
|
# List of nodenames that the bat mob can spawn beside
|
||||||
|
mobs_bat.bat.spawn.near (Nodes the bat will spawn near) string default:stone
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the bat mob will try to spawn
|
||||||
|
mobs_bat.bat.spawn.interval (Time between bat spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an bat to spawn on a given node
|
||||||
|
mobs_bat.bat.spawn.chance (Rarity of bat spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the bat mob can spawn at
|
||||||
|
mobs_bat.bat.spawn.min_light (Min. light level for bat spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the bat mob can spawn at
|
||||||
|
mobs_bat.bat.spawn.max_light (Max. light level for bat spawning) int 6 0
|
||||||
|
|
||||||
|
# The minimum height the bat mob can spawn at
|
||||||
|
mobs_bat.bat.spawn.min_height (Min. world height for bat spawning) int -25000 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the bat mob can spawn at
|
||||||
|
mobs_bat.bat.spawn.max_height (Max. world height for bat spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of bat mobs to spawn at one time inside map area
|
||||||
|
mobs_bat.bat.spawn.active_object_count (Number of bats in the same place) int 2 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Bat Mob", function ()
|
||||||
|
describe("Bat", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_bat:bat", { "air" }, { "default:stone" }, 0, 6, 30, 300000, 2, -25000, 5000)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
farming?
|
farming?
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_bear', {
|
||||||
|
medved = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({ "default:dirt_with_grass", "ethereal:green_dirt_top" }),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(15, { min=0 }),
|
||||||
|
min_height = config.types.int(-9, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_bear:medved", {
|
mobs:register_mob("mobs_bear:medved", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -101,14 +118,23 @@ mobs:register_mob("mobs_bear:medved", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local l_spawn_elevation_min = (minetest.setting_get("water_level") or 0) - 10
|
if mod_config.medved.spawn.enabled then
|
||||||
mobs:spawn({
|
mobs:spawn_specific(
|
||||||
name = "mobs_bear:medved",
|
"mobs_bear:medved",
|
||||||
nodes = {"default:dirt_with_grass", "ethereal:green_dirt_top"},
|
mod_config.medved.spawn.on,
|
||||||
min_light = 10,
|
mod_config.medved.spawn.near,
|
||||||
chance = 300000,
|
mod_config.medved.spawn.min_light,
|
||||||
min_height = l_spawn_elevation_min,
|
mod_config.medved.spawn.max_light,
|
||||||
max_height = 5000,
|
mod_config.medved.spawn.interval,
|
||||||
day_toggle = true,
|
mod_config.medved.spawn.chance,
|
||||||
})
|
mod_config.medved.spawn.active_object_count,
|
||||||
|
mod_config.medved.spawn.min_height,
|
||||||
|
mod_config.medved.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_bear:medved", "Bear", "wool_brown.png", 1)
|
mobs:register_egg("mobs_bear:medved", "Bear", "wool_brown.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the medved mob
|
||||||
|
mobs_bear.medved.spawn.enabled (Enable bear spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the medved mob can spawn on top of
|
||||||
|
mobs_bear.medved.spawn.on (Nodes the bear will spawn on) string default:dirt_with_grass,ethereal:green_dirt_top
|
||||||
|
|
||||||
|
# List of nodenames that the medved mob can spawn beside
|
||||||
|
mobs_bear.medved.spawn.near (Nodes the bear will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the medved mob will try to spawn
|
||||||
|
mobs_bear.medved.spawn.interval (Time between bear spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an bear to spawn on a given node
|
||||||
|
mobs_bear.medved.spawn.chance (Rarity of bear spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the medved mob can spawn at
|
||||||
|
mobs_bear.medved.spawn.min_light (Min. light level for bear spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the medved mob can spawn at
|
||||||
|
mobs_bear.medved.spawn.max_light (Max. light level for bear spawning) int 15 0
|
||||||
|
|
||||||
|
# The minimum height the medved mob can spawn at
|
||||||
|
mobs_bear.medved.spawn.min_height (Min. world height for bear spawning) int -10 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the medved mob can spawn at
|
||||||
|
mobs_bear.medved.spawn.max_height (Max. world height for bear spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of medved mobs to spawn at one time inside map area
|
||||||
|
mobs_bear.medved.spawn.active_object_count (Number of bears in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Bear Mob", function ()
|
||||||
|
describe("Medved", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_bear:medved", { "default:dirt_with_grass", "ethereal:green_dirt_top" }, { "air" }, 10, 15, 30, 300000, 1, -9, 5000, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,3 +1,5 @@
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
mobs_mr_goat?
|
mobs_mr_goat?
|
||||||
farming?
|
farming?
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_better_rat', {
|
||||||
|
rat = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({ "default:stone" }),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(-25000, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_better_rat:rat", {
|
mobs:register_mob("mobs_better_rat:rat", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -60,10 +77,23 @@ mobs:register_mob("mobs_better_rat:rat", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
if mod_config.rat.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_better_rat:rat",
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
{"default:stone"},
|
mobs:spawn_specific(
|
||||||
{"air"},
|
"mobs_better_rat:rat",
|
||||||
0, 14, 30, 300000, 2, -25000, 5000
|
mod_config.rat.spawn.on,
|
||||||
)
|
mod_config.rat.spawn.near,
|
||||||
|
mod_config.rat.spawn.min_light,
|
||||||
|
mod_config.rat.spawn.max_light,
|
||||||
|
mod_config.rat.spawn.interval,
|
||||||
|
mod_config.rat.spawn.chance,
|
||||||
|
mod_config.rat.spawn.active_object_count,
|
||||||
|
mod_config.rat.spawn.min_height,
|
||||||
|
mod_config.rat.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_better_rat:rat", "Mouse", "wool_brown.png", 1)
|
mobs:register_egg("mobs_better_rat:rat", "Mouse", "wool_brown.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the rat mob
|
||||||
|
mobs_better_rat.rat.spawn.enabled (Enable rat spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the rat mob can spawn on top of
|
||||||
|
mobs_better_rat.rat.spawn.on (Nodes the rat will spawn on) string default:stone
|
||||||
|
|
||||||
|
# List of nodenames that the rat mob can spawn beside
|
||||||
|
mobs_better_rat.rat.spawn.near (Nodes the rat will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the rat mob will try to spawn
|
||||||
|
mobs_better_rat.rat.spawn.interval (Time between rat spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an rat to spawn on a given node
|
||||||
|
mobs_better_rat.rat.spawn.chance (Rarity of rat spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the rat mob can spawn at
|
||||||
|
mobs_better_rat.rat.spawn.min_light (Min. light level for rat spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the rat mob can spawn at
|
||||||
|
mobs_better_rat.rat.spawn.max_light (Max. light level for rat spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the rat mob can spawn at
|
||||||
|
mobs_better_rat.rat.spawn.min_height (Min. world height for rat spawning) int -25000 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the rat mob can spawn at
|
||||||
|
mobs_better_rat.rat.spawn.max_height (Max. world height for rat spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of rat mobs to spawn at one time inside map area
|
||||||
|
mobs_better_rat.rat.spawn.active_object_count (Number of rats in the same place) int 2 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Better Rat Mob", function ()
|
||||||
|
describe("Better Rat", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_better_rat:rat", { "default:stone" }, { "air" }, 0, 14, 30, 300000, 2, -25000, 5000)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
||||||
|
|
|
@ -26,11 +26,51 @@ local l_thrush_model = "mobs_birds_thrush.b3d"
|
||||||
local l_egg_texture = "default_cloud.png"
|
local l_egg_texture = "default_cloud.png"
|
||||||
local l_capture_chance_h = 5
|
local l_capture_chance_h = 5
|
||||||
local l_capture_chance_n = 60
|
local l_capture_chance_n = 60
|
||||||
local l_spawn_in = {"air"}
|
|
||||||
local l_spawn_near_gull = {"default:water_source", "default:water_flowing"}
|
local mod_config = config.settings_model('mobs_birds', {
|
||||||
local l_spawn_near_bird = {"default:leaves", "default:pine_needles", "default:jungleleaves", "default:cactus"}
|
gull = {
|
||||||
local l_spawn_chance_gull = 240000
|
spawn = {
|
||||||
local l_spawn_chance_bird = 360000
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({ "air" }),
|
||||||
|
near = config.types.list({"default:water_source", "default:water_flowing"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(240000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bird_lg = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({ "air" }),
|
||||||
|
near = config.types.list({"default:leaves", "default:pine_needles", "default:jungleleaves", "default:cactus"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(360000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bird_sm = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({ "air" }),
|
||||||
|
near = config.types.list({"default:leaves", "default:pine_needles", "default:jungleleaves", "default:cactus"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(360000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- gulls
|
-- gulls
|
||||||
mobs:register_mob("mobs_birds:gull", {
|
mobs:register_mob("mobs_birds:gull", {
|
||||||
|
@ -62,8 +102,21 @@ mobs:register_mob("mobs_birds:gull", {
|
||||||
{name="mobs:chicken_feather", chance=1, min=0, max=2}
|
{name="mobs:chicken_feather", chance=1, min=0, max=2}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
if mod_config.gull.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_birds:gull", l_spawn_in, l_spawn_near_gull, 5, 20, 30, l_spawn_chance_gull, 1, 0, 5000)
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_birds:gull",
|
||||||
|
mod_config.gull.spawn.on,
|
||||||
|
mod_config.gull.spawn.near,
|
||||||
|
mod_config.gull.spawn.min_light,
|
||||||
|
mod_config.gull.spawn.max_light,
|
||||||
|
mod_config.gull.spawn.interval,
|
||||||
|
mod_config.gull.spawn.chance,
|
||||||
|
mod_config.gull.spawn.active_object_count,
|
||||||
|
mod_config.gull.spawn.min_height,
|
||||||
|
mod_config.gull.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_birds:gull", "Gull", l_egg_texture, 1)
|
mobs:register_egg("mobs_birds:gull", "Gull", l_egg_texture, 1)
|
||||||
|
|
||||||
-- large birds
|
-- large birds
|
||||||
|
@ -97,8 +150,21 @@ mobs:register_mob("mobs_birds:bird_lg", {
|
||||||
{name="mobs:chicken_feather", chance=1, min=0, max=2}
|
{name="mobs:chicken_feather", chance=1, min=0, max=2}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
if mod_config.bird_lg.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_birds:bird_lg", l_spawn_in, l_spawn_near_bird, 5, 20, 30, l_spawn_chance_bird, 1, 0, 5000)
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_birds:bird_lg",
|
||||||
|
mod_config.bird_lg.spawn.on,
|
||||||
|
mod_config.bird_lg.spawn.near,
|
||||||
|
mod_config.bird_lg.spawn.min_light,
|
||||||
|
mod_config.bird_lg.spawn.max_light,
|
||||||
|
mod_config.bird_lg.spawn.interval,
|
||||||
|
mod_config.bird_lg.spawn.chance,
|
||||||
|
mod_config.bird_lg.spawn.active_object_count,
|
||||||
|
mod_config.bird_lg.spawn.min_height,
|
||||||
|
mod_config.bird_lg.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_birds:bird_lg", "Large bird", l_egg_texture, 1)
|
mobs:register_egg("mobs_birds:bird_lg", "Large bird", l_egg_texture, 1)
|
||||||
|
|
||||||
-- small birds
|
-- small birds
|
||||||
|
@ -132,6 +198,22 @@ mobs:register_mob("mobs_birds:bird_sm", {
|
||||||
{name="mobs:chicken_feather", chance=1, min=0, max=1}
|
{name="mobs:chicken_feather", chance=1, min=0, max=1}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
if mod_config.bird_sm.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_birds:bird_sm", l_spawn_in, l_spawn_near_bird, 5, 20, 30, l_spawn_chance_bird, 1, 0, 5000)
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_birds:bird_sm",
|
||||||
|
mod_config.bird_sm.spawn.on,
|
||||||
|
mod_config.bird_sm.spawn.near,
|
||||||
|
mod_config.bird_sm.spawn.min_light,
|
||||||
|
mod_config.bird_sm.spawn.max_light,
|
||||||
|
mod_config.bird_sm.spawn.interval,
|
||||||
|
mod_config.bird_sm.spawn.chance,
|
||||||
|
mod_config.bird_sm.spawn.active_object_count,
|
||||||
|
mod_config.bird_sm.spawn.min_height,
|
||||||
|
mod_config.bird_sm.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_birds:bird_sm", "Small bird", l_egg_texture, 1)
|
mobs:register_egg("mobs_birds:bird_sm", "Small bird", l_egg_texture, 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the gull mob
|
||||||
|
mobs_birds.gull.spawn.enabled (Enable gull spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the gull mob can spawn on top of
|
||||||
|
mobs_birds.gull.spawn.on (Nodes the gull will spawn on) string air
|
||||||
|
|
||||||
|
# List of nodenames that the gull mob can spawn beside
|
||||||
|
mobs_birds.gull.spawn.near (Nodes the gull will spawn near) string default:water_source,default:water_flowing
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the gull mob will try to spawn
|
||||||
|
mobs_birds.gull.spawn.interval (Time between gull spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an gull to spawn on a given node
|
||||||
|
mobs_birds.gull.spawn.chance (Rarity of gull spawning) int 240000 1
|
||||||
|
|
||||||
|
# The minimum light level the gull mob can spawn at
|
||||||
|
mobs_birds.gull.spawn.min_light (Min. light level for gull spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the gull mob can spawn at
|
||||||
|
mobs_birds.gull.spawn.max_light (Max. light level for gull spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the gull mob can spawn at
|
||||||
|
mobs_birds.gull.spawn.min_height (Min. world height for gull spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the gull mob can spawn at
|
||||||
|
mobs_birds.gull.spawn.max_height (Max. world height for gull spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of gull mobs to spawn at one time inside map area
|
||||||
|
mobs_birds.gull.spawn.active_object_count (Number of gulls in the same place) int 1 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the bird_lg mob
|
||||||
|
mobs_birds.bird_lg.spawn.enabled (Enable large bird spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the bird_lg mob can spawn on top of
|
||||||
|
mobs_birds.bird_lg.spawn.on (Nodes the large bird will spawn on) string air
|
||||||
|
|
||||||
|
# List of nodenames that the bird_lg mob can spawn beside
|
||||||
|
mobs_birds.bird_lg.spawn.near (Nodes the large bird will spawn near) string default:leaves,default:pine_needles,default:jungleleaves,default:cactus
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the bird_lg mob will try to spawn
|
||||||
|
mobs_birds.bird_lg.spawn.interval (Time between large bird spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an large bird to spawn on a given node
|
||||||
|
mobs_birds.bird_lg.spawn.chance (Rarity of large bird spawning) int 360000 1
|
||||||
|
|
||||||
|
# The minimum light level the bird_lg mob can spawn at
|
||||||
|
mobs_birds.bird_lg.spawn.min_light (Min. light level for large bird spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the bird_lg mob can spawn at
|
||||||
|
mobs_birds.bird_lg.spawn.max_light (Max. light level for large bird spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the bird_lg mob can spawn at
|
||||||
|
mobs_birds.bird_lg.spawn.min_height (Min. world height for large bird spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the bird_lg mob can spawn at
|
||||||
|
mobs_birds.bird_lg.spawn.max_height (Max. world height for large bird spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of bird_lg mobs to spawn at one time inside map area
|
||||||
|
mobs_birds.bird_lg.spawn.active_object_count (Number of large birds in the same place) int 1 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the bird_sm mob
|
||||||
|
mobs_birds.bird_sm.spawn.enabled (Enable small bird spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the bird_sm mob can spawn on top of
|
||||||
|
mobs_birds.bird_sm.spawn.on (Nodes the small bird will spawn on) string air
|
||||||
|
|
||||||
|
# List of nodenames that the bird_sm mob can spawn beside
|
||||||
|
mobs_birds.bird_sm.spawn.near (Nodes the small bird will spawn near) string default:leaves,default:pine_needles,default:jungleleaves,default:cactus
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the bird_sm mob will try to spawn
|
||||||
|
mobs_birds.bird_sm.spawn.interval (Time between small bird spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an small bird to spawn on a given node
|
||||||
|
mobs_birds.bird_sm.spawn.chance (Rarity of small bird spawning) int 360000 1
|
||||||
|
|
||||||
|
# The minimum light level the bird_sm mob can spawn at
|
||||||
|
mobs_birds.bird_sm.spawn.min_light (Min. light level for small bird spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the bird_sm mob can spawn at
|
||||||
|
mobs_birds.bird_sm.spawn.max_light (Max. light level for small bird spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the bird_sm mob can spawn at
|
||||||
|
mobs_birds.bird_sm.spawn.min_height (Min. world height for small bird spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the bird_sm mob can spawn at
|
||||||
|
mobs_birds.bird_sm.spawn.max_height (Max. world height for small bird spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of bird_sm mobs to spawn at one time inside map area
|
||||||
|
mobs_birds.bird_sm.spawn.active_object_count (Number of small birds in the same place) int 1 1
|
|
@ -0,0 +1,29 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Birds Mob", function ()
|
||||||
|
describe("Birds", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_birds:bird_lg", { "air" }, { "default:leaves", "default:pine_needles", "default:jungleleaves", "default:cactus" }, 5, 20, 30, 360000, 1, 0, 5000)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_birds:gull", { "air" }, { "default:water_source", "default:water_flowing" }, 5, 20, 30, 240000, 1, 0, 5000)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_birds:bird_sm", { "air" }, { "default:leaves", "default:pine_needles", "default:jungleleaves", "default:cactus" }, 5, 20, 30, 360000, 1, 0, 5000)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
farming?
|
farming?
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,30 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_bugslive', {
|
||||||
|
bug = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt_with_coniferous_litter",
|
||||||
|
"default:dirt_with_dry_grass",
|
||||||
|
"default:dirt_with_rainforest_litter",
|
||||||
|
"default:stone",
|
||||||
|
"ethereal:green_dirt_top"
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air", "default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(15, { min=0 }),
|
||||||
|
min_height = config.types.int(-25000, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_bugslive:bug", {
|
mobs:register_mob("mobs_bugslive:bug", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -63,18 +88,23 @@ mobs:register_mob("mobs_bugslive:bug", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
if mod_config.bug.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_bugslive:bug",
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
{
|
mobs:spawn_specific(
|
||||||
"default:dirt",
|
"mobs_bugslive:bug",
|
||||||
"default:dirt_with_grass",
|
mod_config.bug.spawn.on,
|
||||||
"default:dirt_with_coniferous_litter",
|
mod_config.bug.spawn.near,
|
||||||
"default:dirt_with_dry_grass",
|
mod_config.bug.spawn.min_light,
|
||||||
"default:dirt_with_rainforest_litter",
|
mod_config.bug.spawn.max_light,
|
||||||
"default:stone",
|
mod_config.bug.spawn.interval,
|
||||||
"ethereal:green_dirt_top"
|
mod_config.bug.spawn.chance,
|
||||||
},
|
mod_config.bug.spawn.active_object_count,
|
||||||
{"air", "default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"},
|
mod_config.bug.spawn.min_height,
|
||||||
0, 15, 30, 300000, 2, -25000, 5000
|
mod_config.bug.spawn.max_height
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_bugslive:bug", "Bug", "inv_bug.png", 0)
|
mobs:register_egg("mobs_bugslive:bug", "Bug", "inv_bug.png", 0)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the bug mob
|
||||||
|
mobs_bugslive.bug.spawn.enabled (Enable bug spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the bug mob can spawn on top of
|
||||||
|
mobs_bugslive.bug.spawn.on (Nodes the bug will spawn on) string default:dirt, default:dirt_with_grass, default:dirt_with_coniferous_litter, default:dirt_with_dry_grass, default:dirt_with_rainforest_litter, default:stone, ethereal:green_dirt_top
|
||||||
|
|
||||||
|
# List of nodenames that the bug mob can spawn beside
|
||||||
|
mobs_bugslive.bug.spawn.near (Nodes the bug will spawn near) string air, default:water_source, default:water_flowing, default:river_water_source, default:river_water_flowing
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the bug mob will try to spawn
|
||||||
|
mobs_bugslive.bug.spawn.interval (Time between bug spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an bug to spawn on a given node
|
||||||
|
mobs_bugslive.bug.spawn.chance (Rarity of bug spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the bug mob can spawn at
|
||||||
|
mobs_bugslive.bug.spawn.min_light (Min. light level for bug spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the bug mob can spawn at
|
||||||
|
mobs_bugslive.bug.spawn.max_light (Max. light level for bug spawning) int 15 0
|
||||||
|
|
||||||
|
# The minimum height the bug mob can spawn at
|
||||||
|
mobs_bugslive.bug.spawn.min_height (Min. world height for bug spawning) int -25000 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the bug mob can spawn at
|
||||||
|
mobs_bugslive.bug.spawn.max_height (Max. world height for bug spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of bug mobs to spawn at one time inside map area
|
||||||
|
mobs_bugslive.bug.spawn.active_object_count (Number of bugs in the same place) int 2 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("BugsLive Mob", function ()
|
||||||
|
describe("BugsLive", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_bugslive:bug", { "default:dirt", "default:dirt_with_grass", "default:dirt_with_coniferous_litter", "default:dirt_with_dry_grass", "default:dirt_with_rainforest_litter", "default:stone", "ethereal:green_dirt_top" }, { "air", "default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing" }, 0, 15, 30, 300000, 2, -25000, 5000)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
||||||
|
|
|
@ -9,8 +9,23 @@ local l_skins = {
|
||||||
{"(bf1.png^[colorize:pink)^(bf2.png^[colorize:white)^(bf3.png^[colorize:blue)^(bf4.png^[colorize:orange)^(bf5.png^[colorize:gray)"},
|
{"(bf1.png^[colorize:pink)^(bf2.png^[colorize:white)^(bf3.png^[colorize:blue)^(bf4.png^[colorize:orange)^(bf5.png^[colorize:gray)"},
|
||||||
{"(bf1.png^[colorize:darkgreen)^(bf2.png^[colorize:brown)^(bf3.png^[colorize:black)^(bf4.png^[colorize:darkgray)^(bf5.png^[colorize:red)"}
|
{"(bf1.png^[colorize:darkgreen)^(bf2.png^[colorize:brown)^(bf3.png^[colorize:black)^(bf4.png^[colorize:darkgray)^(bf5.png^[colorize:red)"}
|
||||||
}
|
}
|
||||||
local l_spawnnear = {"group:flower"}
|
|
||||||
local l_spawnchance = 300000
|
local mod_config = config.settings_model('mobs_butterfly', {
|
||||||
|
butterfly = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"air"}),
|
||||||
|
near = config.types.list({"group:flower"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- Butterfly
|
-- Butterfly
|
||||||
mobs:register_mob("mobs_butterfly:butterfly", {
|
mobs:register_mob("mobs_butterfly:butterfly", {
|
||||||
|
@ -41,6 +56,24 @@ mobs:register_mob("mobs_butterfly:butterfly", {
|
||||||
mobs:capture_mob(self, clicker, 10, 80, 0, true, "mobs_butterfly:butterfly")
|
mobs:capture_mob(self, clicker, 10, 80, 0, true, "mobs_butterfly:butterfly")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
|
||||||
mobs:spawn_specific("mobs_butterfly:butterfly", {"air"}, l_spawnnear, 5, 20, 30, l_spawnchance, 1, 0, 5000)
|
if mod_config.butterfly.spawn.enabled then
|
||||||
|
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_butterfly:butterfly",
|
||||||
|
mod_config.butterfly.spawn.on,
|
||||||
|
mod_config.butterfly.spawn.near,
|
||||||
|
mod_config.butterfly.spawn.min_light,
|
||||||
|
mod_config.butterfly.spawn.max_light,
|
||||||
|
mod_config.butterfly.spawn.interval,
|
||||||
|
mod_config.butterfly.spawn.chance,
|
||||||
|
mod_config.butterfly.spawn.active_object_count,
|
||||||
|
mod_config.butterfly.spawn.min_height,
|
||||||
|
mod_config.butterfly.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_butterfly:butterfly", "Butterfly", "default_cloud.png", 1)
|
mobs:register_egg("mobs_butterfly:butterfly", "Butterfly", "default_cloud.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the butterfly mob
|
||||||
|
mobs_butterfly.butterfly.spawn.enabled (Enable butterfly spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the butterfly mob can spawn on top of
|
||||||
|
mobs_butterfly.butterfly.spawn.on (Nodes the butterfly will spawn on) string air
|
||||||
|
|
||||||
|
# List of nodenames that the butterfly mob can spawn beside
|
||||||
|
mobs_butterfly.butterfly.spawn.near (Nodes the butterfly will spawn near) string group:flower
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the butterfly mob will try to spawn
|
||||||
|
mobs_butterfly.butterfly.spawn.interval (Time between butterfly spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an butterfly to spawn on a given node
|
||||||
|
mobs_butterfly.butterfly.spawn.chance (Rarity of butterfly spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the butterfly mob can spawn at
|
||||||
|
mobs_butterfly.butterfly.spawn.min_light (Min. light level for butterfly spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the butterfly mob can spawn at
|
||||||
|
mobs_butterfly.butterfly.spawn.max_light (Max. light level for butterfly spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the butterfly mob can spawn at
|
||||||
|
mobs_butterfly.butterfly.spawn.min_height (Min. world height for butterfly spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the butterfly mob can spawn at
|
||||||
|
mobs_butterfly.butterfly.spawn.max_height (Max. world height for butterfly spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of butterfly mobs to spawn at one time inside map area
|
||||||
|
mobs_butterfly.butterfly.spawn.active_object_count (Number of butterflies in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Butterfly Mob", function ()
|
||||||
|
describe("Butterfly", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_butterfly:butterfly", { "air" }, { "group:flower" }, 5, 20, 30, 300000, 1, 0, 5000)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
farming?
|
farming?
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,26 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_deer', {
|
||||||
|
deer = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt_with_coniferous_litter",
|
||||||
|
"ethereal:green_dirt_top"
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(15, { min=0 }),
|
||||||
|
min_height = config.types.int(2, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_deer:deer", {
|
mobs:register_mob("mobs_deer:deer", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -61,23 +82,23 @@ mobs:register_mob("mobs_deer:deer", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local l_spawn_elevation_min = minetest.setting_get("water_level")
|
if mod_config.deer.spawn.enabled then
|
||||||
if l_spawn_elevation_min then
|
mobs:spawn_specific(
|
||||||
l_spawn_elevation_min = l_spawn_elevation_min + 1
|
"mobs_deer:deer",
|
||||||
else
|
mod_config.deer.spawn.on,
|
||||||
l_spawn_elevation_min = 1
|
mod_config.deer.spawn.near,
|
||||||
|
mod_config.deer.spawn.min_light,
|
||||||
|
mod_config.deer.spawn.max_light,
|
||||||
|
mod_config.deer.spawn.interval,
|
||||||
|
mod_config.deer.spawn.chance,
|
||||||
|
mod_config.deer.spawn.active_object_count,
|
||||||
|
mod_config.deer.spawn.min_height,
|
||||||
|
mod_config.deer.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
mobs:spawn({
|
|
||||||
name = "mobs_deer:deer",
|
|
||||||
nodes = {
|
|
||||||
"default:dirt_with_grass",
|
|
||||||
"default:dirt_with_coniferous_litter",
|
|
||||||
"ethereal:green_dirt_top"
|
|
||||||
},
|
|
||||||
min_light = 10,
|
|
||||||
chance = 300000,
|
|
||||||
min_height = l_spawn_elevation_min,
|
|
||||||
max_height = 5000,
|
|
||||||
day_toggle = true,
|
|
||||||
})
|
|
||||||
mobs:register_egg("mobs_deer:deer", "Deer", "wool_violet.png", 1)
|
mobs:register_egg("mobs_deer:deer", "Deer", "wool_violet.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the deer mob
|
||||||
|
mobs_deer.deer.spawn.enabled (Enable deer spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the deer mob can spawn on top of
|
||||||
|
mobs_deer.deer.spawn.on (Nodes the deer will spawn on) string default:dirt_with_grass, default:dirt_with_coniferous_litter, ethereal:green_dirt_top
|
||||||
|
|
||||||
|
# List of nodenames that the deer mob can spawn beside
|
||||||
|
mobs_deer.deer.spawn.near (Nodes the deer will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the deer mob will try to spawn
|
||||||
|
mobs_deer.deer.spawn.interval (Time between deer spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an deer to spawn on a given node
|
||||||
|
mobs_deer.deer.spawn.chance (Rarity of deer spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the deer mob can spawn at
|
||||||
|
mobs_deer.deer.spawn.min_light (Min. light level for deer spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the deer mob can spawn at
|
||||||
|
mobs_deer.deer.spawn.max_light (Max. light level for deer spawning) int 15 0
|
||||||
|
|
||||||
|
# The minimum height the deer mob can spawn at
|
||||||
|
mobs_deer.deer.spawn.min_height (Min. world height for deer spawning) int 1 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the deer mob can spawn at
|
||||||
|
mobs_deer.deer.spawn.max_height (Max. world height for deer spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of deer mobs to spawn at one time inside map area
|
||||||
|
mobs_deer.deer.spawn.active_object_count (Number of deers in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Deer Mob", function ()
|
||||||
|
describe("Deer", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_deer:deer", { "default:dirt_with_grass", "default:dirt_with_coniferous_litter", "ethereal:green_dirt_top" }, { "air" }, 10, 15, 30, 300000, 1, 2, 5000, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -0,0 +1,115 @@
|
||||||
|
mobs_doomed.config = config.settings_model('mobs_doomed', {
|
||||||
|
badger = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt_with_coniferous_litter"
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
elephant = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt_with_dry_grass",
|
||||||
|
"default:desert_sand"
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fox = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt_with_coniferous_litter",
|
||||||
|
"default:dirt_with_snow"
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hedgehog = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt_with_coniferous_litter"
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
owl = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"group:leaves"}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tortoise = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:clay", "group:sand"}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(2, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
whale = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:water_source"}),
|
||||||
|
near = config.types.list({"default:water_source"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(3000000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(-40, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -1,4 +1,6 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
wool
|
wool
|
||||||
farming?
|
config
|
||||||
|
farming?
|
||||||
|
test?
|
|
@ -16,6 +16,8 @@ mobs_doomed.deepclone = function(t) -- deep-copy a table -- from https://gist.gi
|
||||||
return target
|
return target
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath("mobs_doomed")..'/config.lua')
|
||||||
|
|
||||||
-- Start loading ----------------------------------------------------------------------------------
|
-- Start loading ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function loadmob(mobname,dir)
|
local function loadmob(mobname,dir)
|
||||||
|
@ -40,3 +42,6 @@ local mobslist = {
|
||||||
for _,mobname in pairs(mobslist) do
|
for _,mobname in pairs(mobslist) do
|
||||||
loadmob(mobname)
|
loadmob(mobname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -64,11 +64,17 @@ mobs:register_mob("mobs_doomed:badger", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:badger", "Badger", "default_obsidian.png", 1)
|
mobs:register_egg("mobs_doomed:badger", "Badger", "default_obsidian.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:badger",
|
if mobs_doomed.config.badger.spawn.enabled then
|
||||||
{
|
mobs:spawn_specific(
|
||||||
"default:dirt_with_grass",
|
"mobs_doomed:badger",
|
||||||
"default:dirt",
|
mobs_doomed.config.badger.spawn.on,
|
||||||
"default:dirt_with_coniferous_litter"
|
mobs_doomed.config.badger.spawn.near,
|
||||||
},
|
mobs_doomed.config.badger.spawn.min_light,
|
||||||
{"air"},
|
mobs_doomed.config.badger.spawn.max_light,
|
||||||
0, 14, 30, 300000, 2, 0, 5000)
|
mobs_doomed.config.badger.spawn.interval,
|
||||||
|
mobs_doomed.config.badger.spawn.chance,
|
||||||
|
mobs_doomed.config.badger.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.badger.spawn.min_height,
|
||||||
|
mobs_doomed.config.badger.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -58,10 +58,18 @@ mobs:register_mob("mobs_doomed:elephant", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:elephant", "Elephant", "default_dry_grass.png", 1)
|
mobs:register_egg("mobs_doomed:elephant", "Elephant", "default_dry_grass.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:elephant",
|
if mobs_doomed.config.elephant.spawn.enabled then
|
||||||
{
|
mobs:spawn_specific(
|
||||||
"default:dirt_with_dry_grass",
|
"mobs_doomed:elephant",
|
||||||
"default:desert_sand"
|
mobs_doomed.config.elephant.spawn.on,
|
||||||
},
|
mobs_doomed.config.elephant.spawn.near,
|
||||||
{"air"},
|
mobs_doomed.config.elephant.spawn.min_light,
|
||||||
10, 14, 30, 300000, 2, 0, 5000, true)
|
mobs_doomed.config.elephant.spawn.max_light,
|
||||||
|
mobs_doomed.config.elephant.spawn.interval,
|
||||||
|
mobs_doomed.config.elephant.spawn.chance,
|
||||||
|
mobs_doomed.config.elephant.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.elephant.spawn.min_height,
|
||||||
|
mobs_doomed.config.elephant.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -67,12 +67,17 @@ mobs:register_mob("mobs_doomed:fox", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:fox", "Fox", "wool_orange.png", 1)
|
mobs:register_egg("mobs_doomed:fox", "Fox", "wool_orange.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:fox",
|
if mobs_doomed.config.fox.spawn.enabled then
|
||||||
{
|
mobs:spawn_specific(
|
||||||
"default:dirt_with_grass",
|
"mobs_doomed:fox",
|
||||||
"default:dirt",
|
mobs_doomed.config.fox.spawn.on,
|
||||||
"default:dirt_with_coniferous_litter",
|
mobs_doomed.config.fox.spawn.near,
|
||||||
"default:dirt_with_snow"
|
mobs_doomed.config.fox.spawn.min_light,
|
||||||
},
|
mobs_doomed.config.fox.spawn.max_light,
|
||||||
{"air"},
|
mobs_doomed.config.fox.spawn.interval,
|
||||||
0, 14, 30, 300000, 2, 0, 5000, nil)
|
mobs_doomed.config.fox.spawn.chance,
|
||||||
|
mobs_doomed.config.fox.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.fox.spawn.min_height,
|
||||||
|
mobs_doomed.config.fox.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -52,10 +52,17 @@ mobs:register_mob("mobs_doomed:hedgehog", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:hedgehog", "Hedgehog", "wool_brown.png", 1)
|
mobs:register_egg("mobs_doomed:hedgehog", "Hedgehog", "wool_brown.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:hedgehog",
|
if mobs_doomed.config.hedgehog.spawn.enabled then
|
||||||
{
|
mobs:spawn_specific(
|
||||||
"default:dirt_with_grass",
|
"mobs_doomed:hedgehog",
|
||||||
"default:dirt_with_coniferous_litter"
|
mobs_doomed.config.hedgehog.spawn.on,
|
||||||
},
|
mobs_doomed.config.hedgehog.spawn.near,
|
||||||
{"air"},
|
mobs_doomed.config.hedgehog.spawn.min_light,
|
||||||
0, 14, 30, 300000, 2, 0, 5000, nil)
|
mobs_doomed.config.hedgehog.spawn.max_light,
|
||||||
|
mobs_doomed.config.hedgehog.spawn.interval,
|
||||||
|
mobs_doomed.config.hedgehog.spawn.chance,
|
||||||
|
mobs_doomed.config.hedgehog.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.hedgehog.spawn.min_height,
|
||||||
|
mobs_doomed.config.hedgehog.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -47,7 +47,18 @@ mobs:register_mob("mobs_doomed:owl", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:owl", "Owl", "default_tree.png", 1)
|
mobs:register_egg("mobs_doomed:owl", "Owl", "default_tree.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:owl",
|
if mobs_doomed.config.owl.spawn.enabled then
|
||||||
{"group:leaves"},
|
mobs:spawn_specific(
|
||||||
{"air"},
|
"mobs_doomed:owl",
|
||||||
0, 14, 30, 300000, 2, 0, 5000, false)
|
mobs_doomed.config.owl.spawn.on,
|
||||||
|
mobs_doomed.config.owl.spawn.near,
|
||||||
|
mobs_doomed.config.owl.spawn.min_light,
|
||||||
|
mobs_doomed.config.owl.spawn.max_light,
|
||||||
|
mobs_doomed.config.owl.spawn.interval,
|
||||||
|
mobs_doomed.config.owl.spawn.chance,
|
||||||
|
mobs_doomed.config.owl.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.owl.spawn.min_height,
|
||||||
|
mobs_doomed.config.owl.spawn.max_height,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -53,7 +53,18 @@ mobs:register_mob("mobs_doomed:tortoise", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:tortoise", "Tortoise", "default_grass.png", 1)
|
mobs:register_egg("mobs_doomed:tortoise", "Tortoise", "default_grass.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:tortoise",
|
if mobs_doomed.config.tortoise.spawn.enabled then
|
||||||
{"default:clay", "group:sand"},
|
mobs:spawn_specific(
|
||||||
{"air"},
|
"mobs_doomed:tortoise",
|
||||||
10, 14, 30, 300000, 2, 0, 5000, true)
|
mobs_doomed.config.tortoise.spawn.on,
|
||||||
|
mobs_doomed.config.tortoise.spawn.near,
|
||||||
|
mobs_doomed.config.tortoise.spawn.min_light,
|
||||||
|
mobs_doomed.config.tortoise.spawn.max_light,
|
||||||
|
mobs_doomed.config.tortoise.spawn.interval,
|
||||||
|
mobs_doomed.config.tortoise.spawn.chance,
|
||||||
|
mobs_doomed.config.tortoise.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.tortoise.spawn.min_height,
|
||||||
|
mobs_doomed.config.tortoise.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -53,7 +53,18 @@ mobs:register_mob("mobs_doomed:whale", {
|
||||||
|
|
||||||
mobs:register_egg("mobs_doomed:whale", "Whale", "wool_blue.png", 1)
|
mobs:register_egg("mobs_doomed:whale", "Whale", "wool_blue.png", 1)
|
||||||
|
|
||||||
mobs:spawn_specific("mobs_doomed:whale",
|
if mobs_doomed.config.whale.spawn.enabled then
|
||||||
{"default:water_source"},
|
mobs:spawn_specific(
|
||||||
{"default:water_source"},
|
"mobs_doomed:whale",
|
||||||
0, 14, 30, 3000000, 1, -40, 0, true)
|
mobs_doomed.config.whale.spawn.on,
|
||||||
|
mobs_doomed.config.whale.spawn.near,
|
||||||
|
mobs_doomed.config.whale.spawn.min_light,
|
||||||
|
mobs_doomed.config.whale.spawn.max_light,
|
||||||
|
mobs_doomed.config.whale.spawn.interval,
|
||||||
|
mobs_doomed.config.whale.spawn.chance,
|
||||||
|
mobs_doomed.config.whale.spawn.active_object_count,
|
||||||
|
mobs_doomed.config.whale.spawn.min_height,
|
||||||
|
mobs_doomed.config.whale.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,228 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the badger mob
|
||||||
|
mobs_doomed.badger.spawn.enabled (Enable badger spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the badger mob can spawn on top of
|
||||||
|
mobs_doomed.badger.spawn.on (Nodes the badger will spawn on) string default:dirt_with_grass, default:dirt, default:dirt_with_coniferous_litter
|
||||||
|
|
||||||
|
# List of nodenames that the badger mob can spawn beside
|
||||||
|
mobs_doomed.badger.spawn.near (Nodes the badger will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the badger mob will try to spawn
|
||||||
|
mobs_doomed.badger.spawn.interval (Time between badger spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an badger to spawn on a given node
|
||||||
|
mobs_doomed.badger.spawn.chance (Rarity of badger spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the badger mob can spawn at
|
||||||
|
mobs_doomed.badger.spawn.min_light (Min. light level for badger spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the badger mob can spawn at
|
||||||
|
mobs_doomed.badger.spawn.max_light (Max. light level for badger spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the badger mob can spawn at
|
||||||
|
mobs_doomed.badger.spawn.min_height (Min. world height for badger spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the badger mob can spawn at
|
||||||
|
mobs_doomed.badger.spawn.max_height (Max. world height for badger spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of badger mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.badger.spawn.active_object_count (Number of badgers in the same place) int 2 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the elephant mob
|
||||||
|
mobs_doomed.elephant.spawn.enabled (Enable elephant spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the elephant mob can spawn on top of
|
||||||
|
mobs_doomed.elephant.spawn.on (Nodes the elephant will spawn on) string default:dirt_with_dry_grass, default:desert_sand
|
||||||
|
|
||||||
|
# List of nodenames that the elephant mob can spawn beside
|
||||||
|
mobs_doomed.elephant.spawn.near (Nodes the elephant will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the elephant mob will try to spawn
|
||||||
|
mobs_doomed.elephant.spawn.interval (Time between elephant spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an elephant to spawn on a given node
|
||||||
|
mobs_doomed.elephant.spawn.chance (Rarity of elephant spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the elephant mob can spawn at
|
||||||
|
mobs_doomed.elephant.spawn.min_light (Min. light level for elephant spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the elephant mob can spawn at
|
||||||
|
mobs_doomed.elephant.spawn.max_light (Max. light level for elephant spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the elephant mob can spawn at
|
||||||
|
mobs_doomed.elephant.spawn.min_height (Min. world height for elephant spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the elephant mob can spawn at
|
||||||
|
mobs_doomed.elephant.spawn.max_height (Max. world height for elephant spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of elephant mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.elephant.spawn.active_object_count (Number of elephants in the same place) int 2 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the fox mob
|
||||||
|
mobs_doomed.fox.spawn.enabled (Enable fox spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the fox mob can spawn on top of
|
||||||
|
mobs_doomed.fox.spawn.on (Nodes the fox will spawn on) string default:dirt_with_grass, default:dirt, default:dirt_with_coniferous_litter, default:dirt_with_snow
|
||||||
|
|
||||||
|
# List of nodenames that the fox mob can spawn beside
|
||||||
|
mobs_doomed.fox.spawn.near (Nodes the fox will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the fox mob will try to spawn
|
||||||
|
mobs_doomed.fox.spawn.interval (Time between fox spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an fox to spawn on a given node
|
||||||
|
mobs_doomed.fox.spawn.chance (Rarity of fox spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the fox mob can spawn at
|
||||||
|
mobs_doomed.fox.spawn.min_light (Min. light level for fox spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the fox mob can spawn at
|
||||||
|
mobs_doomed.fox.spawn.max_light (Max. light level for fox spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the fox mob can spawn at
|
||||||
|
mobs_doomed.fox.spawn.min_height (Min. world height for fox spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the fox mob can spawn at
|
||||||
|
mobs_doomed.fox.spawn.max_height (Max. world height for fox spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of fox mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.fox.spawn.active_object_count (Number of foxes in the same place) int 2 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the hedgehog mob
|
||||||
|
mobs_doomed.hedgehog.spawn.enabled (Enable hedgehog spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the hedgehog mob can spawn on top of
|
||||||
|
mobs_doomed.hedgehog.spawn.on (Nodes the hedgehog will spawn on) string default:dirt_with_grass, default:dirt_with_coniferous_litter
|
||||||
|
|
||||||
|
# List of nodenames that the hedgehog mob can spawn beside
|
||||||
|
mobs_doomed.hedgehog.spawn.near (Nodes the hedgehog will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the hedgehog mob will try to spawn
|
||||||
|
mobs_doomed.hedgehog.spawn.interval (Time between hedgehog spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an hedgehog to spawn on a given node
|
||||||
|
mobs_doomed.hedgehog.spawn.chance (Rarity of hedgehog spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the hedgehog mob can spawn at
|
||||||
|
mobs_doomed.hedgehog.spawn.min_light (Min. light level for hedgehog spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the hedgehog mob can spawn at
|
||||||
|
mobs_doomed.hedgehog.spawn.max_light (Max. light level for hedgehog spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the hedgehog mob can spawn at
|
||||||
|
mobs_doomed.hedgehog.spawn.min_height (Min. world height for hedgehog spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the hedgehog mob can spawn at
|
||||||
|
mobs_doomed.hedgehog.spawn.max_height (Max. world height for hedgehog spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of hedgehog mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.hedgehog.spawn.active_object_count (Number of hedgehogs in the same place) int 2 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the owl mob
|
||||||
|
mobs_doomed.owl.spawn.enabled (Enable owl spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the owl mob can spawn on top of
|
||||||
|
mobs_doomed.owl.spawn.on (Nodes the owl will spawn on) string group:leaves
|
||||||
|
|
||||||
|
# List of nodenames that the owl mob can spawn beside
|
||||||
|
mobs_doomed.owl.spawn.near (Nodes the owl will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the owl mob will try to spawn
|
||||||
|
mobs_doomed.owl.spawn.interval (Time between owl spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an owl to spawn on a given node
|
||||||
|
mobs_doomed.owl.spawn.chance (Rarity of owl spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the owl mob can spawn at
|
||||||
|
mobs_doomed.owl.spawn.min_light (Min. light level for owl spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the owl mob can spawn at
|
||||||
|
mobs_doomed.owl.spawn.max_light (Max. light level for owl spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the owl mob can spawn at
|
||||||
|
mobs_doomed.owl.spawn.min_height (Min. world height for owl spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the owl mob can spawn at
|
||||||
|
mobs_doomed.owl.spawn.max_height (Max. world height for owl spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of owl mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.owl.spawn.active_object_count (Number of owls in the same place) int 2 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the tortoise mob
|
||||||
|
mobs_doomed.tortoise.spawn.enabled (Enable tortoise spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the tortoise mob can spawn on top of
|
||||||
|
mobs_doomed.tortoise.spawn.on (Nodes the tortoise will spawn on) string default:clay, group:sand
|
||||||
|
|
||||||
|
# List of nodenames that the tortoise mob can spawn beside
|
||||||
|
mobs_doomed.tortoise.spawn.near (Nodes the tortoise will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the tortoise mob will try to spawn
|
||||||
|
mobs_doomed.tortoise.spawn.interval (Time between tortoise spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an tortoise to spawn on a given node
|
||||||
|
mobs_doomed.tortoise.spawn.chance (Rarity of tortoise spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the tortoise mob can spawn at
|
||||||
|
mobs_doomed.tortoise.spawn.min_light (Min. light level for tortoise spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the tortoise mob can spawn at
|
||||||
|
mobs_doomed.tortoise.spawn.max_light (Max. light level for tortoise spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the tortoise mob can spawn at
|
||||||
|
mobs_doomed.tortoise.spawn.min_height (Min. world height for tortoise spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the tortoise mob can spawn at
|
||||||
|
mobs_doomed.tortoise.spawn.max_height (Max. world height for tortoise spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of tortoise mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.tortoise.spawn.active_object_count (Number of tortoises in the same place) int 2 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the whale mob
|
||||||
|
mobs_doomed.whale.spawn.enabled (Enable whale spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the whale mob can spawn on top of
|
||||||
|
mobs_doomed.whale.spawn.on (Nodes the whale will spawn on) string default:water_source
|
||||||
|
|
||||||
|
# List of nodenames that the whale mob can spawn beside
|
||||||
|
mobs_doomed.whale.spawn.near (Nodes the whale will spawn near) string default:water_source
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the whale mob will try to spawn
|
||||||
|
mobs_doomed.whale.spawn.interval (Time between whale spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an whale to spawn on a given node
|
||||||
|
mobs_doomed.whale.spawn.chance (Rarity of whale spawning) int 3000000 1
|
||||||
|
|
||||||
|
# The minimum light level the whale mob can spawn at
|
||||||
|
mobs_doomed.whale.spawn.min_light (Min. light level for whale spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the whale mob can spawn at
|
||||||
|
mobs_doomed.whale.spawn.max_light (Max. light level for whale spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the whale mob can spawn at
|
||||||
|
mobs_doomed.whale.spawn.min_height (Min. world height for whale spawning) int -40 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the whale mob can spawn at
|
||||||
|
mobs_doomed.whale.spawn.max_height (Max. world height for whale spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# Number of whale mobs to spawn at one time inside map area
|
||||||
|
mobs_doomed.whale.spawn.active_object_count (Number of whales in the same place) int 1 1
|
|
@ -0,0 +1,33 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Doomed Mob", function ()
|
||||||
|
describe("Doomed", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:badger", { "default:dirt_with_grass", "default:dirt", "default:dirt_with_coniferous_litter" }, { "air" }, 0, 14, 30, 300000, 2, 0, 5000)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:elephant", { "default:dirt_with_dry_grass", "default:desert_sand" }, { "air" }, 10, 14, 30, 300000, 2, 0, 5000, true)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:fox", { "default:dirt_with_grass", "default:dirt", "default:dirt_with_coniferous_litter", "default:dirt_with_snow" }, { "air" }, 0, 14, 30, 300000, 2, 0, 5000)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:hedgehog", { "default:dirt_with_grass", "default:dirt_with_coniferous_litter" }, { "air" }, 0, 14, 30, 300000, 2, 0, 5000)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:owl", { "group:leaves" }, { "air" }, 0, 14, 30, 300000, 2, 0, 5000, false)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:tortoise", { "default:clay", "group:sand" }, { "air" }, 10, 14, 30, 300000, 2, 0, 5000, true)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_doomed:whale", { "default:water_source" }, { "default:water_source" }, 0, 14, 30, 3000000, 1, -40, 0, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
||||||
|
|
|
@ -1,12 +1,39 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_fish', {
|
||||||
|
clownfish = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"}),
|
||||||
|
near = config.types.list({"default:sand","default:dirt","group:seaplants","group:seacoral"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(100000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(-50, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tropical = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"}),
|
||||||
|
near = config.types.list({"default:sand","default:dirt","group:seaplants","group:seacoral"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(100000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(-50, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- local variables
|
-- local variables
|
||||||
local l_spawn_in = {"default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"}
|
|
||||||
local l_spawn_near = {"default:sand","default:dirt","group:seaplants","group:seacoral"}
|
|
||||||
local l_spawn_chance = 100000
|
|
||||||
local l_cc_hand = 25
|
local l_cc_hand = 25
|
||||||
local l_cc_net = 80
|
local l_cc_net = 80
|
||||||
local l_water_level = minetest.settings:get("water_level") - 1
|
|
||||||
local l_anims = {
|
local l_anims = {
|
||||||
speed_normal = 24, speed_run = 24,
|
speed_normal = 24, speed_run = 24,
|
||||||
stand_start = 1, stand_end = 80,
|
stand_start = 1, stand_end = 80,
|
||||||
|
@ -56,8 +83,21 @@ mobs:register_mob("mobs_fish:clownfish", {
|
||||||
mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, "mobs_fish:clownfish")
|
mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, "mobs_fish:clownfish")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
if mod_config.clownfish.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_fish:clownfish", l_spawn_in, l_spawn_near, 5, 20, 30, l_spawn_chance, 1, -50, l_water_level)
|
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_fish:clownfish",
|
||||||
|
mod_config.clownfish.spawn.on,
|
||||||
|
mod_config.clownfish.spawn.near,
|
||||||
|
mod_config.clownfish.spawn.min_light,
|
||||||
|
mod_config.clownfish.spawn.max_light,
|
||||||
|
mod_config.clownfish.spawn.interval,
|
||||||
|
mod_config.clownfish.spawn.chance,
|
||||||
|
mod_config.clownfish.spawn.active_object_count,
|
||||||
|
mod_config.clownfish.spawn.min_height,
|
||||||
|
mod_config.clownfish.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_fish:clownfish", "Clownfish", "animal_clownfish_clownfish_item.png", 0)
|
mobs:register_egg("mobs_fish:clownfish", "Clownfish", "animal_clownfish_clownfish_item.png", 0)
|
||||||
|
|
||||||
-- Tropical fish
|
-- Tropical fish
|
||||||
|
@ -88,6 +128,22 @@ mobs:register_mob("mobs_fish:tropical", {
|
||||||
mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, "mobs_fish:tropical")
|
mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, "mobs_fish:tropical")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
if mod_config.tropical.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_fish:tropical", l_spawn_in, l_spawn_near, 5, 20, 30, l_spawn_chance, 1, -50, l_water_level)
|
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_fish:tropical",
|
||||||
|
mod_config.tropical.spawn.on,
|
||||||
|
mod_config.tropical.spawn.near,
|
||||||
|
mod_config.tropical.spawn.min_light,
|
||||||
|
mod_config.tropical.spawn.max_light,
|
||||||
|
mod_config.tropical.spawn.interval,
|
||||||
|
mod_config.tropical.spawn.chance,
|
||||||
|
mod_config.tropical.spawn.active_object_count,
|
||||||
|
mod_config.tropical.spawn.min_height,
|
||||||
|
mod_config.tropical.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_fish:tropical", "Tropical fish", "animal_fish_blue_white_fish_blue_white_item.png", 0)
|
mobs:register_egg("mobs_fish:tropical", "Tropical fish", "animal_fish_blue_white_fish_blue_white_item.png", 0)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the clownfish mob
|
||||||
|
mobs_fish.clownfish.spawn.enabled (Enable clownfish spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the clownfish mob can spawn on top of
|
||||||
|
mobs_fish.clownfish.spawn.on (Nodes the clownfish will spawn on) string default:water_source, default:water_flowing, default:river_water_source, default:river_water_flowing
|
||||||
|
|
||||||
|
# List of nodenames that the clownfish mob can spawn beside
|
||||||
|
mobs_fish.clownfish.spawn.near (Nodes the clownfish will spawn near) string default:sand, default:dirt, group:seaplants, group:seacoral
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the clownfish mob will try to spawn
|
||||||
|
mobs_fish.clownfish.spawn.interval (Time between clownfish spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an clownfish to spawn on a given node
|
||||||
|
mobs_fish.clownfish.spawn.chance (Rarity of clownfish spawning) int 100000 1
|
||||||
|
|
||||||
|
# The minimum light level the clownfish mob can spawn at
|
||||||
|
mobs_fish.clownfish.spawn.min_light (Min. light level for clownfish spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the clownfish mob can spawn at
|
||||||
|
mobs_fish.clownfish.spawn.max_light (Max. light level for clownfish spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the clownfish mob can spawn at
|
||||||
|
mobs_fish.clownfish.spawn.min_height (Min. world height for clownfish spawning) int -50 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the clownfish mob can spawn at
|
||||||
|
mobs_fish.clownfish.spawn.max_height (Max. world height for clownfish spawning) int -1 -31000 31000
|
||||||
|
|
||||||
|
# Number of clownfish mobs to spawn at one time inside map area
|
||||||
|
mobs_fish.clownfish.spawn.active_object_count (Number of clownfish in the same place) int 1 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the tropical mob
|
||||||
|
mobs_fish.tropical.spawn.enabled (Enable tropical fish spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the tropical mob can spawn on top of
|
||||||
|
mobs_fish.tropical.spawn.on (Nodes the tropical fish will spawn on) string default:water_source, default:water_flowing, default:river_water_source, default:river_water_flowing
|
||||||
|
|
||||||
|
# List of nodenames that the tropical mob can spawn beside
|
||||||
|
mobs_fish.tropical.spawn.near (Nodes the tropical fish will spawn near) string default:sand, default:dirt, group:seaplants, group:seacoral
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the tropical mob will try to spawn
|
||||||
|
mobs_fish.tropical.spawn.interval (Time between tropical fish spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an tropical fish to spawn on a given node
|
||||||
|
mobs_fish.tropical.spawn.chance (Rarity of tropical fish spawning) int 100000 1
|
||||||
|
|
||||||
|
# The minimum light level the tropical mob can spawn at
|
||||||
|
mobs_fish.tropical.spawn.min_light (Min. light level for tropical fish spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the tropical mob can spawn at
|
||||||
|
mobs_fish.tropical.spawn.max_light (Max. light level for tropical fish spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the tropical mob can spawn at
|
||||||
|
mobs_fish.tropical.spawn.min_height (Min. world height for tropical fish spawning) int -50 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the tropical mob can spawn at
|
||||||
|
mobs_fish.tropical.spawn.max_height (Max. world height for tropical fish spawning) int -1 -31000 31000
|
||||||
|
|
||||||
|
# Number of tropical mobs to spawn at one time inside map area
|
||||||
|
mobs_fish.tropical.spawn.active_object_count (Number of tropical fish in the same place) int 1 1
|
|
@ -0,0 +1,28 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Fish Mob", function ()
|
||||||
|
describe("Fish", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_fish:clownfish", { "default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing" }, { "default:sand", "default:dirt", "group:seaplants", "group:seacoral" }, 5, 20, 30, 100000, 1, -50, 0)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_fish:tropical", { "default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing" }, { "default:sand", "default:dirt", "group:seaplants", "group:seacoral" }, 5, 20, 30, 100000, 1, -50, 0)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1 +1,3 @@
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_giraffe', {
|
||||||
|
jeraf = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:sand", "default:desert_sand", "default:dirt_with_dry_grass"}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(15, { min=0 }),
|
||||||
|
min_height = config.types.int(2, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_giraffe:jeraf", {
|
mobs:register_mob("mobs_giraffe:jeraf", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -63,19 +80,23 @@ mobs:register_mob("mobs_giraffe:jeraf", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local l_spawn_elevation_min = minetest.setting_get("water_level")
|
if mod_config.jeraf.spawn.enabled then
|
||||||
if l_spawn_elevation_min then
|
mobs:spawn_specific(
|
||||||
l_spawn_elevation_min = l_spawn_elevation_min + 1
|
"mobs_giraffe:jeraf",
|
||||||
else
|
mod_config.jeraf.spawn.on,
|
||||||
l_spawn_elevation_min = 1
|
mod_config.jeraf.spawn.near,
|
||||||
|
mod_config.jeraf.spawn.min_light,
|
||||||
|
mod_config.jeraf.spawn.max_light,
|
||||||
|
mod_config.jeraf.spawn.interval,
|
||||||
|
mod_config.jeraf.spawn.chance,
|
||||||
|
mod_config.jeraf.spawn.active_object_count,
|
||||||
|
mod_config.jeraf.spawn.min_height,
|
||||||
|
mod_config.jeraf.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
mobs:spawn({
|
|
||||||
name = "mobs_giraffe:jeraf",
|
|
||||||
nodes = {"default:sand", "default:desert_sand", "default:dirt_with_dry_grass"},
|
|
||||||
min_light = 10,
|
|
||||||
chance = 300000,
|
|
||||||
min_height = l_spawn_elevation_min,
|
|
||||||
max_height = 5000,
|
|
||||||
day_toggle = true,
|
|
||||||
})
|
|
||||||
mobs:register_egg("mobs_giraffe:jeraf", "Giraffe", "wool_yellow.png", 1)
|
mobs:register_egg("mobs_giraffe:jeraf", "Giraffe", "wool_yellow.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the jeraf mob
|
||||||
|
mobs_giraffe.jeraf.spawn.enabled (Enable giraffe spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the jeraf mob can spawn on top of
|
||||||
|
mobs_giraffe.jeraf.spawn.on (Nodes the giraffe will spawn on) string default:sand, default:desert_sand, default:dirt_with_dry_grass
|
||||||
|
|
||||||
|
# List of nodenames that the jeraf mob can spawn beside
|
||||||
|
mobs_giraffe.jeraf.spawn.near (Nodes the giraffe will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the jeraf mob will try to spawn
|
||||||
|
mobs_giraffe.jeraf.spawn.interval (Time between giraffe spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an giraffe to spawn on a given node
|
||||||
|
mobs_giraffe.jeraf.spawn.chance (Rarity of giraffe spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the jeraf mob can spawn at
|
||||||
|
mobs_giraffe.jeraf.spawn.min_light (Min. light level for giraffe spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the jeraf mob can spawn at
|
||||||
|
mobs_giraffe.jeraf.spawn.max_light (Max. light level for giraffe spawning) int 15 0
|
||||||
|
|
||||||
|
# The minimum height the jeraf mob can spawn at
|
||||||
|
mobs_giraffe.jeraf.spawn.min_height (Min. world height for giraffe spawning) int 1 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the jeraf mob can spawn at
|
||||||
|
mobs_giraffe.jeraf.spawn.max_height (Max. world height for giraffe spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of jeraf mobs to spawn at one time inside map area
|
||||||
|
mobs_giraffe.jeraf.spawn.active_object_count (Number of giraffes in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Giraffe Mob", function ()
|
||||||
|
describe("Jeraf", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_giraffe:jeraf", { "default:sand", "default:desert_sand", "default:dirt_with_dry_grass" }, { "air" }, 10, 15, 30, 300000, 1, 2, 5000, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,3 +1,4 @@
|
||||||
default
|
default
|
||||||
|
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_jellyfish', {
|
||||||
|
jellyfish = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:water_source"}),
|
||||||
|
near = config.types.list({"default:water_flowing","default:water_source"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(1, { min=0 }),
|
||||||
|
max_light = config.types.int(14, { min=0 }),
|
||||||
|
min_height = config.types.int(-50, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(-1, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_jellyfish:jellyfish", {
|
mobs:register_mob("mobs_jellyfish:jellyfish", {
|
||||||
lifetimer = 0, -- doesn't despawn
|
lifetimer = 0, -- doesn't despawn
|
||||||
type = "animal",
|
type = "animal",
|
||||||
|
@ -32,9 +49,24 @@ mobs:register_mob("mobs_jellyfish:jellyfish", {
|
||||||
mobs:capture_mob(self, clicker, 80, 100, 0, true, "mobs_jellyfish:jellyfish")
|
mobs:capture_mob(self, clicker, 80, 100, 0, true, "mobs_jellyfish:jellyfish")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
|
||||||
mobs:spawn_specific("mobs_jellyfish:jellyfish",
|
if mod_config.jellyfish.spawn.enabled then
|
||||||
{"default:water_source"},
|
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
||||||
{"default:water_flowing","default:water_source"},
|
mobs:spawn_specific(
|
||||||
1, 14, 30, 300000, 1, -50, -1)
|
"mobs_jellyfish:jellyfish",
|
||||||
|
mod_config.jellyfish.spawn.on,
|
||||||
|
mod_config.jellyfish.spawn.near,
|
||||||
|
mod_config.jellyfish.spawn.min_light,
|
||||||
|
mod_config.jellyfish.spawn.max_light,
|
||||||
|
mod_config.jellyfish.spawn.interval,
|
||||||
|
mod_config.jellyfish.spawn.chance,
|
||||||
|
mod_config.jellyfish.spawn.active_object_count,
|
||||||
|
mod_config.jellyfish.spawn.min_height,
|
||||||
|
mod_config.jellyfish.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_jellyfish:jellyfish", "Jellyfish", "jellyfish_inv.png", 0)
|
mobs:register_egg("mobs_jellyfish:jellyfish", "Jellyfish", "jellyfish_inv.png", 0)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the jellyfish mob
|
||||||
|
mobs_jellyfish.jellyfish.spawn.enabled (Enable jellyfish spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the jellyfish mob can spawn on top of
|
||||||
|
mobs_jellyfish.jellyfish.spawn.on (Nodes the jellyfish will spawn on) string default:water_source
|
||||||
|
|
||||||
|
# List of nodenames that the jellyfish mob can spawn beside
|
||||||
|
mobs_jellyfish.jellyfish.spawn.near (Nodes the jellyfish will spawn near) string default:water_flowing, default:water_source
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the jellyfish mob will try to spawn
|
||||||
|
mobs_jellyfish.jellyfish.spawn.interval (Time between jellyfish spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an jellyfish to spawn on a given node
|
||||||
|
mobs_jellyfish.jellyfish.spawn.chance (Rarity of jellyfish spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the jellyfish mob can spawn at
|
||||||
|
mobs_jellyfish.jellyfish.spawn.min_light (Min. light level for jellyfish spawning) int 1 0
|
||||||
|
|
||||||
|
# The maximum light level the jellyfish mob can spawn at
|
||||||
|
mobs_jellyfish.jellyfish.spawn.max_light (Max. light level for jellyfish spawning) int 14 0
|
||||||
|
|
||||||
|
# The minimum height the jellyfish mob can spawn at
|
||||||
|
mobs_jellyfish.jellyfish.spawn.min_height (Min. world height for jellyfish spawning) int -50 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the jellyfish mob can spawn at
|
||||||
|
mobs_jellyfish.jellyfish.spawn.max_height (Max. world height for jellyfish spawning) int -1 -31000 31000
|
||||||
|
|
||||||
|
# Number of jellyfish mobs to spawn at one time inside map area
|
||||||
|
mobs_jellyfish.jellyfish.spawn.active_object_count (Number of jellyfish in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Jellyfish Mob", function ()
|
||||||
|
describe("Jellyfish", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_jellyfish:jellyfish", { "default:water_source" }, { "default:water_flowing", "default:water_source" }, 1, 14, 30, 300000, 1, -50, -1)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,3 +1,5 @@
|
||||||
mobs
|
mobs
|
||||||
mobs_animal
|
mobs_animal
|
||||||
|
config
|
||||||
farming?
|
farming?
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_mr_goat', {
|
||||||
|
goat = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:dirt_with_grass", "ethereal:green_dirt_top"}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(15, { min=0 }),
|
||||||
|
min_height = config.types.int(2, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_mr_goat:goat", {
|
mobs:register_mob("mobs_mr_goat:goat", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -81,21 +98,22 @@ mobs:register_mob("mobs_mr_goat:goat", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local l_spawn_elevation_min = minetest.setting_get("water_level")
|
if mod_config.goat.spawn.enabled then
|
||||||
if l_spawn_elevation_min then
|
mobs:spawn_specific(
|
||||||
l_spawn_elevation_min = l_spawn_elevation_min + 1
|
"mobs_mr_goat:goat",
|
||||||
else
|
mod_config.goat.spawn.on,
|
||||||
l_spawn_elevation_min = 1
|
mod_config.goat.spawn.near,
|
||||||
|
mod_config.goat.spawn.min_light,
|
||||||
|
mod_config.goat.spawn.max_light,
|
||||||
|
mod_config.goat.spawn.interval,
|
||||||
|
mod_config.goat.spawn.chance,
|
||||||
|
mod_config.goat.spawn.active_object_count,
|
||||||
|
mod_config.goat.spawn.min_height,
|
||||||
|
mod_config.goat.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
mobs:spawn({
|
|
||||||
name = "mobs_mr_goat:goat",
|
|
||||||
nodes = {"default:dirt_with_grass", "ethereal:green_dirt_top"},
|
|
||||||
min_light = 10,
|
|
||||||
chance = 300000,
|
|
||||||
min_height = l_spawn_elevation_min,
|
|
||||||
max_height = 5000,
|
|
||||||
day_toggle = true,
|
|
||||||
})
|
|
||||||
mobs:register_egg("mobs_mr_goat:goat", "Goat", "default_grass.png", 1)
|
mobs:register_egg("mobs_mr_goat:goat", "Goat", "default_grass.png", 1)
|
||||||
|
|
||||||
-- bucket of goat milk
|
-- bucket of goat milk
|
||||||
|
@ -142,3 +160,6 @@ minetest.register_craft({
|
||||||
{'mobs_mr_goat:goatcheeseblock'}
|
{'mobs_mr_goat:goatcheeseblock'}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the goat mob
|
||||||
|
mobs_mr_goat.goat.spawn.enabled (Enable goat spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the goat mob can spawn on top of
|
||||||
|
mobs_mr_goat.goat.spawn.on (Nodes the goat will spawn on) string default:dirt_with_grass, ethereal:green_dirt_top
|
||||||
|
|
||||||
|
# List of nodenames that the goat mob can spawn beside
|
||||||
|
mobs_mr_goat.goat.spawn.near (Nodes the goat will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the goat mob will try to spawn
|
||||||
|
mobs_mr_goat.goat.spawn.interval (Time between goat spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an goat to spawn on a given node
|
||||||
|
mobs_mr_goat.goat.spawn.chance (Rarity of goat spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the goat mob can spawn at
|
||||||
|
mobs_mr_goat.goat.spawn.min_light (Min. light level for goat spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the goat mob can spawn at
|
||||||
|
mobs_mr_goat.goat.spawn.max_light (Max. light level for goat spawning) int 15 0
|
||||||
|
|
||||||
|
# The minimum height the goat mob can spawn at
|
||||||
|
mobs_mr_goat.goat.spawn.min_height (Min. world height for goat spawning) int 1 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the goat mob can spawn at
|
||||||
|
mobs_mr_goat.goat.spawn.max_height (Max. world height for goat spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of goat mobs to spawn at one time inside map area
|
||||||
|
mobs_mr_goat.goat.spawn.active_object_count (Number of goats in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Mr Goat Mob", function ()
|
||||||
|
describe("Mr Goat", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_mr_goat:goat", { "default:dirt_with_grass", "ethereal:green_dirt_top" }, { "air" }, 10, 15, 30, 300000, 1, 2, 5000, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,36 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_turtles', {
|
||||||
|
turtle = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:dirt_with_grass","default:jungle_grass","default:sand","default:desert_sand"}),
|
||||||
|
near = config.types.list({"default:dirt_with_grass","default:jungle_grass","default:sand","default:desert_sand","default:papyrus","default:cactus","dryplants:juncus","dryplants:reedmace"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(1, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
seaturtle = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:water_flowing","default:water_source"}),
|
||||||
|
near = config.types.list({"default:water_flowing","default:water_source","group:seaplants","seawrecks:woodship","seawrecks:uboot"}),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(5, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(-50, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(0, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
local l_colors = {
|
local l_colors = {
|
||||||
"#604000:175", --brown
|
"#604000:175", --brown
|
||||||
"#604000:100", --brown2
|
"#604000:100", --brown2
|
||||||
|
@ -21,7 +52,6 @@ local l_anims = {
|
||||||
hide_start = 95, hide_end = 100
|
hide_start = 95, hide_end = 100
|
||||||
}
|
}
|
||||||
local l_model = "mobf_turtle.x"
|
local l_model = "mobf_turtle.x"
|
||||||
local l_spawn_chance = 300000
|
|
||||||
|
|
||||||
-- land turtle
|
-- land turtle
|
||||||
mobs:register_mob("mobs_turtles:turtle", {
|
mobs:register_mob("mobs_turtles:turtle", {
|
||||||
|
@ -95,11 +125,21 @@ mobs:register_mob("mobs_turtles:turtle", {
|
||||||
minetest.after(5, function() self.state = "stand" end)
|
minetest.after(5, function() self.state = "stand" end)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
if mod_config.turtle.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_turtles:turtle",
|
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
||||||
{"default:dirt_with_grass","default:jungle_grass","default:sand","default:desert_sand"},
|
mobs:spawn_specific(
|
||||||
{"default:dirt_with_grass","default:jungle_grass","default:sand","default:desert_sand","default:papyrus","default:cactus","dryplants:juncus","dryplants:reedmace"},
|
"mobs_turtles:turtle",
|
||||||
5, 20, 30, l_spawn_chance, 1, 1, 5000)
|
mod_config.turtle.spawn.on,
|
||||||
|
mod_config.turtle.spawn.near,
|
||||||
|
mod_config.turtle.spawn.min_light,
|
||||||
|
mod_config.turtle.spawn.max_light,
|
||||||
|
mod_config.turtle.spawn.interval,
|
||||||
|
mod_config.turtle.spawn.chance,
|
||||||
|
mod_config.turtle.spawn.active_object_count,
|
||||||
|
mod_config.turtle.spawn.min_height,
|
||||||
|
mod_config.turtle.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_turtles:turtle", "Turtle", "default_grass.png", 1)
|
mobs:register_egg("mobs_turtles:turtle", "Turtle", "default_grass.png", 1)
|
||||||
|
|
||||||
-- sea turtle
|
-- sea turtle
|
||||||
|
@ -140,9 +180,21 @@ mobs:register_mob("mobs_turtles:seaturtle", {
|
||||||
if mobs:capture_mob(self, clicker, 60, 80, 100, false, nil) then return end
|
if mobs:capture_mob(self, clicker, 60, 80, 100, false, nil) then return end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
if mod_config.seaturtle.spawn.enabled then
|
||||||
mobs:spawn_specific("mobs_turtles:seaturtle",
|
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
||||||
{"default:water_flowing","default:water_source"},
|
mobs:spawn_specific(
|
||||||
{"default:water_flowing","default:water_source","group:seaplants","seawrecks:woodship","seawrecks:uboot"},
|
"mobs_turtles:seaturtle",
|
||||||
5, 20, 30, l_spawn_chance, 1, -50, 0)
|
mod_config.seaturtle.spawn.on,
|
||||||
|
mod_config.seaturtle.spawn.near,
|
||||||
|
mod_config.seaturtle.spawn.min_light,
|
||||||
|
mod_config.seaturtle.spawn.max_light,
|
||||||
|
mod_config.seaturtle.spawn.interval,
|
||||||
|
mod_config.seaturtle.spawn.chance,
|
||||||
|
mod_config.seaturtle.spawn.active_object_count,
|
||||||
|
mod_config.seaturtle.spawn.min_height,
|
||||||
|
mod_config.seaturtle.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
mobs:register_egg("mobs_turtles:seaturtle", "Sea Turtle", "default_water.png", 1)
|
mobs:register_egg("mobs_turtles:seaturtle", "Sea Turtle", "default_water.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the turtle mob
|
||||||
|
mobs_turtles.turtle.spawn.enabled (Enable turtle spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the turtle mob can spawn on top of
|
||||||
|
mobs_turtles.turtle.spawn.on (Nodes the turtle will spawn on) string default:dirt_with_grass, default:jungle_grass, default:sand, default:desert_sand
|
||||||
|
|
||||||
|
# List of nodenames that the turtle mob can spawn beside
|
||||||
|
mobs_turtles.turtle.spawn.near (Nodes the turtle will spawn near) string default:dirt_with_grass, default:jungle_grass, default:sand, default:desert_sand, default:papyrus, default:cactus, dryplants:juncus, dryplants:reedmace
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the turtle mob will try to spawn
|
||||||
|
mobs_turtles.turtle.spawn.interval (Time between turtle spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an turtle to spawn on a given node
|
||||||
|
mobs_turtles.turtle.spawn.chance (Rarity of turtle spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the turtle mob can spawn at
|
||||||
|
mobs_turtles.turtle.spawn.min_light (Min. light level for turtle spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the turtle mob can spawn at
|
||||||
|
mobs_turtles.turtle.spawn.max_light (Max. light level for turtle spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the turtle mob can spawn at
|
||||||
|
mobs_turtles.turtle.spawn.min_height (Min. world height for turtle spawning) int 1 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the turtle mob can spawn at
|
||||||
|
mobs_turtles.turtle.spawn.max_height (Max. world height for turtle spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of turtle mobs to spawn at one time inside map area
|
||||||
|
mobs_turtles.turtle.spawn.active_object_count (Number of turtles in the same place) int 1 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the seaturtle mob
|
||||||
|
mobs_turtles.seaturtle.spawn.enabled (Enable seaturtle spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the seaturtle mob can spawn on top of
|
||||||
|
mobs_turtles.seaturtle.spawn.on (Nodes the seaturtle will spawn on) string default:water_flowing, default:water_source
|
||||||
|
|
||||||
|
# List of nodenames that the seaturtle mob can spawn beside
|
||||||
|
mobs_turtles.seaturtle.spawn.near (Nodes the seaturtle will spawn near) string default:water_flowing, default:water_source, group:seaplants, seawrecks:woodship, seawrecks:uboot
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the seaturtle mob will try to spawn
|
||||||
|
mobs_turtles.seaturtle.spawn.interval (Time between seaturtle spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an seaturtle to spawn on a given node
|
||||||
|
mobs_turtles.seaturtle.spawn.chance (Rarity of seaturtle spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the seaturtle mob can spawn at
|
||||||
|
mobs_turtles.seaturtle.spawn.min_light (Min. light level for seaturtle spawning) int 5 0
|
||||||
|
|
||||||
|
# The maximum light level the seaturtle mob can spawn at
|
||||||
|
mobs_turtles.seaturtle.spawn.max_light (Max. light level for seaturtle spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the seaturtle mob can spawn at
|
||||||
|
mobs_turtles.seaturtle.spawn.min_height (Min. world height for seaturtle spawning) int -50 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the seaturtle mob can spawn at
|
||||||
|
mobs_turtles.seaturtle.spawn.max_height (Max. world height for seaturtle spawning) int 0 -31000 31000
|
||||||
|
|
||||||
|
# Number of seaturtle mobs to spawn at one time inside map area
|
||||||
|
mobs_turtles.seaturtle.spawn.active_object_count (Number of seaturtles in the same place) int 1 1
|
|
@ -0,0 +1,28 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Turtles Mob", function ()
|
||||||
|
describe("Turtles", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_turtles:turtle", { "default:dirt_with_grass", "default:jungle_grass", "default:sand", "default:desert_sand" }, { "default:dirt_with_grass", "default:jungle_grass", "default:sand", "default:desert_sand", "default:papyrus", "default:cactus", "dryplants:juncus", "dryplants:reedmace" }, 5, 20, 30, 300000, 1, 1, 5000)
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_turtles:seaturtle", { "default:water_flowing", "default:water_source" }, { "default:water_flowing", "default:water_source", "group:seaplants", "seawrecks:woodship", "seawrecks:uboot" }, 5, 20, 30, 300000, 1, -50, 0)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,3 +1,5 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
mobs_fish?
|
mobs_fish?
|
||||||
|
test?
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_walrus', {
|
||||||
|
walrus = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({"default:dirt_with_snow", "default:snowblock", "default:ice"}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(0, { min=0 }),
|
||||||
|
max_light = config.types.int(20, { min=0 }),
|
||||||
|
min_height = config.types.int(-31000, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_walrus:walrus", {
|
mobs:register_mob("mobs_walrus:walrus", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
passive = false,
|
passive = false,
|
||||||
|
@ -68,7 +85,24 @@ mobs:register_mob("mobs_walrus:walrus", {
|
||||||
fly_in = "default:water_source",
|
fly_in = "default:water_source",
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_spawn("mobs_walrus:walrus", {"default:dirt_with_snow", "default:snowblock", "default:ice"}, 20, 0, 300000, 1, 5000)
|
if mod_config.walrus.spawn.enabled then
|
||||||
|
mobs:spawn_specific(
|
||||||
|
"mobs_walrus:walrus",
|
||||||
|
mod_config.walrus.spawn.on,
|
||||||
|
mod_config.walrus.spawn.near,
|
||||||
|
mod_config.walrus.spawn.min_light,
|
||||||
|
mod_config.walrus.spawn.max_light,
|
||||||
|
mod_config.walrus.spawn.interval,
|
||||||
|
mod_config.walrus.spawn.chance,
|
||||||
|
mod_config.walrus.spawn.active_object_count,
|
||||||
|
mod_config.walrus.spawn.min_height,
|
||||||
|
mod_config.walrus.spawn.max_height
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
mobs:register_egg("mobs_walrus:walrus", "Walrus", "default_grass.png", 1)
|
mobs:register_egg("mobs_walrus:walrus", "Walrus", "default_grass.png", 1)
|
||||||
|
|
||||||
minetest.register_alias_force("arctic_life:walrus", "mobs_walrus:walrus")
|
minetest.register_alias_force("arctic_life:walrus", "mobs_walrus:walrus")
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the walrus mob
|
||||||
|
mobs_walrus.walrus.spawn.enabled (Enable walrus spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the walrus mob can spawn on top of
|
||||||
|
mobs_walrus.walrus.spawn.on (Nodes the walrus will spawn on) string default:dirt_with_snow, default:snowblock, default:ice
|
||||||
|
|
||||||
|
# List of nodenames that the walrus mob can spawn beside
|
||||||
|
mobs_walrus.walrus.spawn.near (Nodes the walrus will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the walrus mob will try to spawn
|
||||||
|
mobs_walrus.walrus.spawn.interval (Time between walrus spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an walrus to spawn on a given node
|
||||||
|
mobs_walrus.walrus.spawn.chance (Rarity of walrus spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the walrus mob can spawn at
|
||||||
|
mobs_walrus.walrus.spawn.min_light (Min. light level for walrus spawning) int 0 0
|
||||||
|
|
||||||
|
# The maximum light level the walrus mob can spawn at
|
||||||
|
mobs_walrus.walrus.spawn.max_light (Max. light level for walrus spawning) int 20 0
|
||||||
|
|
||||||
|
# The minimum height the walrus mob can spawn at
|
||||||
|
mobs_walrus.walrus.spawn.min_height (Min. world height for walrus spawning) int -31000 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the walrus mob can spawn at
|
||||||
|
mobs_walrus.walrus.spawn.max_height (Max. world height for walrus spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of walrus mobs to spawn at one time inside map area
|
||||||
|
mobs_walrus.walrus.spawn.active_object_count (Number of walruses in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Walrus Mob", function ()
|
||||||
|
describe("Walrus", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_walrus:walrus", { "default:dirt_with_snow", "default:snowblock", "default:ice" }, { "air" }, 0, 20, 30, 300000, 1, -31000, 5000)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
|
@ -1,2 +1,4 @@
|
||||||
default
|
default
|
||||||
mobs
|
mobs
|
||||||
|
config
|
||||||
|
test?
|
|
@ -1,5 +1,27 @@
|
||||||
if not mobs.mod == "redo" then return end
|
if not mobs.mod == "redo" then return end
|
||||||
|
|
||||||
|
local mod_config = config.settings_model('mobs_wolf', {
|
||||||
|
wolf = {
|
||||||
|
spawn = {
|
||||||
|
enabled = config.types.boolean(true),
|
||||||
|
on = config.types.list({
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt_with_snow",
|
||||||
|
"default:dirt_with_coniferous_litter",
|
||||||
|
"ethereal:green_dirt_top",
|
||||||
|
}),
|
||||||
|
near = config.types.list({ "air" }),
|
||||||
|
interval = config.types.int(30, { min=1 }),
|
||||||
|
chance = config.types.int(300000, { min=1 }),
|
||||||
|
min_light = config.types.int(10, { min=0 }),
|
||||||
|
max_light = config.types.int(15, { min=0 }),
|
||||||
|
min_height = config.types.int(-4, { min=-31000, max=31000 }),
|
||||||
|
max_height = config.types.int(5000, { min=-31000, max=31000 }),
|
||||||
|
active_object_count = config.types.int(1, { min=1 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_wolf:wolf", {
|
mobs:register_mob("mobs_wolf:wolf", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -57,26 +79,22 @@ mobs:register_mob("mobs_wolf:wolf", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local l_spawn_elevation_min = minetest.setting_get("water_level")
|
if mod_config.wolf.spawn.enabled then
|
||||||
if l_spawn_elevation_min then
|
mobs:spawn_specific(
|
||||||
l_spawn_elevation_min = l_spawn_elevation_min - 5
|
"mobs_wolf:wolf",
|
||||||
else
|
mod_config.wolf.spawn.on,
|
||||||
l_spawn_elevation_min = -5
|
mod_config.wolf.spawn.near,
|
||||||
|
mod_config.wolf.spawn.min_light,
|
||||||
|
mod_config.wolf.spawn.max_light,
|
||||||
|
mod_config.wolf.spawn.interval,
|
||||||
|
mod_config.wolf.spawn.chance,
|
||||||
|
mod_config.wolf.spawn.active_object_count,
|
||||||
|
mod_config.wolf.spawn.min_height,
|
||||||
|
mod_config.wolf.spawn.max_height,
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
mobs:spawn({
|
|
||||||
name = "mobs_wolf:wolf",
|
|
||||||
nodes = {
|
|
||||||
"default:dirt_with_grass",
|
|
||||||
"default:dirt_with_snow",
|
|
||||||
"default:dirt_with_coniferous_litter",
|
|
||||||
"ethereal:green_dirt_top",
|
|
||||||
},
|
|
||||||
min_light = 10,
|
|
||||||
chance = 300000,
|
|
||||||
min_height = l_spawn_elevation_min,
|
|
||||||
max_height = 5000,
|
|
||||||
day_toggle = true,
|
|
||||||
})
|
|
||||||
mobs:register_egg("mobs_wolf:wolf", "Wolf", "wool_grey.png", 1)
|
mobs:register_egg("mobs_wolf:wolf", "Wolf", "wool_grey.png", 1)
|
||||||
|
|
||||||
-- Dog
|
-- Dog
|
||||||
|
@ -154,3 +172,6 @@ mobs:register_mob("mobs_wolf:dog", {
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_egg("mobs_wolf:dog", "Dog", "wool_brown.png", 1)
|
mobs:register_egg("mobs_wolf:dog", "Dog", "wool_brown.png", 1)
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname())..'/test.lua')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# Enable or disable the natural spawning of the wolf mob
|
||||||
|
mobs_wolf.wolf.spawn.enabled (Enable wolf spawning) bool true
|
||||||
|
|
||||||
|
# List of nodenames that the wolf mob can spawn on top of
|
||||||
|
mobs_wolf.wolf.spawn.on (Nodes the wolf will spawn on) string default:dirt_with_grass, default:dirt_with_snow, default:dirt_with_coniferous_litter, ethereal:green_dirt_top
|
||||||
|
|
||||||
|
# List of nodenames that the wolf mob can spawn beside
|
||||||
|
mobs_wolf.wolf.spawn.near (Nodes the wolf will spawn near) string air
|
||||||
|
|
||||||
|
# Interval in seconds that specifies when the wolf mob will try to spawn
|
||||||
|
mobs_wolf.wolf.spawn.interval (Time between wolf spawning) int 30 1
|
||||||
|
|
||||||
|
# Inverted chance for an wolf to spawn on a given node
|
||||||
|
mobs_wolf.wolf.spawn.chance (Rarity of wolf spawning) int 300000 1
|
||||||
|
|
||||||
|
# The minimum light level the wolf mob can spawn at
|
||||||
|
mobs_wolf.wolf.spawn.min_light (Min. light level for wolf spawning) int 10 0
|
||||||
|
|
||||||
|
# The maximum light level the wolf mob can spawn at
|
||||||
|
mobs_wolf.wolf.spawn.max_light (Max. light level for wolf spawning) int 15 0
|
||||||
|
|
||||||
|
# The minimum height the wolf mob can spawn at
|
||||||
|
mobs_wolf.wolf.spawn.min_height (Min. world height for wolf spawning) int -5 -31000 31000
|
||||||
|
|
||||||
|
# The maximum height the wolf mob can spawn at
|
||||||
|
mobs_wolf.wolf.spawn.max_height (Max. world height for wolf spawning) int 5000 -31000 31000
|
||||||
|
|
||||||
|
# Number of wolf mobs to spawn at one time inside map area
|
||||||
|
mobs_wolf.wolf.spawn.active_object_count (Number of wolves in the same place) int 1 1
|
|
@ -0,0 +1,27 @@
|
||||||
|
if not minetest.global_exists('test') then return end
|
||||||
|
if test.active then return end
|
||||||
|
|
||||||
|
local describe = test.describe
|
||||||
|
local it = test.it
|
||||||
|
local stub = test.stub
|
||||||
|
local assert_equal = test.assert.equal
|
||||||
|
|
||||||
|
describe("Wolf Mob", function ()
|
||||||
|
describe("Wolf", function ()
|
||||||
|
local original_spawn_specific = mobs.spawn_specific
|
||||||
|
local stub_spawn_specific = stub()
|
||||||
|
test.before_all(function ()
|
||||||
|
mobs.spawn_specific = stub_spawn_specific.call
|
||||||
|
end)
|
||||||
|
test.after_all(function ()
|
||||||
|
mobs.spawn_specific = original_spawn_specific
|
||||||
|
end)
|
||||||
|
it("calls the main mob spawn registration function with the same values as before config was added", function ()
|
||||||
|
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/init.lua")
|
||||||
|
-- The original call before config was added, testing for consistency with config defaults
|
||||||
|
stub_spawn_specific.called_with(mobs, "mobs_wolf:wolf", { "default:dirt_with_grass", "default:dirt_with_snow", "default:dirt_with_coniferous_litter", "ethereal:green_dirt_top" }, { "air" }, 10, 15, 30, 300000, 1, -4, 5000, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
test.execute(true)
|
Loading…
Reference in New Issue