mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
fixed non-living entities lingering for a second after being kill()ed
only living entities should have death animation time
This commit is contained in:
parent
0a19a2611a
commit
a245615531
@ -1649,7 +1649,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
if(!$this->isAlive() and $this->spawned){
|
if(!$this->isAlive() and $this->spawned){
|
||||||
$this->deadTicks += $tickDiff;
|
$this->deadTicks += $tickDiff;
|
||||||
if($this->deadTicks >= 20){
|
if($this->deadTicks >= $this->maxDeadTicks){
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -382,6 +382,8 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
public $deadTicks = 0;
|
public $deadTicks = 0;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
|
protected $maxDeadTicks = 0;
|
||||||
|
/** @var int */
|
||||||
protected $age = 0;
|
protected $age = 0;
|
||||||
|
|
||||||
/** @var float */
|
/** @var float */
|
||||||
@ -1260,13 +1262,13 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
|
|
||||||
if(!$this->isAlive()){
|
if(!$this->isAlive()){
|
||||||
$this->deadTicks += $tickDiff;
|
$this->deadTicks += $tickDiff;
|
||||||
if($this->deadTicks >= 20){
|
if($this->deadTicks >= $this->maxDeadTicks){
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
if(!$this->isPlayer){
|
if(!$this->isPlayer){
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->deadTicks < 20;
|
return $this->deadTicks < $this->maxDeadTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,9 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
|
|
||||||
protected $attackTime = 0;
|
protected $attackTime = 0;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
protected $maxDeadTicks = 20;
|
||||||
|
|
||||||
protected $invisible = false;
|
protected $invisible = false;
|
||||||
|
|
||||||
protected $jumpVelocity = 0.42;
|
protected $jumpVelocity = 0.42;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user