0
0
Fork 0

Add comments

This commit is contained in:
jordan4ibanez 2021-04-23 22:03:29 -04:00
parent ed9d629b99
commit c37a82d4a2
1 changed files with 3 additions and 0 deletions

View File

@ -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)