Human: fix possible bug with food ticking

it updates it but doesn't take note of the updated value, which could cause the code below to be erroneously triggered.
This commit is contained in:
Dylan K. Taylor 2018-05-19 16:47:04 +01:00
parent 2900167ffa
commit 1f73c08762

View File

@ -643,6 +643,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
if($difficulty === Level::DIFFICULTY_PEACEFUL and $this->foodTickTimer % 10 === 0){
if($food < 20){
$this->addFood(1.0);
$food = $this->getFood();
}
if($this->foodTickTimer % 20 === 0 and $health < $this->getMaxHealth()){
$this->heal(new EntityRegainHealthEvent($this, 1, EntityRegainHealthEvent::CAUSE_SATURATION));