Added item pickup delay

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-30 18:02:13 +01:00
parent 08b67428a0
commit 5096cdcde8
2 changed files with 4 additions and 3 deletions

View file

@ -131,11 +131,12 @@ class Entity extends stdClass{
public function environmentUpdate(){
if($this->class === ENTITY_ITEM){
if((microtime(true) - $this->spawntime) >= 300){
$time = microtime(true);
if(($time - $this->spawntime) >= 300){
$this->close(); //Despawn timer
return false;
}
if($this->server->gamemode === 0){
if($this->server->gamemode === 0 and ($time - $this->spawntime) >= 2){
$player = $this->server->query("SELECT EID FROM entities WHERE class == ".ENTITY_PLAYER." AND abs(x - {$this->x}) <= 1.5 AND abs(y - {$this->y}) <= 1.5 AND abs(z - {$this->z}) <= 1.5 LIMIT 1;", true);
if($player !== true and $player !== false){
if($this->server->api->dhandle("player.pickup", array(