Drops now have starting speed, correct entity motion at spawn

This commit is contained in:
Shoghi Cervantes 2013-05-30 18:55:50 +02:00
parent 09efcec605
commit fc02572065
4 changed files with 13 additions and 11 deletions

View File

@ -298,13 +298,13 @@ class BanAPI{
}
public function kick($username, $reason = "No Reason"){
$this->commandHandler("kick", array($username, $reason));
$this->commandHandler("kick", array($username, $reason), "console", "");
}
public function reload(){
$this->commandHandler("ban", array("reload"));
$this->commandHandler("banip", array("reload"));
$this->commandHandler("whitelist", array("reload"));
$this->commandHandler("ban", array("reload"), "console", "");
$this->commandHandler("banip", array("reload"), "console", "");
$this->commandHandler("whitelist", array("reload"), "console", "");
}
public function isIPBanned($ip){

View File

@ -283,7 +283,7 @@ class BlockAPI{
if(($player->gamemode & 0x01) === 0x00 and count($drops) > 0){
foreach($drops as $drop){
$this->server->api->entity->drop($target, BlockAPI::getItem($drop[0] & 0xFFFF, $drop[1] & 0xFFFF, $drop[2] & 0xFF));
$this->server->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem($drop[0] & 0xFFFF, $drop[1] & 0xFFFF, $drop[2] & 0xFF));
}
}
return false;

View File

@ -107,9 +107,12 @@ class EntityAPI{
return;
}
$data = array(
"x" => $pos->x + mt_rand(2, 8) / 10,
"x" => $pos->x,
"y" => $pos->y + 0.19,
"z" => $pos->z + mt_rand(2, 8) / 10,
"z" => $pos->z,
"speedX" => mt_rand(-2, 2) / 6,
"speedY" => mt_rand(5, 8) / 2,
"speedZ" => mt_rand(-2, 2) / 6,
"item" => $item,
);
if($this->server->api->handle("item.drop", $data) !== false){
@ -117,10 +120,8 @@ class EntityAPI{
$item->count = min($item->getMaxStackSize(), $count);
$count -= $item->count;
$e = $this->add($pos->level, ENTITY_ITEM, $item->getID(), $data);
$e->speedX = mt_rand(-10, 10) / 100;
$e->speedY = mt_rand(0, 5) / 100;
$e->speedZ = mt_rand(-10, 10) / 100;
$this->spawnToAll($pos->level, $e->eid);
$this->server->api->handle("entity.motion", $e);
}
}
}

View File

@ -131,6 +131,7 @@ class Entity extends Position{
$this->size = 1;
break;
}
$this->updateLast();
}
public function getDrops(){
@ -421,7 +422,7 @@ class Entity extends Position{
$this->server->api->handle("entity.motion", $this);
}
}elseif($this->class === ENTITY_PLAYER){
}elseif($this->class === ENTITY_PLAYER and ($this->player instanceof Player)){
if($support === false and ($this->player->gamemode & 0x01) === 0x00){
if($this->fallY === false or $this->fallStart === false){
$this->fallY = $y;