1
This commit is contained in:
parent
3788f03363
commit
6caea3ace3
@ -662,6 +662,9 @@ void Human::UpdatePoisoning()
|
||||
|
||||
void Human::SyncAroundPlayers(const char* file, int line, const char* func)
|
||||
{
|
||||
if (a8::HasBitFlag(status, HS_Disable)) {
|
||||
return;
|
||||
}
|
||||
for (auto& cell : grid_list) {
|
||||
for (Human* hum : cell->human_list[room->room_idx]) {
|
||||
hum->AddToNewObjects(this);
|
||||
@ -996,6 +999,11 @@ void Human::RemovePartObjects(Entity* entity)
|
||||
part_objects.erase(entity);
|
||||
}
|
||||
|
||||
void Human::ClearPartObjects()
|
||||
{
|
||||
part_objects.clear();
|
||||
}
|
||||
|
||||
void Human::RemoveObjects(Entity* entity)
|
||||
{
|
||||
del_objects.insert(entity->entity_uniid);
|
||||
|
@ -22,6 +22,7 @@ enum HumanStatus
|
||||
HS_AlreadyShow = 4,
|
||||
HS_AlreadyEquip = 5,
|
||||
HS_AlreadyProcNewBieLogic = 6,
|
||||
HS_ForceDie = 7,
|
||||
HS_End
|
||||
};
|
||||
|
||||
@ -175,6 +176,7 @@ class Human : public MoveableEntity
|
||||
void AddToNewObjects(Entity* entity);
|
||||
void AddToPartObjects(Entity* entity);
|
||||
void RemovePartObjects(Entity* entity);
|
||||
void ClearPartObjects();
|
||||
void RemoveObjects(Entity* entity);
|
||||
void AddOutObjects(Entity* entity);
|
||||
void RemoveOutObjects(Entity* entity);
|
||||
|
@ -1681,15 +1681,7 @@ void Room::SecondRandPoint()
|
||||
|
||||
void Room::NotifyGameStart()
|
||||
{
|
||||
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, HS_Disable)) {
|
||||
DisableHuman(pair.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
ProcDisableHuman();
|
||||
|
||||
cs::SMGameStart msg;
|
||||
for (auto& pair : accountid_hash_) {
|
||||
@ -1732,10 +1724,19 @@ void Room::NotifyGameStart()
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
if (room_type == RT_MidBrid) {
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(SERVER_FRAME_RATE * MetaMgr::Instance()->level1room_shua_robot_min_time,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
#if 0
|
||||
ShuaAndroidTimerFunc();
|
||||
room->ShuaAndroidTimerFunc();
|
||||
#endif
|
||||
DieAndroidTimerFunc();
|
||||
room->DieAndroidTimerFunc();
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1790,13 +1791,17 @@ void Room::DisableHuman(Human* target)
|
||||
if (hum == target) {
|
||||
has_target = true;
|
||||
} else {
|
||||
hum->RemoveOutObjects(target);
|
||||
hum->AddOutObjects(target);
|
||||
}
|
||||
}
|
||||
if (has_target) {
|
||||
cell->human_list[room_idx].erase(target);
|
||||
}
|
||||
}
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->RemovePartObjects(target);
|
||||
}
|
||||
target->ClearPartObjects();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2077,12 +2082,12 @@ void Room::ProcDieAndroid(int die_time, int die_num)
|
||||
break;
|
||||
}
|
||||
if (killer && (rand() % 100 < 70)) {
|
||||
a8::UnSetBitFlag(hum->status, HS_Disable);
|
||||
hum->BeKill(killer->entity_uniid,
|
||||
killer->name,
|
||||
killer->curr_weapon->weapon_id);
|
||||
} else {
|
||||
a8::UnSetBitFlag(hum->status, HS_Disable);
|
||||
a8::SetBitFlag(hum->status, HS_ForceDie);
|
||||
} else {
|
||||
hum->BeKill(VP_SafeArea,
|
||||
"毒圈",
|
||||
VW_SafeArea);
|
||||
@ -2090,6 +2095,8 @@ void Room::ProcDieAndroid(int die_time, int die_num)
|
||||
alive_humans.erase(alive_humans.begin() + i);
|
||||
alive_humans_copy.erase(alive_humans_copy.begin() + i);
|
||||
}
|
||||
a8::UnSetBitFlag(hum->status, HS_Disable);
|
||||
a8::SetBitFlag(hum->status, HS_ForceDie);
|
||||
}
|
||||
++dead_num;
|
||||
break;
|
||||
@ -2190,3 +2197,16 @@ bool Room::HasPlayerInRound(const a8::Vec2& pos, float rad)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Room::ProcDisableHuman()
|
||||
{
|
||||
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, HS_Disable)) {
|
||||
DisableHuman(pair.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,6 +165,7 @@ private:
|
||||
void ProcDieAndroid(int die_time, int die_num);
|
||||
void CheckAutoDie(Human* hum, int autodie_time, int autodie_distance, int check_times);
|
||||
bool HasPlayerInRound(const a8::Vec2& pos, float rad);
|
||||
void ProcDisableHuman();
|
||||
|
||||
private:
|
||||
int elapsed_time_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user