Void damage

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-29 20:01:33 +01:00
parent 1976e1c6f6
commit 2011d1d339
2 changed files with 16 additions and 6 deletions

View File

@ -87,6 +87,9 @@ class PlayerAPI{
case "water":
$message .= " drowned";
break;
case "void":
$message .= " fell out of the world";
break;
default:
$message .= " died";
break;

View File

@ -154,6 +154,17 @@ class Entity extends stdClass{
}
}
}
if($this->dead === true){
$this->fire = 0;
$this->air = 300;
return;
}
if($this->y < -16){
$this->harm(8, "void", true); //4 per second
}
if($this->fire > 0){
if(($this->fire % 20) === 0){
$this->harm(1, "burning");
@ -165,10 +176,6 @@ class Entity extends stdClass{
}
}
if($this->dead === true){
return;
}
$startX = (int) (round($this->x - 0.5) - 1);
$startY = (int) (round($this->y) - 1);
$startZ = (int) (round($this->z - 0.5) - 1);
@ -459,8 +466,8 @@ class Entity extends stdClass{
return !isset($this->position) ? false:($round === true ? array_map("floor", $this->position):$this->position);
}
public function harm($dmg, $cause = "generic"){
return $this->setHealth($this->getHealth() - ((int) $dmg), $cause);
public function harm($dmg, $cause = "generic", $force = false){
return $this->setHealth($this->getHealth() - ((int) $dmg), $cause, $force);
}
public function setHealth($health, $cause = "generic", $force = false){