This commit is contained in:
aozhiwei 2023-06-03 21:53:24 +08:00
parent c749f886ff
commit e544573967
3 changed files with 1 additions and 95 deletions

View File

@ -228,7 +228,7 @@ void Incubator::AutoAllocAndroid()
case GasWaiting: case GasWaiting:
case GasMoving: case GasMoving:
{ {
if (!hold_humans_.empty()){ if (!hold_humans_.empty() && room->AliveCount() > 6) {
Human* hum = hold_humans_[0]; Human* hum = hold_humans_[0];
if (room->GetGasData().GetGasMode() == GasWaiting && if (room->GetGasData().GetGasMode() == GasWaiting &&
hold_humans_.size() > 1 && hold_humans_.size() > 1 &&

View File

@ -2272,29 +2272,6 @@ bool Room::HasPlayerInRound(const glm::vec3& pos, float rad)
return false; return false;
} }
void Room::ProcDisableHuman()
{
#if 1
for (auto& pair : human_hash_) {
if (pair.second->IsAndroid() &&
pair.second->team_uuid.empty() &&
!a8::HasBitFlag(pair.second->status, CS_Disable)) {
DisableHuman(pair.second);
}
}
#else
if (room_type_ == RT_NewBrid || room_type_ == RT_MidBrid) {
for (auto& pair : human_hash_) {
if (pair.second->IsAndroid() &&
pair.second->team_uuid.empty() &&
!a8::HasBitFlag(pair.second->status, CS_Disable)) {
DisableHuman(pair.second);
}
}
}
#endif
}
void Room::CheckPartObjects(Human* testa, Human* testb) void Room::CheckPartObjects(Human* testa, Human* testb)
{ {
#if 0 #if 0
@ -2340,73 +2317,6 @@ void Room::CheckPartObjects(Human* testa, Human* testb)
#endif #endif
} }
void Room::GetAliveHumans(std::vector<Human*>& alive_humans, size_t num, Human* exclude_hum)
{
alive_humans.reserve(num);
{
if (GetFrameNo() % 8 < 5) {
for (auto itr = human_hash_.begin(); itr != human_hash_.end(); ++itr) {
if (itr->second == exclude_hum) {
continue;
}
CheckAliveHuman(itr->second, alive_humans);
if (alive_humans.size() > num) {
break;
}
}
} else {
for (auto itr = human_hash_.rbegin(); itr != human_hash_.rend(); ++itr) {
if (itr->second == exclude_hum) {
continue;
}
CheckAliveHuman(itr->second, alive_humans);
if (alive_humans.size() > num) {
break;
}
}
}
}
}
void Room::GetCanAutoDieHumans(std::vector<Human*>& alive_humans, size_t num, Human* exclude_hum)
{
alive_humans.reserve(num);
{
if (GetFrameNo() % 8 < 5) {
for (auto itr = human_hash_.begin(); itr != human_hash_.end(); ++itr) {
if (itr->second == exclude_hum) {
continue;
}
CheckAliveHuman(itr->second, alive_humans);
if (alive_humans.size() > num) {
break;
}
}
} else {
for (auto itr = human_hash_.rbegin(); itr != human_hash_.rend(); ++itr) {
if (itr->second == exclude_hum) {
continue;
}
CheckAliveHuman(itr->second, alive_humans);
if (alive_humans.size() > num) {
break;
}
}
}
}
}
void Room::CheckAliveHuman(Human* hum, std::vector<Human*>& alive_humans)
{
if (hum->IsAndroid() &&
!hum->real_dead &&
hum->team_uuid.empty() &&
a8::HasBitFlag(hum->status, CS_Disable) &&
!HasPlayerInRound(hum->GetPos().ToGlmVec3(), VIEW_RANGE)) {
alive_humans.push_back(hum);
}
}
bool Room::RuningInTimer() bool Room::RuningInTimer()
{ {
return xtimer.IsRunning(); return xtimer.IsRunning();

View File

@ -289,10 +289,6 @@ private:
void EnableHuman(Human* hum); void EnableHuman(Human* hum);
void DisableHuman(Human* hum); void DisableHuman(Human* hum);
bool HasPlayerInRound(const glm::vec3& pos, float rad); bool HasPlayerInRound(const glm::vec3& pos, float rad);
void ProcDisableHuman();
void GetAliveHumans(std::vector<Human*>& alive_humans, size_t num, Human* exclude_hum);
void GetCanAutoDieHumans(std::vector<Human*>& alive_humans, size_t num, Human* exclude_hum);
void CheckAliveHuman(Human* hum, std::vector<Human*>& alive_humans);
void AddToEntityHash(Entity* entity); void AddToEntityHash(Entity* entity);
void AddToHumanHash(Human* hum); void AddToHumanHash(Human* hum);