mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
ai changes
This commit is contained in:
parent
11b1a09599
commit
0f72601891
9 changed files with 52 additions and 29 deletions
|
|
@ -6,13 +6,10 @@ move methods
|
|||
abstract class Creature extends Living{
|
||||
const CLASS_TYPE = ENTITY_MOB;
|
||||
|
||||
public $pathFinder, $path = null, $currentIndex = 0, $currentNode;
|
||||
|
||||
public $inPanic;
|
||||
|
||||
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
$this->inPanic = false; //force for now
|
||||
$this->pathFinder = new TileNavigator(new MCBlockedProvider(), new MCDiagonalProvider(), new Pythagoras3D(), new ManhattanHeuristic3D());
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 1, "generic");
|
||||
//$this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type));
|
||||
|
|
@ -24,23 +21,6 @@ abstract class Creature extends Living{
|
|||
|
||||
}
|
||||
|
||||
public function update(){
|
||||
if($this->onGround){
|
||||
/*if($this->path === null && $this->pathFinder instanceof ITileNavigator){ // mt_rand(0, 120) === 0){
|
||||
$this->path = $this->pathFinder->navigate(new PathTileXYZ($this->x, $this->y, $this->z, $this->level), new PathTileXYZ($this->x + mt_rand(-10, 10), $this->y, $this->z + mt_rand(-10, 10), $this->level));
|
||||
}
|
||||
if($this->path != null && (is_array($this->path) && count($this->path) <= 0 || $this->currentIndex >= count($this->path))){
|
||||
$this->path = null;
|
||||
$this->currentIndex = 0;
|
||||
$this->currentNode = false;
|
||||
}elseif($this->path != null && ($this->currentNode == false || $this->ai->mobController->moveTo($this->currentNode->x, $this->currentNode->y, $this->currentNode->z) === false)){
|
||||
$this->currentNode = $this->path[$this->currentIndex++];
|
||||
}*/
|
||||
}
|
||||
parent::update();
|
||||
|
||||
}
|
||||
|
||||
public function createSaveData(){
|
||||
$data = parent::createSaveData();
|
||||
$data["State"] = @$this->getState();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue