water damage tweaks, using php8 pack functions

This commit is contained in:
GameHerobrine 2024-01-01 08:15:05 +03:00
parent 229a563ff5
commit 68b8232f07
17 changed files with 46 additions and 76 deletions

View file

@ -10,7 +10,6 @@ class Creeper extends Monster{
$this->setName("Creeper");
$this->ignited = 0;
$this->setSpeed(0.25);
$this->update();
$this->timeUntilExplode = $this->isIgnited() ? self::EXPL_TIME : 0;
}
@ -58,8 +57,8 @@ class Creeper extends Monster{
}
}
public function update(){
if($this->isIgnited() && $this->target instanceof Entity && Utils::distance_noroot($this->target, $this) > 49){
public function update($now){
if($this->isIgnited() && $this->target instanceof Entity && Utils::distance_noroot($this->target, $this) > 49){ //TODO move somewhere else
$this->setIgnited(-1); //broken in vanilla too
$this->timeUntilExplode = 0;
}
@ -69,7 +68,7 @@ class Creeper extends Monster{
if($this->timeUntilExplode >= 0){
--$this->timeUntilExplode;
}
parent::update();
parent::update($now);
}
public function explode()

View file

@ -7,7 +7,6 @@ class PigZombie extends Monster{
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 12, "generic");
$this->setName("Pigman");
$this->setSpeed(0.25);
$this->update();
}
public function getAttackDamage(){
return 5;

View file

@ -9,7 +9,6 @@ class Skeleton extends Monster{
$this->ai->removeTask("TaskAttackPlayer");
//$this->ai->addTask(new TaskDestroyServerPerformance());
$this->setSpeed(0.25);
$this->update();
}
public function getAttackDamage(){
@ -36,9 +35,9 @@ class Skeleton extends Monster{
}
}
public function update(){
public function update($now){
$this->updateBurning();
parent::update();
parent::update($now);
}
public function getDrops(){

View file

@ -7,7 +7,6 @@ class Spider extends Monster{
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 8, "generic");
$this->setName("Spider");
$this->setSpeed(0.3);
$this->update();
}
public function getDrops(){

View file

@ -7,7 +7,6 @@ class Zombie extends Monster{
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 12, "generic");
$this->setName("Zombie");
$this->setSpeed(0.23);
$this->update();
}
public function getArmorValue(){
@ -38,9 +37,9 @@ class Zombie extends Monster{
return 4; //TODO vanillafy(zombies might be able to hold items)
}
public function update(){
public function update($now){
$this->updateBurning();
parent::update();
parent::update($now);
}
public function getDrops(){