This commit is contained in:
aozhiwei 2023-04-01 15:46:38 +08:00
parent c421fa1359
commit dec6cf2cb3

View File

@ -67,11 +67,9 @@ void AirRaid::Exec(int airraid_id)
bool AirRaid::GenAirRaidPos(const mt::AirRaid* raid_meta, glm::vec3& center) bool AirRaid::GenAirRaidPos(const mt::AirRaid* raid_meta, glm::vec3& center)
{ {
glm::vec3 dir = GlmHelper::UP; if (!room_->RandomSafeAreaPoint(center)) {
GlmHelper::RotateY(dir, a8::RandAngle()); return false;
float rnd_rad = rand() % std::max(room_->GetGasData().new_area_meta->rad(), 100); }
glm::vec2 v2_center = room_->GetGasData().pos_new + glm::vec2(dir.x, dir.z) * (100.f + rnd_rad);
center = glm::vec3(v2_center.x, 0.0f, v2_center.y);
{ {
std::vector<Player*> humans; std::vector<Player*> humans;
room_->GetAlivePlayers(humans, room_->GetRoomMaxPlayerNum()); room_->GetAlivePlayers(humans, room_->GetRoomMaxPlayerNum());
@ -79,6 +77,8 @@ bool AirRaid::GenAirRaidPos(const mt::AirRaid* raid_meta, glm::vec3& center)
std::random_shuffle(humans.begin(), humans.end()); std::random_shuffle(humans.begin(), humans.end());
for (Human* hum : humans) { for (Human* hum : humans) {
if (!hum->poisoning) { if (!hum->poisoning) {
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
center = hum->GetPos().ToGlmVec3() + dir * (float)(200 + rand() % 500); center = hum->GetPos().ToGlmVec3() + dir * (float)(200 + rand() % 500);
break; break;
} }