mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Some changes.
This commit is contained in:
parent
20c16068ec
commit
d6cc8415dc
30 changed files with 359 additions and 106 deletions
|
|
@ -80,15 +80,15 @@ class Entity extends Position{
|
|||
$this->name = "";
|
||||
$this->tickCounter = 0;
|
||||
$this->server->query("INSERT OR REPLACE INTO entities (EID, level, type, class, health, hasUpdate) VALUES (".$this->eid.", '".$this->level->getName()."', ".$this->type.", ".$this->class.", ".$this->health.", 0);");
|
||||
$this->x = isset($this->data["x"]) ? $this->data["x"]:0;
|
||||
$this->y = isset($this->data["y"]) ? $this->data["y"]:0;
|
||||
$this->z = isset($this->data["z"]) ? $this->data["z"]:0;
|
||||
$this->speedX = isset($this->data["speedX"]) ? $this->data["speedX"]:0;
|
||||
$this->speedY = isset($this->data["speedY"]) ? $this->data["speedY"]:0;
|
||||
$this->speedZ = isset($this->data["speedZ"]) ? $this->data["speedZ"]:0;
|
||||
$this->x = isset($this->data["x"]) ? (float) $this->data["x"]:0;
|
||||
$this->y = isset($this->data["y"]) ? (float) $this->data["y"]:0;
|
||||
$this->z = isset($this->data["z"]) ? (float) $this->data["z"]:0;
|
||||
$this->speedX = isset($this->data["speedX"]) ? (float) $this->data["speedX"]:0;
|
||||
$this->speedY = isset($this->data["speedY"]) ? (float) $this->data["speedY"]:0;
|
||||
$this->speedZ = isset($this->data["speedZ"]) ? (float) $this->data["speedZ"]:0;
|
||||
$this->speed = 0;
|
||||
$this->yaw = isset($this->data["yaw"]) ? $this->data["yaw"]:0;
|
||||
$this->pitch = isset($this->data["pitch"]) ? $this->data["pitch"]:0;
|
||||
$this->yaw = isset($this->data["yaw"]) ? (float) $this->data["yaw"]:0;
|
||||
$this->pitch = isset($this->data["pitch"]) ? (float) $this->data["pitch"]:0;
|
||||
$this->position = array("level" => $this->level, "x" => &$this->x, "y" => &$this->y, "z" => &$this->z, "yaw" => &$this->yaw, "pitch" => &$this->pitch);
|
||||
switch($this->class){
|
||||
case ENTITY_PLAYER:
|
||||
|
|
@ -130,6 +130,9 @@ class Entity extends Position{
|
|||
if($this->type === OBJECT_PAINTING){
|
||||
$this->isStatic = true;
|
||||
}elseif($this->type === OBJECT_PRIMEDTNT){
|
||||
if(!isset($this->data["fuse"])){
|
||||
$this->data["fuse"] = 0;
|
||||
}
|
||||
$this->setHealth(10000000, "generic");
|
||||
$this->server->schedule(5, array($this, "updateFuse"), array(), true);
|
||||
$this->update();
|
||||
|
|
@ -141,6 +144,9 @@ class Entity extends Position{
|
|||
}
|
||||
$this->updateLast();
|
||||
$this->updatePosition();
|
||||
if($this->y < 0 and $this->class !== ENTITY_PLAYER){
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateFuse(){
|
||||
|
|
@ -239,7 +245,7 @@ class Entity extends Position{
|
|||
$time = microtime(true);
|
||||
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true){
|
||||
foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){
|
||||
if($item->spawntime > 0 and ($time - $item->spawntime) >= 0.6){
|
||||
if($item->closed === false and $item->spawntime > 0 and ($time - $item->spawntime) >= 0.6){
|
||||
if((($this->player->gamemode & 0x01) === 1 or $this->player->hasSpace($item->type, $item->meta, $item->stack) === true) and $this->server->api->dhandle("player.pickup", array(
|
||||
"eid" => $this->player->eid,
|
||||
"player" => $this->player,
|
||||
|
|
@ -817,7 +823,7 @@ class Entity extends Position{
|
|||
}
|
||||
|
||||
public function setPosition(Vector3 $pos, $yaw = false, $pitch = false){
|
||||
if($pos instanceof Position and $this->level !== $pos->level){
|
||||
if($pos instanceof Position and $pos->level instanceof Level and $this->level !== $pos->level){
|
||||
$this->level = $pos->level;
|
||||
$this->server->preparedSQL->entity->setLevel->reset();
|
||||
$this->server->preparedSQL->entity->setLevel->clear();
|
||||
|
|
@ -965,7 +971,7 @@ class Entity extends Position{
|
|||
}else{
|
||||
return false; //Entity inmunity
|
||||
}
|
||||
}elseif($health === $this->health){
|
||||
}elseif($health === $this->health and !$this->dead){
|
||||
return false;
|
||||
}
|
||||
if($this->server->api->dhandle("entity.health.change", array("entity" => $this, "eid" => $this->eid, "health" => $health, "cause" => $cause)) !== false or $force === true){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue