Level-independient time change

This commit is contained in:
Shoghi Cervantes Pueyo
2013-05-15 21:10:29 +02:00
parent e63677a23d
commit 5ee2cda4a6
4 changed files with 17 additions and 14 deletions

View File

@ -41,6 +41,14 @@ class Level{
$this->name = $name;
}
public function checkThings(){
$now = microtime(true);
$time = $this->startTime + ($now - $this->startCheck) * 20;
if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){
$this->time = $time;
}
}
public function __destruct(){
$this->save();
unset($this->level);
@ -142,11 +150,6 @@ class Level{
$this->startCheck = microtime(true);
}
public function checkThings(){
$now = microtime(true);
$this->time = $this->startTime + ($now - $this->startCheck) * 20;
}
public function getSeed(){
return (int) $this->level->getData("seed");
}