Make owl tamable, with compatibility and right code checks
* cherry picked from https://github.com/BlockySurvival/mobs_animal_pack/pull/6 * not change namespace neither idents
This commit is contained in:
parent
f6f933ef06
commit
c85fa38193
48
mobs/owl.lua
48
mobs/owl.lua
@ -1,3 +1,45 @@
|
||||
local follow = {}
|
||||
|
||||
-- detect common minetest famous mobs
|
||||
if minetest.get_modpath("farming") then
|
||||
table.insert(follow, "farming:seed_wheat")
|
||||
table.insert(follow, "farming:seed_cotton")
|
||||
end
|
||||
if minetest.get_modpath("butterflies") then
|
||||
table.insert(follow, "butterflies:butterfly_red")
|
||||
table.insert(follow, "butterflies:butterfly_violet")
|
||||
table.insert(follow, "butterflies:butterfly_white")
|
||||
end
|
||||
if minetest.get_modpath("fireflies") then
|
||||
table.insert(follow, "fireflies:firefly")
|
||||
end
|
||||
if minetest.get_modpath("mobs_animal") then
|
||||
table.insert(follow, "mobs_animal:rat")
|
||||
table.insert(follow, "mobs_animal:bee")
|
||||
table.insert(follow, "mobs_animal:bunny")
|
||||
table.insert(follow, "mobs_animal:chicken")
|
||||
end
|
||||
-- compatibility with those made specially for other games
|
||||
if minetest.get_modpath("mobs_bugslive") then
|
||||
table.insert(follow, "mobs_bugslive:bug")
|
||||
end
|
||||
if minetest.get_modpath("mobs_butterfly") then
|
||||
table.insert(follow, "mobs_butterfly:butterfly")
|
||||
end
|
||||
if minetest.get_modpath("mobs_fish") then
|
||||
table.insert(follow, "mobs_fish:tropical")
|
||||
table.insert(follow, "mobs_fish:clownfish")
|
||||
end
|
||||
if minetest.get_modpath("mobs_better_rat") then
|
||||
table.insert(follow, "mobs_better_rat:rat")
|
||||
end
|
||||
if minetest.get_modpath("mobs_bat") then
|
||||
table.insert(follow, "mobs_bat:bat")
|
||||
end
|
||||
if minetest.get_modpath("mobs_birds") then
|
||||
table.insert(follow, "mobs_birds:bird_sm")
|
||||
end
|
||||
|
||||
mobs:register_mob("dmobs:owl", {
|
||||
type = "animal",
|
||||
passive = true,
|
||||
@ -20,6 +62,7 @@ mobs:register_mob("dmobs:owl", {
|
||||
lava_damage = 2,
|
||||
light_damage = 0,
|
||||
view_range = 1,
|
||||
follow=follow,
|
||||
do_custom = function(self)
|
||||
local daytime = minetest.get_timeofday()*24000
|
||||
if daytime <=6000 then
|
||||
@ -34,6 +77,11 @@ mobs:register_mob("dmobs:owl", {
|
||||
})
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(self, clicker)
|
||||
if mobs:feed_tame(self, clicker, 8, true, true) then return end
|
||||
if mobs:protect(self, clicker) then return end
|
||||
mobs:capture_mob(self, clicker, 0, 50, 5, false, nil)
|
||||
end,
|
||||
animation = {
|
||||
speed_normal = 1,
|
||||
walk_start = 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user