Skip to content

Commit

Permalink
Fixed entities being updated when they shouldn't
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Jun 5, 2013
1 parent 2dd188a commit a5bc95e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/API/EntityAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function init(){

public function updateEntities(){
$l = $this->server->query("SELECT EID FROM entities WHERE hasUpdate = 1;");
$this->server->query("UPDATE entities SET hasUpdate = 0;");
if($l !== false and $l !== true){
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
$e = $this->get($e["EID"]);
Expand Down Expand Up @@ -128,9 +129,9 @@ public function drop(Position $pos, Item $item){
"x" => $pos->x,
"y" => $pos->y + 0.19,
"z" => $pos->z,
"speedX" => mt_rand(-3, 3) / 8,
"speedY" => mt_rand(5, 8) / 1.5,
"speedZ" => mt_rand(-3, 3) / 8,
//"speedX" => mt_rand(-3, 3) / 8,
"speedY" => mt_rand(5, 8) / 2,
//"speedZ" => mt_rand(-3, 3) / 8,
"item" => $item,
);
if($this->server->api->handle("item.drop", $data) !== false){
Expand Down
4 changes: 0 additions & 4 deletions src/PocketMinecraftServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,7 @@ public function schedule($ticks, callable $callback, $data = array(), $repeat =
if(!is_callable($callback)){
return false;
}
$add = "";
$chcnt = $this->scheduleCnt++;
if($repeat === false){
$add = '$this->schedule['.$chcnt.']=null;unset($this->schedule['.$chcnt.']);';
}
$this->schedule[$chcnt] = array($callback, $data, $eventName);
$this->query("INSERT INTO actions (ID, interval, last, repeat) VALUES(".$chcnt.", ".($ticks / 20).", ".microtime(true).", ".(((bool) $repeat) === true ? 1:0).");");
return $chcnt;
Expand Down

0 comments on commit a5bc95e

Please sign in to comment.