fixed and reverted

This commit is contained in:
GameHerobrine 2023-10-30 06:36:10 +03:00
parent bfc653a911
commit 5b8aee19fa
5 changed files with 12 additions and 12 deletions

View file

@ -37,7 +37,7 @@ class MobController
return $this->finalHeadYaw === $this->entity->headYaw; return $this->finalHeadYaw === $this->entity->headYaw;
} }
public function moveNonInstant($x, $y, $z){ public function moveNonInstant($x, $y, $z, $camera = true){
if($x == 0 && $y == 0 && $z == 0){ if($x == 0 && $y == 0 && $z == 0){
return false; return false;
} }
@ -90,8 +90,8 @@ class MobController
} }
break; break;
} }
$this->faceEntity($ox, $oy, $oz); if($camera) $this->faceEntity($ox, $oy, $oz);
if($this->entity->knockbackTime <= 0){// && $this->isRotationCompleted()){ if($this->entity->knockbackTime <= 0 && $this->isRotationCompleted()){
$this->entity->moveEntityWithOffset($ox, $oy, $oz); $this->entity->moveEntityWithOffset($ox, $oy, $oz);
} }
return true; return true;
@ -111,8 +111,8 @@ class MobController
$this->entity->headYaw = Utils::wrapAngleTo360($this->entity->headYaw + $w180min); $this->entity->headYaw = Utils::wrapAngleTo360($this->entity->headYaw + $w180min);
} }
public function moveTo($x, $y, $z){ public function moveTo($x, $y, $z, $camera = true){
return $this->moveNonInstant($x - floor($this->entity->x), $y - floor($this->entity->y), $z - floor($this->entity->z)); return $this->moveNonInstant($x - floor($this->entity->x), $y - floor($this->entity->y), $z - floor($this->entity->z), $camera);
} }
public function faceEntity($x, $y, $z){ public function faceEntity($x, $y, $z){
@ -130,7 +130,7 @@ class MobController
$tan = $dz == 0 ? ($dx < 0 ? 180 : 0) : (90 - rad2deg(atan($dx / $dz))); $tan = $dz == 0 ? ($dx < 0 ? 180 : 0) : (90 - rad2deg(atan($dx / $dz)));
$thetaOffset = $dz < 0 ? 90 : 270; $thetaOffset = $dz < 0 ? 90 : 270;
$calcYaw = ($thetaOffset + $tan); $calcYaw = ($thetaOffset + $tan);
$this->finalHeadYaw = $this->entity->yaw = $calcYaw; $this->finalHeadYaw = $this->entity->yaw = Utils::wrapAngleTo360($calcYaw);
} }
public function lookOffset($x, $y, $z, $pitch = true){ public function lookOffset($x, $y, $z, $pitch = true){
@ -138,7 +138,7 @@ class MobController
$thetaOffset = $z < 0 ? 90 : 270; $thetaOffset = $z < 0 ? 90 : 270;
$calcYaw = $tan + $thetaOffset; $calcYaw = $tan + $thetaOffset;
$this->entity->yaw = $this->finalHeadYaw = $calcYaw; $this->entity->yaw = $this->finalHeadYaw = Utils::wrapAngleTo360($calcYaw);
if($pitch){ if($pitch){
$diff = sqrt($x * $x + $z * $z); $diff = sqrt($x * $x + $z * $z);

View file

@ -16,7 +16,7 @@ class TaskAttackPlayer extends TaskTempt
return; return;
} }
$ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5); $ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5, false);
$ai->mobController->lookOn($this->target); $ai->mobController->lookOn($this->target);
$mult = $ai->entity instanceof Spider ? 1 : 2; $mult = $ai->entity instanceof Spider ? 1 : 2;
$radius = ($ai->entity->width * $mult)*($ai->entity->width * $mult); $radius = ($ai->entity->width * $mult)*($ai->entity->width * $mult);

View file

@ -21,7 +21,7 @@ class TaskDestroyServerPerformance extends TaskTempt
return; return;
} }
if(Utils::distance_noroot($this->target, $ai->entity) > 100){ if(Utils::distance_noroot($this->target, $ai->entity) > 100){
$ai->mobController->moveTo($this->target->x, floor($ai->entity->y), $this->target->z); $ai->mobController->moveTo($this->target->x, floor($ai->entity->y), $this->target->z, false);
}else{ }else{
//TODO move away //TODO move away
} }

View file

@ -31,7 +31,7 @@ class TaskRandomWalk extends TaskBase
public function canBeExecuted(EntityAI $ai) public function canBeExecuted(EntityAI $ai)
{ {
if(($ai->entity instanceof Creeper && $ai->entity->isIgnited()) || $ai->entity->hasPath() || $ai->isStarted("TaskTempt")) { if(($ai->entity instanceof Creeper && $ai->entity->isIgnited()) || $ai->entity->hasPath() || $ai->isStarted("TaskTempt") ||$ai->isStarted("TaskAttackPlayer")) {
return false; return false;
} }
return !$ai->entity->inPanic && !$ai->isStarted("TaskEatTileGoal")&& !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskLookAtPlayer") && mt_rand(0, 120) == 0; return !$ai->entity->inPanic && !$ai->isStarted("TaskEatTileGoal")&& !$ai->isStarted("TaskLookAround") && !$ai->isStarted("TaskLookAtPlayer") && mt_rand(0, 120) == 0;

View file

@ -23,7 +23,7 @@ class TaskTempt extends TaskBase
return; return;
} }
$ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5); $ai->mobController->moveTo($this->target->x - 0.5, floor($ai->entity->y), $this->target->z - 0.5, false);
$ai->mobController->lookOn($this->target); $ai->mobController->lookOn($this->target);
} }