17.空袭,召唤无法生成爆炸物件

This commit is contained in:
aozhiwei 2021-06-17 21:54:15 +08:00
parent 0052468f93
commit ce41c8a051
2 changed files with 16 additions and 7 deletions

View File

@ -3949,6 +3949,7 @@ void Room::AirRaid(int airraid_id)
pos.x, pos.x,
pos.y pos.y
); );
obstacle->Active();
if (obstacle) { if (obstacle) {
} }
#if 1 #if 1

View File

@ -283,21 +283,29 @@ void RoomObstacle::SpecExplosion()
bomb_born_offset = bomb_born_offset * a8::RandEx(1, std::max(2, meta->i->explosion_float())); bomb_born_offset = bomb_born_offset * a8::RandEx(1, std::max(2, meta->i->explosion_float()));
a8::Vec2 bomb_pos = GetPos() + bomb_born_offset; a8::Vec2 bomb_pos = GetPos() + bomb_born_offset;
std::set<Entity*> objects; std::set<Entity*> objects;
Creature* dumy_c = nullptr;
room->grid_service->TraverseAllLayerHumanList room->grid_service->TraverseAllLayerHumanList
( (
room->GetRoomIdx(), room->GetRoomIdx(),
*grid_list_, *grid_list_,
[this, &objects, &bomb_pos] (Human* hum, bool& stop) [this, &objects, &bomb_pos, &dumy_c] (Human* hum, bool& stop)
{ {
if (!dumy_c) {
dumy_c = hum;
}
float distance = (hum->GetPos() - bomb_pos).Norm(); float distance = (hum->GetPos() - bomb_pos).Norm();
if (master.Get()->team_id != hum->team_id && distance < meta->i->damage_dia()) { if ((!master.Get() || master.Get()->team_id != hum->team_id) &&
distance < meta->i->damage_dia()) {
dumy_c = hum;
objects.insert(hum); objects.insert(hum);
} }
}); });
room->frame_event.AddExplosionEx(master, if (dumy_c) {
room->frame_event.AddExplosionEx(dumy_c->GetWeakPtrRef(),
meta->i->thing_id(), meta->i->thing_id(),
bomb_pos, bomb_pos,
meta->i->explosion_effect()); meta->i->explosion_effect());
}
for (auto& target : objects) { for (auto& target : objects) {
switch (target->GetEntityType()) { switch (target->GetEntityType()) {
case ET_Player: case ET_Player: