Updated player deaths

This commit is contained in:
Shoghi Cervantes Pueyo
2012-12-18 21:51:28 +01:00
parent d9c39ca816
commit 4a46fde483
7 changed files with 57 additions and 45 deletions

View File

@ -53,6 +53,18 @@ class EntityAPI{
return $this->server->entities;
}
public function heal($eid, $heal = 1, $cause){
$this->harm($eid, -$heal, $cause);
}
public function harm($eid, $attack = 1, $cause){
$e = $this->get($eid);
if($e === false or $e->dead === true){
return false;
}
$e->setHealth($e->getHealth()-$attack, $cause);
}
public function add($class, $type = 0, $data = array()){
$eid = $this->server->eidCnt++;
$this->server->entities[$eid] = new Entity($this->server, $eid, $class, $type, $data);