Fall damage is now working

This commit is contained in:
Shoghi Cervantes
2014-07-10 16:16:11 +02:00
parent c9535162bd
commit 828f7f1590
5 changed files with 59 additions and 34 deletions

View File

@ -64,12 +64,12 @@ abstract class Living extends Entity implements Damageable{
$pk->event = 2; //Ouch!
Server::broadcastPacket($this->hasSpawned, $pk);
$this->setLastDamageCause($source);
$motion = new Vector3(0, 0.25, 0);
$motion = new Vector3(0, 0, 0);
if($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
$deltaX = $this->x - $e->x;
$deltaZ = $this->z - $e->z;
$yaw = atan2($deltaX, $deltaZ);
$yaw = atan2($deltaX, $deltaZ);
$motion->x = sin($yaw) * 0.5;
$motion->z = cos($yaw) * 0.5;
}