mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
Void damage
This commit is contained in:
parent
1976e1c6f6
commit
2011d1d339
@ -87,6 +87,9 @@ class PlayerAPI{
|
|||||||
case "water":
|
case "water":
|
||||||
$message .= " drowned";
|
$message .= " drowned";
|
||||||
break;
|
break;
|
||||||
|
case "void":
|
||||||
|
$message .= " fell out of the world";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$message .= " died";
|
$message .= " died";
|
||||||
break;
|
break;
|
||||||
|
@ -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 > 0){
|
||||||
if(($this->fire % 20) === 0){
|
if(($this->fire % 20) === 0){
|
||||||
$this->harm(1, "burning");
|
$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);
|
$startX = (int) (round($this->x - 0.5) - 1);
|
||||||
$startY = (int) (round($this->y) - 1);
|
$startY = (int) (round($this->y) - 1);
|
||||||
$startZ = (int) (round($this->z - 0.5) - 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);
|
return !isset($this->position) ? false:($round === true ? array_map("floor", $this->position):$this->position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function harm($dmg, $cause = "generic"){
|
public function harm($dmg, $cause = "generic", $force = false){
|
||||||
return $this->setHealth($this->getHealth() - ((int) $dmg), $cause);
|
return $this->setHealth($this->getHealth() - ((int) $dmg), $cause, $force);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHealth($health, $cause = "generic", $force = false){
|
public function setHealth($health, $cause = "generic", $force = false){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user