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

bunny uses on_spawn to check wether to place snow, desert or random bunny

This commit is contained in:
TenPlus1 2017-09-01 12:28:10 +01:00
parent aabb410ec9
commit e2d9579401

View File

@ -74,7 +74,22 @@ mobs:register_mob("mobs_animal:bunny", {
return return
end end
end, end,
on_spawn = function(self)
local pos = self.object:getpos() ; pos.y = pos.y - 1
-- snow bunny
if minetest.find_node_near(pos, 2, {"default:snow", "default:snowblock"}) then
self.base_texture = {"mobs_bunny_white.png"}
self.object:set_properties({textures = self.base_texture})
-- desert bunny
elseif minetest.find_node_near(pos, 2, {"default:desert_sand", "default:desert_stone"}) then
self.base_texture = {"mobs_bunny_brown.png"}
self.object:set_properties({textures = self.base_texture})
end
return true -- run only once, false/nil runs every activation
end,
attack_type = "dogfight", attack_type = "dogfight",
damage = 5, damage = 5,
}) })