new ai task, fixes of old ones, php8 fixes

This commit is contained in:
GameHerobrine 2022-12-24 22:42:23 +03:00
parent a907a7cf5e
commit 80bdddb817
13 changed files with 1581 additions and 1458 deletions

View file

@ -38,9 +38,13 @@ class EntityAI
* @return TaskBase | false
*/
public function getTask($id){
return $this->tasks[$id] ?: false; //i never saw this operator before
return isset($this->tasks[$id]) ? $this->tasks[$id] : false;
}
public function isStarted($id){
$task = @$this->getTask($id);
return $task instanceof TaskBase && $task->isStarted;
}
public function updateTasks(){
foreach($this->tasks as $t){