forked from mtcontrib/mobs_animal
bunny colour can depend on block spawned
This commit is contained in:
parent
56b201d326
commit
34ed37cf82
15
bunny.lua
15
bunny.lua
@ -78,14 +78,21 @@ mobs:register_mob("mobs_animal:bunny", {
|
|||||||
|
|
||||||
local pos = self.object:getpos() ; pos.y = pos.y - 1
|
local pos = self.object:getpos() ; pos.y = pos.y - 1
|
||||||
|
|
||||||
-- snow bunny
|
-- white snowy bunny
|
||||||
if minetest.find_node_near(pos, 2, {"default:snow", "default:snowblock"}) then
|
if minetest.find_node_near(pos, 1,
|
||||||
|
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||||
self.base_texture = {"mobs_bunny_white.png"}
|
self.base_texture = {"mobs_bunny_white.png"}
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
-- desert bunny
|
-- brown desert bunny
|
||||||
elseif minetest.find_node_near(pos, 2, {"default:desert_sand", "default:desert_stone"}) then
|
elseif minetest.find_node_near(pos, 1,
|
||||||
|
{"default:desert_sand", "default:desert_stone"}) then
|
||||||
self.base_texture = {"mobs_bunny_brown.png"}
|
self.base_texture = {"mobs_bunny_brown.png"}
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
|
-- grey stone bunny
|
||||||
|
elseif minetest.find_node_near(pos, 1,
|
||||||
|
{"default:stone", "default:gravel"}) then
|
||||||
|
self.base_texture = {"mobs_bunny_grey.png"}
|
||||||
|
self.object:set_properties({textures = self.base_texture})
|
||||||
end
|
end
|
||||||
|
|
||||||
return true -- run only once, false/nil runs every activation
|
return true -- run only once, false/nil runs every activation
|
||||||
|
Loading…
Reference in New Issue
Block a user