mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
small fixes
This commit is contained in:
parent
7b66cd0250
commit
ae8c541452
5 changed files with 23 additions and 11 deletions
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
class Pig extends Animal{
|
||||
const TYPE = MOB_PIG;
|
||||
public $pathFinder, $path, $server;
|
||||
public $pathFinder, $pathFound, $path, $server;
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
$this->pathFinder = new AStar($this); //make it before everything else as entity class constructor sends update
|
||||
$this->pathFound = false;
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic");
|
||||
$this->server = ServerAPI::request();
|
||||
|
|
@ -22,10 +23,18 @@ class Pig extends Animal{
|
|||
}
|
||||
|
||||
public function update(){
|
||||
//$start = new MinecraftNode(round($this->x), round($this->y), round($this->z));
|
||||
//$stop = $start->add(5,0,5);
|
||||
//$path = $this->pathFinder->findPath($start, $stop); //allows diagonals, path should be ~5 blocks
|
||||
//var_dump($path);
|
||||
if($this->pathFound && $this->path !== false and count($this->path) > 0){
|
||||
|
||||
}else{
|
||||
//$start = new MinecraftNode(round($this->x), round($this->y), round($this->z));
|
||||
//$stop = $start->add(5,0,5);
|
||||
//$this->path = $this->pathFinder->findPath($start, $stop); //allows diagonals, path should be ~5 blocks
|
||||
//var_dump($this->path);
|
||||
$this->pathFound = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
parent::update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue