mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
project uses tabs instead of spaces(as in CONTRIBUTING.md)
This commit is contained in:
parent
f00318b6ed
commit
62571f26cd
115 changed files with 2291 additions and 2364 deletions
|
|
@ -2,39 +2,39 @@
|
|||
|
||||
class TaskRandomWalk extends TaskBase
|
||||
{
|
||||
private $x, $z;
|
||||
public function onStart(EntityAI $ai)
|
||||
{
|
||||
$this->x = mt_rand(-10, 10);
|
||||
$this->z = mt_rand(-10, 10);
|
||||
if($this->x === 0 && $this->z === 0){
|
||||
$this->reset();
|
||||
return false;
|
||||
}
|
||||
$this->selfCounter = floor(5 * Utils::distance($ai->entity, $ai->entity->add($this->x, 0, $this->z)));
|
||||
}
|
||||
private $x, $z;
|
||||
public function onStart(EntityAI $ai)
|
||||
{
|
||||
$this->x = mt_rand(-10, 10);
|
||||
$this->z = mt_rand(-10, 10);
|
||||
if($this->x === 0 && $this->z === 0){
|
||||
$this->reset();
|
||||
return false;
|
||||
}
|
||||
$this->selfCounter = floor(5 * Utils::distance($ai->entity, $ai->entity->add($this->x, 0, $this->z)));
|
||||
}
|
||||
|
||||
public function onEnd(EntityAI $ai)
|
||||
{
|
||||
$this->x = $this->z = 0;
|
||||
}
|
||||
public function onEnd(EntityAI $ai)
|
||||
{
|
||||
$this->x = $this->z = 0;
|
||||
}
|
||||
|
||||
public function onUpdate(EntityAI $ai)
|
||||
{
|
||||
if($ai->entity instanceof Creeper && $ai->entity->isIgnited()) {
|
||||
return false; //TODO Better way: block movement
|
||||
}
|
||||
--$this->selfCounter;
|
||||
$ai->mobController->moveNonInstant($this->x, 0, $this->z);
|
||||
}
|
||||
public function onUpdate(EntityAI $ai)
|
||||
{
|
||||
if($ai->entity instanceof Creeper && $ai->entity->isIgnited()) {
|
||||
return false; //TODO Better way: block movement
|
||||
}
|
||||
--$this->selfCounter;
|
||||
$ai->mobController->moveNonInstant($this->x, 0, $this->z);
|
||||
}
|
||||
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
{
|
||||
if($ai->entity instanceof Creeper && $ai->entity->isIgnited()) {
|
||||
return false;
|
||||
}
|
||||
return !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskLookAtPlayer") && mt_rand(0, 120) == 0;
|
||||
}
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
{
|
||||
if($ai->entity instanceof Creeper && $ai->entity->isIgnited()) {
|
||||
return false;
|
||||
}
|
||||
return !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskLookAtPlayer") && mt_rand(0, 120) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue