Better fuse calculation

This commit is contained in:
Shoghi Cervantes 2013-09-07 11:55:14 +02:00
parent a00375b1a9
commit c8dd85de75

View File

@ -148,9 +148,8 @@ class Entity extends Position{
return false; return false;
} }
if($this->type === OBJECT_PRIMEDTNT){ if($this->type === OBJECT_PRIMEDTNT){
$this->data["fuse"] -= 5;
$this->updateMetadata(); $this->updateMetadata();
if($this->data["fuse"] <= 0){ if(((microtime(true) - $this->spawntime) * 20) >= $this->data["fuse"]){
$this->close(); $this->close();
$explosion = new Explosion($this, $this->data["power"]); $explosion = new Explosion($this, $this->data["power"]);
$explosion->explode(); $explosion->explode();
@ -607,7 +606,7 @@ class Entity extends Position{
} }
$d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 4) | ($this->data["Color"] & 0x0F); $d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 4) | ($this->data["Color"] & 0x0F);
}elseif($this->type === OBJECT_PRIMEDTNT){ }elseif($this->type === OBJECT_PRIMEDTNT){
$d[16]["value"] = $this->data["fuse"]; $d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
}elseif($this->class === ENTITY_PLAYER){ }elseif($this->class === ENTITY_PLAYER){
if($this->player->isSleeping !== false){ if($this->player->isSleeping !== false){
$d[16]["value"] = 2; $d[16]["value"] = 2;