mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Updated player deaths
This commit is contained in:
parent
d9c39ca816
commit
4a46fde483
7 changed files with 57 additions and 45 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue