From c8dd85de7532134ae2ea01082a65565ea5543892 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 7 Sep 2013 11:55:14 +0200 Subject: [PATCH] Better fuse calculation --- src/world/Entity.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/world/Entity.php b/src/world/Entity.php index 25ff2d545..89f0b146e 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -148,9 +148,8 @@ class Entity extends Position{ return false; } if($this->type === OBJECT_PRIMEDTNT){ - $this->data["fuse"] -= 5; $this->updateMetadata(); - if($this->data["fuse"] <= 0){ + if(((microtime(true) - $this->spawntime) * 20) >= $this->data["fuse"]){ $this->close(); $explosion = new Explosion($this, $this->data["power"]); $explosion->explode(); @@ -607,7 +606,7 @@ class Entity extends Position{ } $d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 4) | ($this->data["Color"] & 0x0F); }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){ if($this->player->isSleeping !== false){ $d[16]["value"] = 2;