small changes

This commit is contained in:
GameHerobrine 2024-07-02 04:00:14 +03:00
parent 973589869e
commit 99954b67d6
8 changed files with 37 additions and 42 deletions

View file

@ -15,8 +15,8 @@ abstract class Living extends Entity implements Pathfindable{
public $pathFinder, $path = null, $currentIndex = 0, $currentNode, $pathFollower;
public $ticksExisted = 0;
public $landMovementFactor = 0.1; //TODO may not be constant
public $jumpMovementFactor = 0.02; //TODO may not be constant
public $landMovementFactor = 0.1;
public $jumpMovementFactor = 0.02;
public $aiMoveSpeed;
public $renderYawOffset = 0.0; //used by head rotation, TODO better name

View file

@ -106,13 +106,7 @@ class MobController
$v10 = (atan2($diffZ, $diffX) * 180 / M_PI) - 90;
$this->entity->yaw = self::limitAngle($this->entity->yaw, $v10, 30);
$this->entity->setAIMoveSpeed($this->speedMultiplier * $this->entity->getSpeed() * $this->entity->getSpeedModifer());
//TODO 0.8.1 doesnt seem to make 2 multiplications here
/*
* v15 = this->controlledEntity;
speedMultiplier = this->speedMultiplier;
v17 = v15->vtable->_virt_getBaseSpeed(v15);
Mob::setSpeed(v15, speedMultiplier * v17);
*/
if($diffY > 0 && $diffX*$diffX + $diffZ*$diffZ < 1) $this->setJumping(true);
}
}
@ -127,7 +121,7 @@ class MobController
public function updateHeadYaw(){
$diffX = $this->entity->x - $this->entity->lastX;
$diffZ = $this->entity->z - $this->entity->lastZ;
if(($diffX*$diffX + $diffZ*$diffZ) > 2.500000277905201E-7){ //TODO convert notation
if(($diffX*$diffX + $diffZ*$diffZ) > 0.00000025){
$this->entity->renderYawOffset = $this->entity->yaw;
$this->entity->headYaw = self::limitAngle2($this->entity->renderYawOffset, $this->entity->headYaw, 75);
$this->headYaw = $this->entity->headYaw;

View file

@ -11,7 +11,7 @@ class PigZombie extends Monster{ //TODO extends zombie
$this->ai->addTask(new TaskLookAround());
$this->ai->addTask(new TaskRandomWalk(1.0));
$this->ai->addTask(new TaskSwimming());
$this->ai->addTask(new TaskAttackPlayer(1.0, 16)); //TODO fix range?
$this->ai->addTask(new TaskAttackPlayer(1.0, 16));
}
public function getAttackDamage(){
return 5;

View file

@ -8,10 +8,10 @@ class Spider extends Monster{
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 8, "generic");
$this->setName("Spider");
$this->setSpeed(0.3);
$this->ai->addTask(new TaskRandomWalk(1.0)); //TODO this mob doesnt use newAI -> speed is not correct
$this->ai->addTask(new TaskLookAround()); //TODO this mob doesnt use newAI
$this->ai->addTask(new TaskRandomWalk(1.0));
$this->ai->addTask(new TaskLookAround());
$this->ai->addTask(new TaskSwimming());
$this->ai->addTask(new TaskAttackPlayer(1.0, 16)); //TODO fix range?
$this->ai->addTask(new TaskAttackPlayer(1.0, 16));
}
public function getAttackDamage(){

View file

@ -77,7 +77,7 @@ class Arrow extends Entity{
$this->pitch = (atan2($d1, $f3) * 180) / M_PI;
$this->updatePosition();
//$this->update();
//TODO i guess? $ticksInGround = 0;
$this->groundTicks = 0;
}
public function update($now){