1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2024-12-22 17:00:26 +01:00

using mobs:spawn functions to spawn animals

This commit is contained in:
TenPlus1 2016-10-29 16:45:47 +01:00
parent 2c0b9f5357
commit 3776506b2f
8 changed files with 61 additions and 23 deletions

15
bee.lua
View File

@ -41,7 +41,14 @@ mobs:register_mob("mobs_animal:bee", {
end, end,
}) })
mobs:register_spawn("mobs_animal:bee", {"group:flower"}, 20, 10, 9000, 1, 31000, true) mobs:spawn({
name = "mobs_animal:bee",
nodes = {"group:flower"},
min_light = 10,
chance = 9000,
min_height = 0,
day_toggle = true,
})
mobs:register_egg("mobs_animal:bee", S("Bee"), "mobs_bee_inv.png", 0) mobs:register_egg("mobs_animal:bee", S("Bee"), "mobs_bee_inv.png", 0)
@ -81,7 +88,7 @@ minetest.register_node(":mobs:beehive", {
meta:get_inventory():set_size("beehive", 1) meta:get_inventory():set_size("beehive", 1)
end, end,
--[[
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if placer:is_player() then if placer:is_player() then
@ -89,11 +96,11 @@ minetest.register_node(":mobs:beehive", {
minetest.set_node(pos, {name = "mobs:beehive", param2 = 1}) minetest.set_node(pos, {name = "mobs:beehive", param2 = 1})
if math.random(1, 4) == 1 then if math.random(1, 4) == 1 then
minetest.add_entity(pos, "mobs:bee") minetest.add_entity(pos, "mobs_animal:bee")
end end
end end
end, end,
]]
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
-- yep, bee's don't like having their home punched by players -- yep, bee's don't like having their home punched by players

View File

@ -80,8 +80,14 @@ mobs:register_mob("mobs_animal:bunny", {
damage = 5, damage = 5,
}) })
mobs:register_spawn("mobs_animal:bunny", mobs:spawn({
{"default:dirt_with_grass", "ethereal:prairie_dirt"}, 20, 10, 15000, 1, 31000, true) name = "mobs_animal:bunny",
nodes = {"default:dirt_with_grass", "ethereal:prairie_dirt"},
min_light = 10,
chance = 15000,
min_height = 0,
day_toggle = true,
})
mobs:register_egg("mobs_animal:bunny", S("Bunny"), "mobs_bunny_inv.png", 0) mobs:register_egg("mobs_animal:bunny", S("Bunny"), "mobs_bunny_inv.png", 0)

View File

@ -78,15 +78,13 @@ mobs:register_mob("mobs_animal:chicken", {
end, end,
}) })
--mobs:register_spawn("mobs_animal:chicken",
-- {"default:dirt_with_grass", "ethereal:bamboo_dirt"}, 20, 10, 15000, 2, 31000, true)
mobs:spawn({ mobs:spawn({
name = "mobs_animal:chicken", name = "mobs_animal:chicken",
nodes = {"default:dirt_with_grass", "ethereal:bamboo_dirt"}, nodes = {"default:dirt_with_grass", "ethereal:bamboo_dirt"},
interval = 1, min_light = 10,
chance = 12000, chance = 15000,
active_object_count = 1, active_object_count = 2,
min_height = 0,
day_toggle = true, day_toggle = true,
}) })

11
cow.lua
View File

@ -95,8 +95,15 @@ mobs:register_mob("mobs_animal:cow", {
end, end,
}) })
mobs:register_spawn("mobs_animal:cow", mobs:spawn({
{"default:dirt_with_grass", "ethereal:green_dirt"}, 20, 10, 15000, 1, 31000, true) name = "mobs_animal:cow",
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
min_light = 10,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:cow", S("Cow"), "default_grass.png", 1) mobs:register_egg("mobs_animal:cow", S("Cow"), "default_grass.png", 1)

View File

@ -52,8 +52,15 @@ mobs:register_mob("mobs_animal:kitten", {
end end
}) })
mobs:register_spawn("mobs_animal:kitten", mobs:spawn({
{"default:dirt_with_grass", "ethereal:grove_dirt"}, 20, 12, 22000, 1, 31000, true) name = "mobs_animal:kitten",
nodes = {"default:dirt_with_grass", "ethereal:grove_dirt"},
min_light = 12,
chance = 22000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:kitten", S("Kitten"), "mobs_kitten_inv.png", 0) mobs:register_egg("mobs_animal:kitten", S("Kitten"), "mobs_kitten_inv.png", 0)

View File

@ -57,8 +57,6 @@ mobs:register_mob("mobs_animal:rat", {
]] ]]
}) })
--mobs:register_spawn("mobs_animal:rat", {"default:stone"}, 20, 5, 15000, 2, 0)
local function rat_spawn(self, pos) local function rat_spawn(self, pos)
print (self:get_luaentity().name, pos.x, pos.y, pos.z) print (self:get_luaentity().name, pos.x, pos.y, pos.z)
end end
@ -66,6 +64,8 @@ end
mobs:spawn({ mobs:spawn({
name = "mobs_animal:rat", name = "mobs_animal:rat",
nodes = {"default:stone"}, nodes = {"default:stone"},
min_light = 3,
active_object_count = 2,
max_height = 0, max_height = 0,
-- on_spawn = rat_spawn, -- on_spawn = rat_spawn,
}) })

View File

@ -177,9 +177,15 @@ for _, col in pairs(all_colours) do
end end
mobs:register_spawn("mobs_animal:sheep_white", mobs:spawn({
{"default:dirt_with_grass", "ethereal:green_dirt"}, 20, 10, 15000, 1, 31000, true) name = "mobs_animal:sheep_white",
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
min_light = 10,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
-- compatibility -- compatibility
mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white")

View File

@ -55,8 +55,15 @@ mobs:register_mob("mobs_animal:pumba", {
end, end,
}) })
mobs:register_spawn("mobs_animal:pumba", mobs:spawn({
{"ethereal:mushroom_dirt", "default:dirt_with_dry_grass"}, 20, 10, 15000, 1, 31000, true) name = "mobs_animal:pumba",
nodes = {"default:dirt_with_dry_grass", "ethereal:mushroom_dirt"},
min_light = 10,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:pumba", S("Warthog"), "wool_pink.png", 1) mobs:register_egg("mobs_animal:pumba", S("Warthog"), "wool_pink.png", 1)