死亡后自动观战
This commit is contained in:
parent
9364d4dafd
commit
0e1e48363f
@ -2181,6 +2181,18 @@ void Human::OnDie()
|
|||||||
hum->SendGameOver();
|
hum->SendGameOver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (observers_.size() > 1) {
|
||||||
|
std::vector<Human*> exclude_self_observers;
|
||||||
|
for (auto& observer : observers_) {
|
||||||
|
if (observer != this) {
|
||||||
|
exclude_self_observers.push_back(observer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto& observer : exclude_self_observers) {
|
||||||
|
observers_.erase(observer);
|
||||||
|
observer->OnWatcherDie(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
DeadDrop();
|
DeadDrop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3740,3 +3752,17 @@ void Human::DoFollow(int target_id)
|
|||||||
}
|
}
|
||||||
IncFollowTimes();
|
IncFollowTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::OnWatcherDie(Human* watcher)
|
||||||
|
{
|
||||||
|
if (follow_target_ == watcher) {
|
||||||
|
follow_target_ = nullptr;
|
||||||
|
if (socket_handle != 0 && IsPlayer()) {
|
||||||
|
((Player*)this)->AsyncRequestWatchWar(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -269,6 +269,7 @@ class Human : public Creature
|
|||||||
void ProcUseItem(int item_id);
|
void ProcUseItem(int item_id);
|
||||||
void StartRefreshViewTimer();
|
void StartRefreshViewTimer();
|
||||||
void DoFollow(int target_id);
|
void DoFollow(int target_id);
|
||||||
|
void OnWatcherDie(Human* watcher);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
|
@ -122,6 +122,7 @@ class Player : public Human
|
|||||||
void _CMGetBoxInfo(f8::MsgHdr& hdr, const cs::CMGetBoxInfo& msg);
|
void _CMGetBoxInfo(f8::MsgHdr& hdr, const cs::CMGetBoxInfo& msg);
|
||||||
void _CMOpenBox(f8::MsgHdr& hdr, const cs::CMOpenBox& msg);
|
void _CMOpenBox(f8::MsgHdr& hdr, const cs::CMOpenBox& msg);
|
||||||
virtual void SetAttackDir(const a8::Vec2& attack_dir) override;
|
virtual void SetAttackDir(const a8::Vec2& attack_dir) override;
|
||||||
|
void AsyncRequestWatchWar(bool send_rsp_msg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Player();
|
Player();
|
||||||
@ -132,7 +133,6 @@ private:
|
|||||||
void InternalUpdate(int delta_time);
|
void InternalUpdate(int delta_time);
|
||||||
std::vector<std::tuple<int, int, int>>* GetBox(int box_id);
|
std::vector<std::tuple<int, int, int>>* GetBox(int box_id);
|
||||||
void CheckShotHoldState(Weapon* weapon);
|
void CheckShotHoldState(Weapon* weapon);
|
||||||
void AsyncRequestWatchWar(bool send_rsp_msg);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<int, std::vector<std::tuple<int, int, int>>> box_hash_;
|
std::map<int, std::vector<std::tuple<int, int, int>>> box_hash_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user