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