mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
explosions will damage players
This commit is contained in:
parent
b6ce6e459c
commit
89ee29a30a
1 changed files with 7 additions and 3 deletions
|
|
@ -28,11 +28,16 @@ class Explosion{
|
|||
}
|
||||
|
||||
public function explode(){
|
||||
$radius = 2 * $this->size;
|
||||
$server = ServerAPI::request();
|
||||
if(!Explosion::$enableExplosions){ /*Disable Explosions*/
|
||||
foreach($server->api->entity->getRadius($this->source, $radius) as $entity){
|
||||
$impact = (1 - $this->source->distance($entity) / $radius) * 0.5; //pla>
|
||||
$damage = (int) (($impact * $impact + $impact) * 8 * $this->size + 1);
|
||||
$entity->harm($damage, "explosion");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$server = ServerAPI::request();
|
||||
if($this->size < 0.1 or $server->api->dhandle("entity.explosion", [
|
||||
"level" => $this->level,
|
||||
"source" => $this->source,
|
||||
|
|
@ -76,7 +81,6 @@ class Explosion{
|
|||
|
||||
$send = [];
|
||||
$source = $this->source->floor();
|
||||
$radius = 2 * $this->size;
|
||||
foreach($server->api->entity->getRadius($this->source, $radius) as $entity){
|
||||
$impact = (1 - $this->source->distance($entity) / $radius) * 0.5; //placeholder, 0.7 should be exposure
|
||||
$damage = (int) (($impact * $impact + $impact) * 8 * $this->size + 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue