From 423ead6b64a3b22672f53a6089378a2f404cac0f Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Fri, 6 Dec 2013 01:49:47 +0100 Subject: [PATCH] Added item pickup animation --- src/world/Entity.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/world/Entity.php b/src/world/Entity.php index d160cc7a..f1fd98ba 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -239,7 +239,7 @@ class Entity extends Position{ $time = microtime(true); if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true){ foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){ - if(($time - $item->spawntime) >= 0.6){ + if($item->spawntime !== -1 and ($time - $item->spawntime) >= 0.6){ if((($this->player->gamemode & 0x01) === 1 or $this->player->hasSpace($item->type, $item->meta, $item->stack) === true) and $this->server->api->dhandle("player.pickup", array( "eid" => $this->player->eid, "player" => $this->player, @@ -248,7 +248,8 @@ class Entity extends Position{ "meta" => $item->meta, "target" => $item->eid )) !== false){ - $item->close(); + $item->spawntime = -1; + $this->server->schedule(15, array($item, "close")); } } }