forked from MineClone5/MineClone5
[mineclone5] Make work new mob spawn by Oil_boi with extra_mobs
This commit is contained in:
parent
3accc82d2d
commit
5d48975a07
|
@ -102,7 +102,7 @@ mobs:register_mob("extra_mobs:cod", cod)
|
||||||
|
|
||||||
--spawning TODO: in schools
|
--spawning TODO: in schools
|
||||||
local water = mobs_mc.spawn_height.water
|
local water = mobs_mc.spawn_height.water
|
||||||
mobs:spawn_specific("extra_mobs:cod", mobs_mc.spawn.water, {mobs_mc.items.water_source}, 0, minetest.LIGHT_MAX+1, 30, 4000, 3, water-16, water)
|
mobs:spawn_specific("extra_mobs:cod", "overworld", "water", 0, minetest.LIGHT_MAX+1, 30, 4000, 3, water-16, water)
|
||||||
|
|
||||||
--spawn egg
|
--spawn egg
|
||||||
mobs:register_egg("extra_mobs:cod", S("Cod"), "extra_mobs_spawn_icon_cod.png", 0)
|
mobs:register_egg("extra_mobs:cod", S("Cod"), "extra_mobs_spawn_icon_cod.png", 0)
|
||||||
|
|
|
@ -91,7 +91,7 @@ mobs:register_mob("extra_mobs:dolphin", dolphin)
|
||||||
|
|
||||||
--spawning TODO: in schools
|
--spawning TODO: in schools
|
||||||
local water = mobs_mc.spawn_height.water
|
local water = mobs_mc.spawn_height.water
|
||||||
mobs:spawn_specific("extra_mobs:dolphin", mobs_mc.spawn.water, {mobs_mc.items.water_source}, 0, minetest.LIGHT_MAX+1, 30, 4000, 3, water-16, water)
|
mobs:spawn_specific("extra_mobs:dolphin", "overworld", "water", 0, minetest.LIGHT_MAX+1, 30, 4000, 3, water-16, water)
|
||||||
|
|
||||||
--spawn egg
|
--spawn egg
|
||||||
mobs:register_egg("extra_mobs:dolphin", S("dolphin"), "extra_mobs_spawn_icon_dolphin.png", 0)
|
mobs:register_egg("extra_mobs:dolphin", S("dolphin"), "extra_mobs_spawn_icon_dolphin.png", 0)
|
||||||
|
|
|
@ -123,10 +123,10 @@ local fox = {
|
||||||
mobs:register_mob("extra_mobs:fox", fox)
|
mobs:register_mob("extra_mobs:fox", fox)
|
||||||
|
|
||||||
-- spawning
|
-- spawning
|
||||||
mobs:spawn_specific("extra_mobs:fox", {"mcl_core:dirt_with_grass"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
mobs:spawn_specific("extra_mobs:fox", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
||||||
|
|
||||||
mobs:spawn_specific("extra_mobs:fox", {"mcl_core:dirt_with_grass_snow"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
mobs:spawn_specific("extra_mobs:fox", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
||||||
mobs:spawn_specific("extra_mobs:artic_fox", {"mcl_core:snow"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
mobs:spawn_specific("extra_mobs:artic_fox", "overworld", "mcl_core:snow", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("extra_mobs:fox", S("Fox"), "extra_mobs_spawn_icon_fox.png", 0)
|
mobs:register_egg("extra_mobs:fox", S("Fox"), "extra_mobs_spawn_icon_fox.png", 0)
|
||||||
|
|
|
@ -75,7 +75,7 @@ mobs:register_mob("extra_mobs:glow_squid",{
|
||||||
-- spawning
|
-- spawning
|
||||||
|
|
||||||
local water = mobs_mc.spawn_height.water
|
local water = mobs_mc.spawn_height.water
|
||||||
mobs:spawn_specific("extra_mobs:glow_squid", mobs_mc.spawn.water, {mobs_mc.items.water_source}, 0, minetest.LIGHT_MAX+1, 30, 10000, 3, water-16, water)
|
mobs:spawn_specific("extra_mobs:glow_squid", "overworld", "water", 0, minetest.LIGHT_MAX+1, 30, 10000, 3, water-16, water)
|
||||||
|
|
||||||
-- spawn egg
|
-- spawn egg
|
||||||
mobs:register_egg("extra_mobs:glow_squid", S("Glow Squid"), "extra_mobs_spawn_icon_glow_squid.png", 0)
|
mobs:register_egg("extra_mobs:glow_squid", S("Glow Squid"), "extra_mobs_spawn_icon_glow_squid.png", 0)
|
||||||
|
|
|
@ -115,7 +115,7 @@ baby_hoglin.child = 1
|
||||||
mobs:register_mob("extra_mobs:baby_hoglin", baby_hoglin)]]
|
mobs:register_mob("extra_mobs:baby_hoglin", baby_hoglin)]]
|
||||||
|
|
||||||
-- Regular spawning in the Nether
|
-- Regular spawning in the Nether
|
||||||
mobs:spawn_specific("extra_mobs:hoglin", {"mcl_nether:netherrack"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
mobs:spawn_specific("extra_mobs:hoglin", "nether", "ground", {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("extra_mobs:hoglin", S("Hoglin"), "extra_mobs_spawn_icon_hoglin.png", 0)
|
mobs:register_egg("extra_mobs:hoglin", S("Hoglin"), "extra_mobs_spawn_icon_hoglin.png", 0)
|
||||||
|
|
|
@ -264,8 +264,8 @@ mobs:register_mob("extra_mobs:piglin_brute", piglin_brute)
|
||||||
|
|
||||||
|
|
||||||
-- Regular spawning in the Nether
|
-- Regular spawning in the Nether
|
||||||
mobs:spawn_specific("extra_mobs:piglin", {"mcl_nether:netherrack"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
mobs:spawn_specific("extra_mobs:piglin", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
||||||
mobs:spawn_specific("extra_mobs:sword_piglin", {"mcl_nether:netherrack"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
mobs:spawn_specific("extra_mobs:sword_piglin", "nether", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("extra_mobs:piglin", S("piglin"), "extra_mobs_spawn_icon_piglin.png", 0)
|
mobs:register_egg("extra_mobs:piglin", S("piglin"), "extra_mobs_spawn_icon_piglin.png", 0)
|
||||||
mobs:register_egg("extra_mobs:piglin_brute", S("piglin Brute"), "extra_mobs_spawn_icon_piglin.png", 0)
|
mobs:register_egg("extra_mobs:piglin_brute", S("piglin Brute"), "extra_mobs_spawn_icon_piglin.png", 0)
|
||||||
|
|
|
@ -61,7 +61,7 @@ mobs:register_mob("extra_mobs:salmon", salmon)
|
||||||
|
|
||||||
--spawning TODO: in schools
|
--spawning TODO: in schools
|
||||||
local water = mobs_mc.spawn_height.water
|
local water = mobs_mc.spawn_height.water
|
||||||
mobs:spawn_specific("extra_mobs:salmon", mobs_mc.spawn.water, {mobs_mc.items.water_source}, 0, minetest.LIGHT_MAX+1, 30, 4000, 3, water-16, water)
|
mobs:spawn_specific("extra_mobs:salmon", "overworld", "water", 0, minetest.LIGHT_MAX+1, 30, 4000, 3, water-16, water)
|
||||||
|
|
||||||
--spawn egg
|
--spawn egg
|
||||||
mobs:register_egg("extra_mobs:salmon", S("Salmon"), "extra_mobs_spawn_icon_salmon.png", 0)
|
mobs:register_egg("extra_mobs:salmon", S("Salmon"), "extra_mobs_spawn_icon_salmon.png", 0)
|
||||||
|
|
|
@ -217,7 +217,7 @@ baby_strider.child = 1
|
||||||
mobs:register_mob("extra_mobs:baby_strider", baby_strider)
|
mobs:register_mob("extra_mobs:baby_strider", baby_strider)
|
||||||
|
|
||||||
-- Regular spawning in the Nether
|
-- Regular spawning in the Nether
|
||||||
mobs:spawn_specific("extra_mobs:strider", {"mcl_nether:nether_lava_source"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
mobs:spawn_specific("extra_mobs:strider", "nether", "lava", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("extra_mobs:strider", S("Strider"), "extra_mobs_spawn_icon_strider.png", 0)
|
mobs:register_egg("extra_mobs:strider", S("Strider"), "extra_mobs_spawn_icon_strider.png", 0)
|
||||||
|
|
|
@ -4277,13 +4277,14 @@ end
|
||||||
|
|
||||||
|
|
||||||
--I'm not sure what this does but disabling it doesn't cause a crash -j4i
|
--I'm not sure what this does but disabling it doesn't cause a crash -j4i
|
||||||
|
-- Just compatibility problem with outer mob mods currently, so adding a warning and temporarily enabling back -kay27 2021-04-08
|
||||||
-- MarkBu's spawn function
|
-- MarkBu's spawn function
|
||||||
--[[
|
|
||||||
function mobs:spawn(def)
|
|
||||||
|
|
||||||
|
function mobs:spawn(def)
|
||||||
|
minetest.log("warning", "[mcl_mobs] Deprecated function call: `mobs:spawn()`. Please use mobs:spawn_specific() instead!")
|
||||||
local name = def.name
|
local name = def.name
|
||||||
local nodes = def.nodes or {"group:soil", "group:stone"}
|
local nodes = def.nodes or {"group:soil", "group:stone"}
|
||||||
local neighbors = def.neighbors or {"air"}
|
-- local neighbors = def.neighbors or {"air"}
|
||||||
local min_light = def.min_light or 0
|
local min_light = def.min_light or 0
|
||||||
local max_light = def.max_light or 15
|
local max_light = def.max_light or 15
|
||||||
local interval = def.interval or 30
|
local interval = def.interval or 30
|
||||||
|
@ -4294,10 +4295,16 @@ function mobs:spawn(def)
|
||||||
local day_toggle = def.day_toggle
|
local day_toggle = def.day_toggle
|
||||||
local on_spawn = def.on_spawn
|
local on_spawn = def.on_spawn
|
||||||
|
|
||||||
mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
|
--mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
|
||||||
|
-- chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
|
||||||
|
mobs:spawn_specific(name, "overworld", nodes, min_light, max_light, interval,
|
||||||
|
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
|
||||||
|
mobs:spawn_specific(name, "end", nodes, min_light, max_light, interval,
|
||||||
|
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
|
||||||
|
mobs:spawn_specific(name, "nether", nodes, min_light, max_light, interval,
|
||||||
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
|
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
|
||||||
end
|
end
|
||||||
]]--
|
|
||||||
|
|
||||||
|
|
||||||
local axis
|
local axis
|
||||||
|
@ -4409,6 +4416,22 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
--elseif mob_def.type == "lava" then
|
--elseif mob_def.type == "lava" then
|
||||||
--implement later
|
--implement later
|
||||||
|
else -- mob_def.type is specific node name or group name
|
||||||
|
local spawning_position_list = minetest.find_nodes_in_area_under_air(vector.new(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), mob_def.type)
|
||||||
|
|
||||||
|
if #spawning_position_list <= 0 then
|
||||||
|
goto continue
|
||||||
|
end
|
||||||
|
|
||||||
|
local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)]
|
||||||
|
|
||||||
|
spawning_position.y = spawning_position.y + 1
|
||||||
|
|
||||||
|
local gotten_light = minetest.get_node_light(spawning_position)
|
||||||
|
|
||||||
|
if gotten_light and gotten_light >= mob_def.min_light and gotten_light <= mob_def.max_light then
|
||||||
|
minetest.add_entity(spawning_position, mob_def.name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"})
|
--local spawn minetest.find_nodes_in_area_under_air(vector.new(pos.x,pos.y-find_node_height,pos.z), vector.new(pos.x,pos.y+find_node_height,pos.z), {"group:solid"})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue