forked from MineClone5/MineClone5
Add comments
This commit is contained in:
parent
ed9d629b99
commit
c37a82d4a2
|
@ -168,10 +168,13 @@ local land_state_execution = function(self,dtime)
|
||||||
|
|
||||||
elseif self.state == "follow" then
|
elseif self.state == "follow" then
|
||||||
|
|
||||||
|
--always look at players
|
||||||
mobs.set_yaw_while_following(self)
|
mobs.set_yaw_while_following(self)
|
||||||
|
|
||||||
|
--check distance
|
||||||
local distance_from_follow_person = vector_distance(self.object:get_pos(), self.following_person:get_pos())
|
local distance_from_follow_person = vector_distance(self.object:get_pos(), self.following_person:get_pos())
|
||||||
|
|
||||||
|
--don't push the player if too close
|
||||||
if self.follow_distance < distance_from_follow_person then
|
if self.follow_distance < distance_from_follow_person then
|
||||||
mobs.set_mob_animation(self, "run")
|
mobs.set_mob_animation(self, "run")
|
||||||
mobs.set_velocity(self,self.run_velocity)
|
mobs.set_velocity(self,self.run_velocity)
|
||||||
|
|
Loading…
Reference in New Issue