forked from MineClone5/MineClone5
made fox run from player
This commit is contained in:
parent
56b1cc8d75
commit
0a3190887c
|
@ -108,24 +108,27 @@ local fox = {
|
||||||
y = lp.y - s.y,
|
y = lp.y - s.y,
|
||||||
z = lp.z - s.z
|
z = lp.z - s.z
|
||||||
}
|
}
|
||||||
if object
|
if (object
|
||||||
and (object:is_player()
|
and object:is_player()
|
||||||
and not object:get_player_control().sneak)
|
and not object:get_player_control().sneak)
|
||||||
or not (object:is_player()
|
or (not object:is_player()
|
||||||
and object:get_luaentity()
|
and object:get_luaentity()
|
||||||
and object:get_luaentity().name == "mobs_mc:wolf") then
|
and object:get_luaentity().name == "mobs_mc:wolf") then
|
||||||
-- don't keep setting it once it's set
|
-- don't keep setting it once it's set
|
||||||
if not self.state == "runaway" then
|
if not self.state == "runaway" 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})
|
||||||
end
|
end
|
||||||
-- this next line causes jittering
|
-- this next line causes jittering
|
||||||
-- 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()) then
|
||||||
if self.reach > vector.distance(self.object:get_pos(), object:get_pos()) and self.timer > .9 then
|
self.timer = self.timer + 1
|
||||||
self.timer = 0
|
if self.timer > 10 then
|
||||||
object:punch(self.object, 1.0, {
|
self.timer = 0
|
||||||
full_punch_interval = 1.0,
|
self.object:punch(object, 0, {
|
||||||
damage_groups = {fleshy = self.damage}
|
full_punch_interval = 0,
|
||||||
}, nil)
|
damage_groups = {fleshy = 0}
|
||||||
|
}, nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue