From cb125f5aa27062d55573e22ad148c3f7e3c560d3 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Tue, 26 Nov 2024 18:45:29 +0300 Subject: [PATCH] added painting collision --- src/entity/object/Painting.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/entity/object/Painting.php b/src/entity/object/Painting.php index f6618f38..06d6d065 100644 --- a/src/entity/object/Painting.php +++ b/src/entity/object/Painting.php @@ -20,6 +20,7 @@ class Painting extends Entity{ $this->setHealth(1, "generic"); $this->canBeAttacked = true; $this->width = 1; + $this->setSize(0.5, 0.5); $this->isStatic = true; $mot = $this->data["Motive"] ?? false; $dir = $this->data["Direction"] ?? false; @@ -33,7 +34,7 @@ class Painting extends Entity{ }else{ $this->motive = $mot; $this->direction = $dir; - //TODO: + $this->setDirection($dir); } } @@ -42,6 +43,7 @@ class Painting extends Entity{ foreach(PaintingItem::$motives as $name => $motive){ $this->motive = $name; $this->setDirection($dir); + if($this->survives()){ $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; }