Changes in Entity events

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-05 18:30:29 +01:00
parent 683c05f206
commit c1aec49ad1
5 changed files with 23 additions and 20 deletions

View file

@ -77,7 +77,7 @@ class Entity extends stdClass{
public function update(){
if($this->class === ENTITY_ITEM and $this->closed === false){
$this->server->api->dhandle("entity.move", $this->eid);
$this->server->api->dhandle("entity.move", $this);
$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.item.pick", array(
@ -163,8 +163,8 @@ class Entity extends stdClass{
public function close(){
if($this->closed === false){
$this->server->query("DELETE FROM entities WHERE EID = ".$this->eid.";");
$this->server->api->dhandle("entity.remove", $this->eid);
$this->server->query("DELETE FROM entities WHERE EID = ".$this.";");
$this->server->api->dhandle("entity.remove", $this);
$this->closed = true;
$this->__destruct();
}