diff --git a/server/gameserver/collision.cc b/server/gameserver/collision.cc index f70be1a3..89154058 100644 --- a/server/gameserver/collision.cc +++ b/server/gameserver/collision.cc @@ -9,6 +9,9 @@ #include "obstacle.h" #include "roomobstacle.h" +#include "mt/Map.h" +#include "mt/MapThing.h" + bool Collision::CheckBullet(IBullet* bullet, Creature* c) { return a8::IntersectCylinderCylinder @@ -26,6 +29,20 @@ bool Collision::CheckBullet(IBullet* bullet, Entity* e) if (distance > 300) { return false; } + if (ob->init_args) { + auto wobj = ob->init_args->Get>(0); + return a8::IntersectCylinderCylinder + ( + bullet->GetPos().ToGlmVec3(), bullet->GetHitRadius() * 0.6, 10, + e->GetPos().ToGlmVec3(), std::max(wobj->size.x/2.0f, wobj->size.z/2.0f), 10 + ); + } else { + return a8::IntersectCylinderCylinder + ( + bullet->GetPos().ToGlmVec3(), bullet->GetHitRadius() * 0.6, 10, + e->GetPos().ToGlmVec3(), ob->meta->width(), 10 + ); + } } return false; }