Better Tile selection & player death check and fix

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-27 23:21:08 +01:00
parent 26fb652c5a
commit 1474d8c785
4 changed files with 46 additions and 16 deletions

View file

@ -551,10 +551,14 @@ class Player{
$this->server->api->dhandle("entity.animate", array("eid" => $this->eid, "action" => $data["action"]));
break;
case MC_RESPAWN:
//$this->entity->invincible = true;
if($this->entity->dead === false){
break;
}
$this->entity->fire = 0;
$this->entity->air = 300;
$this->entity->setPosition($data["x"], $data["y"], $data["z"], 0, 0);
$this->entity->setHealth(20, "respawn");
//$this->entity->invincible = false;
$this->entity->setHealth(20, "respawn");
$this->entity->updateMetadata();
break;
case MC_SET_HEALTH:
if($this->server->gamemode === 1){

View file

@ -30,6 +30,7 @@ define("TILE_SIGN", 0);
class TileEntity extends stdClass{
public $name;
public $normal;
public $id;
public $x;
public $y;
@ -42,6 +43,7 @@ class TileEntity extends stdClass{
private $server;
function __construct(PocketMinecraftServer $server, $id, $class, $x, $y, $z, $data = array()){
$this->server = $server;
$this->normal = true;
$this->class = (int) $class;
$this->data = $data;
$this->closed = false;
@ -54,15 +56,13 @@ class TileEntity extends stdClass{
$this->y = (int) $y;
$this->z = (int) $z;
$this->server->query("INSERT OR REPLACE INTO tileentities (ID, class, x, y, z) VALUES (".$this->id.", ".$this->class.", ".$this->x.", ".$this->y.", ".$this->z.");");
$update = false;
switch($this->class){
case TILE_SIGN:
$this->server->query("UPDATE tileentities SET spawnable = 1 WHERE ID = ".$this->id.";");
break;
}
if($update === true){
$this->server->schedule(40, array($this, "update"), array(), true);
}
//$this->server->schedule(40, array($this, "update"), array(), true);
}
public function update(){