添加救援处理
This commit is contained in:
parent
9578fe6f06
commit
0a1ce78fd6
@ -381,6 +381,9 @@ void Human::Shot(a8::Vec2& target_dir, bool& shot_ok)
|
||||
if (!curr_weapon->meta) {
|
||||
return;
|
||||
}
|
||||
if (downed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (curr_weapon->weapon_idx != 0 &&
|
||||
curr_weapon->ammo <= 0) {
|
||||
@ -1066,7 +1069,8 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
auto downed_func = [] (const a8::XParams& param)
|
||||
auto downed_func =
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
if (!hum->downed) {
|
||||
@ -1114,7 +1118,8 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
||||
}
|
||||
CancelAction();
|
||||
DoGetDown();
|
||||
downed_timer = room->xtimer.AddRepeatTimerAndAttach(
|
||||
downed_timer = room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
@ -1181,6 +1186,9 @@ void Human::RemoveOutObjects(Entity* entity)
|
||||
|
||||
bool Human::HasLiveTeammate()
|
||||
{
|
||||
if (room->GetRoomMode() == kZombieMode) {
|
||||
return true;
|
||||
}
|
||||
if (team_members) {
|
||||
for (auto& hum : *team_members) {
|
||||
if (hum != this && !hum->dead) {
|
||||
@ -1193,6 +1201,10 @@ bool Human::HasLiveTeammate()
|
||||
|
||||
bool Human::HasNoDownedTeammate()
|
||||
{
|
||||
if (room->GetRoomMode() == kZombieMode &&
|
||||
GetRace() == kHumanRace) {
|
||||
return true;
|
||||
}
|
||||
if (team_members) {
|
||||
for (auto& hum : *team_members) {
|
||||
if (hum != this && !hum->dead && !hum->downed) {
|
||||
|
@ -568,7 +568,7 @@ void Room::OnHumanDie(Human* hum)
|
||||
{
|
||||
if (GetRoomMode() == kZombieMode) {
|
||||
if (hum->GetRace() == kHumanRace) {
|
||||
|
||||
RemoveRescue(hum);
|
||||
} else if (hum->GetRace() == kZombieRace) {
|
||||
} else {
|
||||
abort();
|
||||
@ -3110,6 +3110,16 @@ void Room::FillObjectPositions(Human* hum, cs::SMUpdate& msg)
|
||||
}
|
||||
}
|
||||
|
||||
void Room::RemoveRescue(Human* hum)
|
||||
{
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second != hum && pair.second->action_type == AT_Relive &&
|
||||
pair.second->action_target_id == hum->GetEntityUniId()) {
|
||||
pair.second->CancelAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t Room::GetRoomMaxPlayerNum()
|
||||
{
|
||||
if (room_mode_ == kZombieMode) {
|
||||
|
@ -134,6 +134,7 @@ public:
|
||||
void AdjustPosInnerMap(a8::Vec2& pos, float radius);
|
||||
bool IsMiniRoom();
|
||||
void FillObjectPositions(Human* hum, cs::SMUpdate& msg);
|
||||
void RemoveRescue(Human* hum);
|
||||
|
||||
private:
|
||||
int AllocUniid();
|
||||
|
Loading…
x
Reference in New Issue
Block a user