forked from epCode/extra_mobs
baby head enlargement, Runnaway from wolf
This commit is contained in:
parent
912238ccd9
commit
8160361b53
8
fox.lua
8
fox.lua
|
@ -35,6 +35,7 @@ local fox = {
|
||||||
mesh = "extra_mobs_fox.b3d",
|
mesh = "extra_mobs_fox.b3d",
|
||||||
textures = { {
|
textures = { {
|
||||||
"extra_mobs_fox.png",
|
"extra_mobs_fox.png",
|
||||||
|
"extra_mobs_trans.png",
|
||||||
} },
|
} },
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
sounds = {
|
sounds = {
|
||||||
|
@ -64,10 +65,13 @@ local fox = {
|
||||||
on_spawn = function(self)
|
on_spawn = function(self)
|
||||||
if minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:snow") ~= nil or minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:dirt_with_grass_snow") ~= nil then
|
if minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:snow") ~= nil or minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:dirt_with_grass_snow") ~= nil then
|
||||||
minetest.chat_send_all("true")
|
minetest.chat_send_all("true")
|
||||||
self.object:set_properties({textures={"extra_mobs_artic_fox.png"}})
|
self.object:set_properties({textures={"extra_mobs_artic_fox.png", "extra_mobs_trans.png"}})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
|
if self.child == true then
|
||||||
|
self.object:set_properties({textures={self.base_texture[1], self.base_texture[1]}})
|
||||||
|
end
|
||||||
if self.state ~= "attack" and math.random(1, 5000) == 1 then
|
if self.state ~= "attack" and math.random(1, 5000) == 1 then
|
||||||
self.state = "lay"
|
self.state = "lay"
|
||||||
self.object:set_animation({x= 12, y=16})
|
self.object:set_animation({x= 12, y=16})
|
||||||
|
@ -88,7 +92,7 @@ local fox = {
|
||||||
y = lp.y - s.y,
|
y = lp.y - s.y,
|
||||||
z = lp.z - s.z
|
z = lp.z - s.z
|
||||||
}
|
}
|
||||||
if object:is_player() and not object:get_player_control().sneak then
|
if object:is_player() and not object:get_player_control().sneak or not object:is_player() and object:get_luaentity().name == "mobs_mc:wolf" then
|
||||||
self.state = "runaway"
|
self.state = "runaway"
|
||||||
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
|
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
|
||||||
if self.reach > vector.distance(self.object:get_pos(), object:get_pos()) and self.timer > .9 and minetest.is_creative_enabled() == false then
|
if self.reach > vector.distance(self.object:get_pos(), object:get_pos()) and self.timer > .9 and minetest.is_creative_enabled() == false then
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue