mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Better Entity attacking system
This commit is contained in:
parent
52aa57d400
commit
7cf9c03735
@ -681,11 +681,13 @@ class Player{
|
||||
break;
|
||||
}
|
||||
if(isset($this->server->entities[$data["target"]]) and Utils::distance($this->entity->position, $this->server->entities[$data["target"]]->position) <= 8){
|
||||
if($this->handle("player.interact", $data) !== false){
|
||||
console("[DEBUG] EID ".$this->eid." attacked EID ".$data["target"], true, true, 2);
|
||||
if($this->server->difficulty > 0){
|
||||
$this->server->api->entity->harm($data["target"], $this->server->difficulty, $this->eid);
|
||||
}
|
||||
$target = $this->server->api->entity->get($data["target"]);
|
||||
$data["targetentity"] = $target;
|
||||
$data["entity"] = $this->entity;
|
||||
if(($target instanceof Entity) and $target->class === ENTITY_PLAYER and ($this->server->difficulty <= 0 or $target->gamemode === CREATIVE)){
|
||||
break;
|
||||
}elseif($this->handle("player.interact", $data) !== false){
|
||||
$this->server->api->entity->harm($data["target"], $this->server->difficulty, $this->eid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user