This commit is contained in:
aozhiwei 2023-04-02 16:27:59 +08:00
parent d145ffaa65
commit 6fa87b3c70

View File

@ -802,36 +802,36 @@ bool Bullet::IsFlyHook()
void Bullet::GetHitThings(BulletCheckResult& result) void Bullet::GetHitThings(BulletCheckResult& result)
{ {
room->TraverseEntityList room->grid_service->TraverseObstacles
( (room->GetRoomIdx(),
[this] (Entity* e) GetGridList(),
[this] (Obstacle* ob, bool& stop)
{ {
if (e->IsEntityType(ET_Obstacle)) { #if 1
Obstacle* ob = (Obstacle*)e; #else
if (ob->meta->thing_type() == kObstacleStrengthenWall) { if (ob->meta->thing_type() == kObstacleStrengthenWall) {
if (!strengthened_ && sender.Get() && if (!strengthened_ && sender.Get() &&
sender.Get()->team_id == ob->GetTeamId(room)) { sender.Get()->team_id == ob->GetTeamId(room)) {
bool ret = Collision::Check2dRotationRectangle bool ret = Collision::Check2dRotationRectangle
(GetPos().GetX(), (GetPos().GetX(),
GetPos().GetZ(), GetPos().GetZ(),
gun_meta->bullet_rad(), gun_meta->bullet_rad(),
ob->GetPos().GetX(), ob->GetPos().GetX(),
ob->GetPos().GetZ(), ob->GetPos().GetZ(),
ob->meta->width(), ob->meta->width(),
ob->meta->height(), ob->meta->height(),
ob->GetRotate() * 180.0f ob->GetRotate() * 180.0f
); );
if (ret) { if (ret) {
strengthened_ = true; strengthened_ = true;
OnStrengthen(ob); OnStrengthen(ob);
#ifdef DEBUG #ifdef DEBUG
a8::XPrintf("命中能量墙\n", {}); a8::XPrintf("命中能量墙\n", {});
#endif #endif
}
} }
} }
} }
return true; #endif
}); });
} }