This commit is contained in:
aozhiwei 2022-08-27 13:19:56 +08:00
parent acdfbeb9ca
commit 5e0c045786
2 changed files with 31 additions and 2 deletions

View File

@ -907,15 +907,38 @@ void RoomObstacle::ActiveMedicalStation()
}
void RoomObstacle::ActivePortal()
{
room->xtimer.AddRepeatTimerAndAttach
(
SERVER_FRAME_RATE,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->ProcPortal();
},
&xtimer_attacher.timer_list_
);
}
void RoomObstacle::ProcPortal()
{
if (room->IsGameOver()) {
return;
}
if (room->IsPveRoom()) {
return;
}
if (!grid_list_) {
grid_list_ = new std::set<GridCell*>();
room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_);
}
bool ready = true;
room->TraversePlayerList
room->TraverseHumanList
(
a8::XParams(),
[this, &ready] (Player* hum, a8::XParams& param)
[this, &ready] (Human* hum, a8::XParams& param)
{
if (!a8::IntersectCircleCircle
(
@ -925,10 +948,15 @@ void RoomObstacle::ActivePortal()
meta->i->height()
)) {
ready = false;
return false;
}
return true;
}
);
if (ready) {
room->GetIncubator()->NextWave();
Die(room);
BroadcastFullState(room);
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
}
}

View File

@ -61,6 +61,7 @@ private:
void ProcKeepRangeBuff();
void DetachFromMaster();
void InstallPreExplostionSummonTimer();
void ProcPortal();
void CalcTempPassObjects();