mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
ai changes
This commit is contained in:
parent
4835c15747
commit
5a3aeecd93
9 changed files with 196 additions and 98 deletions
|
|
@ -2,26 +2,46 @@
|
|||
|
||||
abstract class TaskBase
|
||||
{
|
||||
/**
|
||||
* @param EntityAI $ai
|
||||
* @return bool
|
||||
*/
|
||||
abstract function shouldBeExecuted(EntityAI $ai);
|
||||
|
||||
/**
|
||||
* @param EntityAI $ai
|
||||
* @return bool
|
||||
*/
|
||||
abstract function wasExecuted(EntityAI $ai);
|
||||
public $isStarted = false, $selfCounter = 0;
|
||||
|
||||
/**
|
||||
* Executed when entity starts task. It is recommended to set counter here.
|
||||
* @param EntityAI $ai
|
||||
*/
|
||||
abstract function onStart(EntityAI $ai);
|
||||
|
||||
/**
|
||||
* Every tick until counter will be not equal to 0. It is recommended to update value of counter here.
|
||||
* @param EntityAI $ai
|
||||
*/
|
||||
abstract function onUpdate(EntityAI $ai);
|
||||
|
||||
/**
|
||||
* On task end.
|
||||
* @param EntityAI $ai
|
||||
*/
|
||||
abstract function onEnd(EntityAI $ai);
|
||||
|
||||
/**
|
||||
* Can start the task
|
||||
* @param EntityAI $ai
|
||||
*/
|
||||
abstract function canBeExecuted(EntityAI $ai);
|
||||
|
||||
/**
|
||||
* @return number ticks
|
||||
*/
|
||||
function getIdleTimeAfterEnd(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
function reset(){
|
||||
$this->isStarted = false;
|
||||
$this->selfCounter = 0;
|
||||
}
|
||||
|
||||
final function __toString(){
|
||||
return get_class($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue