names were fixed, ->loop->stop();

This commit is contained in:
GameHerobrine 2023-01-04 20:46:17 +03:00
parent 50006a0189
commit f6897cf862
242 changed files with 111 additions and 166 deletions

View file

@ -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());
}

View file

@ -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());
}

View file

@ -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;

View file

@ -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();
}

View 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 = [];
}

View file

@ -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(){

View 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;
}
}