229 lines
5.7 KiB
Lua
229 lines
5.7 KiB
Lua
local f = string.format
|
|
|
|
local BASE_CHANCE_RATIO = 60 * 8000 -- cow
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:bee",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 7000) / BASE_CHANCE_RATIO,
|
|
near = { "group:flower" },
|
|
on = { "any" },
|
|
min_y = 3,
|
|
max_y = 200,
|
|
min_node_light = 12,
|
|
max_in_area = 1,
|
|
max_any_in_area = 6,
|
|
min_time_of_day = yl_spawnit.dawn,
|
|
max_time_of_day = yl_spawnit.dusk,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:bunny",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 8000) / BASE_CHANCE_RATIO * 3,
|
|
on = { "group:soil" },
|
|
near = { "group:grass" },
|
|
min_y = 5,
|
|
max_y = 200,
|
|
max_in_area = 3,
|
|
max_any_in_area = 6,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:chicken",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 8000) / BASE_CHANCE_RATIO,
|
|
on = { "group:soil" },
|
|
near = { "group:grass" },
|
|
min_y = 5,
|
|
max_y = 200,
|
|
min_node_light = 12,
|
|
max_in_area = 3,
|
|
max_any_in_area = 6,
|
|
min_time_of_day = yl_spawnit.dawn,
|
|
max_time_of_day = yl_spawnit.dusk,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:cow",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 8000) / BASE_CHANCE_RATIO,
|
|
on = { "group:soil" },
|
|
near = { "group:grass" },
|
|
min_y = 5,
|
|
max_y = 200,
|
|
min_node_light = 12,
|
|
max_in_area = 2,
|
|
max_any_in_area = 6,
|
|
min_time_of_day = yl_spawnit.dawn,
|
|
max_time_of_day = yl_spawnit.dusk,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:kitten",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 10000) / BASE_CHANCE_RATIO,
|
|
on = { "group:soil" },
|
|
near = { "group:grass" },
|
|
min_y = 5,
|
|
max_y = 50,
|
|
max_in_area = 1,
|
|
max_any_in_area = 6,
|
|
min_time_of_day = yl_spawnit.dusk,
|
|
max_time_of_day = yl_spawnit.dawn,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:panda",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 8000) / BASE_CHANCE_RATIO,
|
|
on = { "group:soil" },
|
|
near = { "ethereal:bamboo", "ethereal:bamboo_leaves", "ethereal:bamboo_sprout" },
|
|
min_y = 10,
|
|
max_y = 80,
|
|
max_in_area = 1,
|
|
max_any_in_area = 6,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:penguin",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 20000) / BASE_CHANCE_RATIO,
|
|
on = { "default:snowblock", "default:ice" },
|
|
min_y = 0,
|
|
max_y = 10,
|
|
min_node_light = 12,
|
|
max_in_area = 3,
|
|
max_any_in_area = 6,
|
|
min_time_of_day = yl_spawnit.dawn,
|
|
max_time_of_day = yl_spawnit.dusk,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:rat",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 8000) / BASE_CHANCE_RATIO * 5,
|
|
max_y = 0,
|
|
min_node_light = 3,
|
|
max_node_light = 9,
|
|
max_in_area = 1,
|
|
max_any_in_area = 6,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
local function make_child(obj, ent)
|
|
local textures = ent.base_texture
|
|
|
|
-- using specific child texture (if found)
|
|
if ent.child_texture then
|
|
textures = ent.child_texture[1]
|
|
end
|
|
|
|
-- and resize to half height (multiplication is faster than division)
|
|
obj:set_properties({
|
|
textures = textures,
|
|
visual_size = {
|
|
x = ent.base_size.x * 0.5,
|
|
y = ent.base_size.y * 0.5,
|
|
},
|
|
collisionbox = {
|
|
ent.base_colbox[1] * 0.5,
|
|
ent.base_colbox[2] * 0.5,
|
|
ent.base_colbox[3] * 0.5,
|
|
ent.base_colbox[4] * 0.5,
|
|
ent.base_colbox[5] * 0.5,
|
|
ent.base_colbox[6] * 0.5,
|
|
},
|
|
selectionbox = {
|
|
ent.base_selbox[1] * 0.5,
|
|
ent.base_selbox[2] * 0.5,
|
|
ent.base_selbox[3] * 0.5,
|
|
ent.base_selbox[4] * 0.5,
|
|
ent.base_selbox[5] * 0.5,
|
|
ent.base_selbox[6] * 0.5,
|
|
},
|
|
})
|
|
|
|
ent.child = true
|
|
end
|
|
|
|
local colors = {
|
|
black = "#212121b0",
|
|
brown = "#663300a0",
|
|
dark_grey = "#444444b0",
|
|
grey = "#919191b0",
|
|
white = "#ffffffc0",
|
|
}
|
|
|
|
local function after_spawn_sheep(pos, obj)
|
|
local ent = obj:get_luaentity()
|
|
if not ent then
|
|
return
|
|
end
|
|
|
|
local color = ent.name:match("^mobs_animal:sheep_(.*)$")
|
|
|
|
local horns = math.random(400) <= pos.y
|
|
local lamb = math.random(4) == 1
|
|
|
|
if horns and not lamb then
|
|
local texture = f("mobs_sheep_base.png^mobs_sheep_horns.png^(mobs_sheep_wool.png^[multiply:%s)", colors[color])
|
|
|
|
obj:set_properties({ textures = { texture } })
|
|
ent.base_texture = { texture }
|
|
ent.attribute_horns = horns
|
|
elseif lamb then
|
|
make_child(obj, ent)
|
|
end
|
|
end
|
|
|
|
spawnit.register({
|
|
entity_name = {
|
|
["mobs_animal:sheep_white"] = 24,
|
|
["mobs_animal:sheep_black"] = 4,
|
|
["mobs_animal:sheep_brown"] = 2,
|
|
["mobs_animal:sheep_grey"] = 1,
|
|
["mobs_animal:sheep_dark_grey"] = 1,
|
|
},
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 12000) / BASE_CHANCE_RATIO * 4,
|
|
cluster = 4,
|
|
on = { "group:soil" },
|
|
near = { "group:grass" },
|
|
min_y = 0,
|
|
max_y = 400,
|
|
min_node_light = 12,
|
|
max_in_area = 4,
|
|
max_any_in_area = 6,
|
|
min_time_of_day = yl_spawnit.dawn,
|
|
max_time_of_day = yl_spawnit.dusk,
|
|
spawn_in_protected = true,
|
|
after_spawn = after_spawn_sheep,
|
|
}, yl_spawnit.settings.check_nodes)
|
|
|
|
spawnit.register({
|
|
entity_name = "mobs_animal:pumba",
|
|
groups = { animal = 1 },
|
|
chance = yl_spawnit.base_chance * (60 * 8000) / BASE_CHANCE_RATIO,
|
|
on = {
|
|
"default:dirt_with_dry_grass",
|
|
"default:dry_dirt_with_dry_grass",
|
|
"default:dirt_with_rainforest_litter",
|
|
"ethereal:mushroom_dirt",
|
|
},
|
|
near = { "group:mushroom", "group:grass" },
|
|
min_y = 0,
|
|
max_y = 200,
|
|
min_node_light = 2,
|
|
max_in_area = 2,
|
|
max_any_in_area = 6,
|
|
spawn_in_protected = true,
|
|
}, yl_spawnit.settings.check_nodes)
|