added painting collision

This commit is contained in:
GameHerobrine 2024-11-26 18:45:29 +03:00
parent 96f4cb6382
commit cb125f5aa2

View file

@ -20,6 +20,7 @@ class Painting extends Entity{
$this->setHealth(1, "generic"); $this->setHealth(1, "generic");
$this->canBeAttacked = true; $this->canBeAttacked = true;
$this->width = 1; $this->width = 1;
$this->setSize(0.5, 0.5);
$this->isStatic = true; $this->isStatic = true;
$mot = $this->data["Motive"] ?? false; $mot = $this->data["Motive"] ?? false;
$dir = $this->data["Direction"] ?? false; $dir = $this->data["Direction"] ?? false;
@ -33,7 +34,7 @@ class Painting extends Entity{
}else{ }else{
$this->motive = $mot; $this->motive = $mot;
$this->direction = $dir; $this->direction = $dir;
//TODO: $this->setDirection($dir);
} }
} }
@ -42,6 +43,7 @@ class Painting extends Entity{
foreach(PaintingItem::$motives as $name => $motive){ foreach(PaintingItem::$motives as $name => $motive){
$this->motive = $name; $this->motive = $name;
$this->setDirection($dir); $this->setDirection($dir);
if($this->survives()){ if($this->survives()){
$tochoose[] = $name; $tochoose[] = $name;
} }
@ -150,6 +152,14 @@ class Painting extends Entity{
} }
} }
} }
$ents = $this->level->getEntitiesInAABBOfType($this->boundingBox, ENTITY_OBJECT);
foreach($ents as $e){
if($e->eid == $this->eid) continue;
if($e->type == OBJECT_PAINTING){
return false;
}
}
return true; return true;
} }