mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
test movement added
This commit is contained in:
parent
5161d087ba
commit
1ac7179a97
11 changed files with 91 additions and 87 deletions
|
|
@ -16,7 +16,7 @@ class TaskAttackPlayer extends TaskTempt
|
|||
return;
|
||||
}
|
||||
|
||||
$ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5, false);
|
||||
//TODO fix $ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5, false);
|
||||
$ai->mobController->lookOn($this->target);
|
||||
$mult = $ai->entity instanceof Spider ? 1 : 2;
|
||||
$radius = ($ai->entity->width * $mult)*($ai->entity->width * $mult);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class TaskDestroyServerPerformance extends TaskTempt
|
|||
return;
|
||||
}
|
||||
if(Utils::distance_noroot($this->target, $ai->entity) > 100){
|
||||
$ai->mobController->moveTo($this->target->x, floor($ai->entity->y), $this->target->z, false);
|
||||
//TODO fix $ai->mobController->moveTo($this->target->x, floor($ai->entity->y), $this->target->z, false);
|
||||
}else{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class TaskMate extends \TaskBase
|
|||
$this->onEnd($ai);
|
||||
return;
|
||||
}
|
||||
$ai->mobController->moveTo($movTo->x, $movTo->y, $movTo->z, false);
|
||||
//TODO fix $ai->mobController->moveTo($movTo->x, $movTo->y, $movTo->z, false);
|
||||
$ai->mobController->lookOn($movTo);
|
||||
|
||||
--$this->selfCounter;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class TaskPanic extends TaskBase
|
|||
{
|
||||
--$this->selfCounter;
|
||||
if($this->selfCounter % 20 === 0) $this->regenerateRandXZ();
|
||||
$ai->mobController->moveNonInstant($this->randX, 0, $this->randZ);
|
||||
//TODO fix $ai->mobController->moveNonInstant($this->randX, 0, $this->randZ);
|
||||
}
|
||||
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,15 @@
|
|||
class TaskRandomWalk extends TaskBase
|
||||
{
|
||||
private $x, $z;
|
||||
public $moveSpeed;
|
||||
public function __construct($moveSpeed){
|
||||
$this->moveSpeed = 0.25;
|
||||
}
|
||||
|
||||
public function onStart(EntityAI $ai)
|
||||
{
|
||||
$this->x = mt_rand(-16, 16);
|
||||
$this->z = mt_rand(-16, 16);
|
||||
$this->x = mt_rand(-10, 10);
|
||||
$this->z = mt_rand(-10, 10);
|
||||
if($this->x === 0 && $this->z === 0){
|
||||
$this->reset();
|
||||
return false;
|
||||
|
|
@ -26,15 +31,17 @@ class TaskRandomWalk extends TaskBase
|
|||
return false; //TODO Better way: block movement
|
||||
}
|
||||
--$this->selfCounter;
|
||||
$ai->mobController->moveNonInstant($this->x, 0, $this->z);
|
||||
$ai->mobController->setMovingOffset($this->x, 0, $this->z, $this->moveSpeed);
|
||||
//TODO fix $ai->mobController->moveNonInstant($this->x, 0, $this->z);
|
||||
}
|
||||
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
{
|
||||
if(($ai->entity instanceof Creeper && $ai->entity->isIgnited()) || $ai->entity->hasPath() || $ai->isStarted("TaskTempt") ||$ai->isStarted("TaskAttackPlayer")) {
|
||||
return false;
|
||||
} // i really need mutexBits
|
||||
return !$ai->entity->inPanic && !$ai->isStarted("TaskMate") && !$ai->isStarted("TaskEatTileGoal") && !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskLookAtPlayer") && mt_rand(0, 120) == 0;
|
||||
return true;
|
||||
//if(($ai->entity instanceof Creeper && $ai->entity->isIgnited()) || $ai->entity->hasPath() || $ai->isStarted("TaskTempt") ||$ai->isStarted("TaskAttackPlayer")) {
|
||||
// return false;
|
||||
//} // i really need mutexBits
|
||||
//return !$ai->entity->inPanic && !$ai->isStarted("TaskMate") && !$ai->isStarted("TaskEatTileGoal") && !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskLookAtPlayer") && mt_rand(0, 120) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class TaskTempt extends TaskBase
|
|||
return;
|
||||
}
|
||||
|
||||
$ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5, false);
|
||||
//TODO fix $ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5, false);
|
||||
$ai->mobController->lookOn($this->target);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue