Open player's eyes for mobs

This commit is contained in:
ArkQuark 2023-02-21 15:37:42 +03:00
parent b6934024da
commit abe7846bb9
4 changed files with 15 additions and 10 deletions

View file

@ -11,11 +11,14 @@ class PathFollower{
}
public function followPath(){
if($this->entity->path != null && (is_array($this->entity->path) && count($this->entity->path) <= 0 || $this->entity->currentIndex >= count($this->entity->path))){
if(!isset($entity) or $this->entity->path == null){
return;
}
if((is_array($this->entity->path) && count($this->entity->path) <= 0 || $this->entity->currentIndex >= count($this->entity->path))){
$this->entity->path = null;
$this->entity->currentIndex = 0;
$this->entity->currentNode = false;
}elseif($this->entity->path != null && ($this->entity->currentNode == false || $this->entity->ai->mobController->moveTo($this->entity->currentNode->x, $this->entity->currentNode->y, $this->entity->currentNode->z) === false)){
}elseif(($this->entity->currentNode == false || $this->entity->ai->mobController->moveTo($this->entity->currentNode->x, $this->entity->currentNode->y, $this->entity->currentNode->z) === false)){
$this->entity->currentNode = $this->entity->path[$this->entity->currentIndex++];
}
}