mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
names were fixed, ->loop->stop();
This commit is contained in:
parent
50006a0189
commit
f6897cf862
242 changed files with 111 additions and 166 deletions
|
|
@ -14,6 +14,7 @@ abstract class Animal extends Creature implements Ageable, Breedable{
|
|||
if(isset($this->data["IsBaby"]) && $this->data["IsBaby"] && $this->getAge() >= 0){
|
||||
$this->setAge(-24000);
|
||||
}
|
||||
|
||||
$this->ai->addTask(new TaskTempt());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,11 @@ abstract class Creature extends Living{
|
|||
$this->inPanic = false; //force for now
|
||||
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));
|
||||
if(Entity::$updateOnTick){
|
||||
$this->ai->addTask(new TaskLookAround());
|
||||
$this->ai->addTask(new TaskRandomWalk());
|
||||
$this->ai->addTask(new TaskLookAtPlayer());
|
||||
}
|
||||
// $this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type));
|
||||
$this->ai->addTask(new TaskLookAround());
|
||||
$this->ai->addTask(new TaskRandomWalk());
|
||||
$this->ai->addTask(new TaskLookAtPlayer());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Entity extends Position
|
|||
const TYPE = - 1;
|
||||
const CLASS_TYPE = - 1;
|
||||
|
||||
public static $updateOnTick;
|
||||
public static $updateOnTick, $allowedAI;
|
||||
public $isCollidable;
|
||||
public $canBeAttacked;
|
||||
public $moveTime, $lookTime, $idleTime;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ abstract class Living extends Entity implements Damageable, Pathfindable{
|
|||
}
|
||||
|
||||
public function update(){
|
||||
if($this->idleTime <= 0) {
|
||||
if(Entity::$allowedAI && $this->idleTime <= 0) {
|
||||
$this->ai->updateTasks();
|
||||
}
|
||||
|
||||
|
|
|
|||
14
src/entity/registry/EntityList.php
Normal file
14
src/entity/registry/EntityList.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
class EntityList{
|
||||
public function getEntities(){
|
||||
return $this->entities;
|
||||
}
|
||||
public function addEntity(PropertyEntity $property){
|
||||
$this->entities[$property->getEntityType()] = $property;
|
||||
}
|
||||
public function getEntityFromTypeAndClass($type, $class){
|
||||
return isset($this->entities[$type]) && $this->entities[$type]->getEntityClass() === $class ? $this->entities[$type] : 0;
|
||||
}
|
||||
private $entities = [];
|
||||
}
|
||||
|
|
@ -1,39 +1,6 @@
|
|||
<?php
|
||||
|
||||
class PropertyEntity{
|
||||
private $class,$type,$name;
|
||||
|
||||
function __construct($class, $type, $name){
|
||||
$this->class = $class;
|
||||
$this->type = $type;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getEntityClass(){
|
||||
return $this->class;
|
||||
}
|
||||
public function getEntityType(){
|
||||
return $this->type;
|
||||
}
|
||||
public function getEntityName(){
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
class EntityList{
|
||||
public function getEntities(){
|
||||
return $this->entities;
|
||||
}
|
||||
public function addEntity(PropertyEntity $property){
|
||||
$this->entities[$property->getEntityType()] = $property;
|
||||
}
|
||||
public function getEntityFromTypeAndClass($type, $class){
|
||||
return isset($this->entities[$type]) && $this->entities[$type]->getEntityClass() === $class ? $this->entities[$type] : 0;
|
||||
}
|
||||
private $entities = [];
|
||||
}
|
||||
|
||||
class EntityRegistry{
|
||||
class EntityRegistry{
|
||||
public static $entityList;
|
||||
/*Register all entities*/
|
||||
public static function registerEntities(){
|
||||
21
src/entity/registry/PropertyEntity.php
Normal file
21
src/entity/registry/PropertyEntity.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
class PropertyEntity{
|
||||
private $class,$type,$name;
|
||||
|
||||
function __construct($class, $type, $name){
|
||||
$this->class = $class;
|
||||
$this->type = $type;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getEntityClass(){
|
||||
return $this->class;
|
||||
}
|
||||
public function getEntityType(){
|
||||
return $this->type;
|
||||
}
|
||||
public function getEntityName(){
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue