1
This commit is contained in:
parent
b6344aa461
commit
da73a1f622
@ -170,7 +170,7 @@ namespace mt
|
||||
std::vector<float> spd_pun_fac_vec;
|
||||
|
||||
int battle_hint_interval = 10;
|
||||
int battle_hint_disappear = 10;
|
||||
int battle_hint_duration = 10;
|
||||
int battle_hint_view_range = 512;
|
||||
int battle_hint_broadcast_range = 800;
|
||||
|
||||
|
@ -2186,13 +2186,37 @@ void Human::SendViewerUiMemberUpdate(std::vector<int> member_ids)
|
||||
void Human::BroadcastBattleHint()
|
||||
{
|
||||
if (room->GetFrameNo() - last_battle_hint_frameno_ >= mt::Param::s().battle_hint_interval) {
|
||||
last_battle_hint_frameno_ = room->GetFrameNo();
|
||||
if (last_battle_hint_uniid_ > 0) {
|
||||
cs::SMDelBattleHint notify_msg;
|
||||
notify_msg.set_uniid(last_battle_hint_uniid_);
|
||||
SendNotifyMsg(notify_msg);
|
||||
if (room->GetFrameNo() - last_battle_hint_frameno_ <
|
||||
mt::Param::s().battle_hint_duration * SERVER_FRAME_RATE + 8) {
|
||||
cs::SMDelBattleHint notify_msg;
|
||||
notify_msg.set_uniid(last_battle_hint_uniid_);
|
||||
SendNotifyMsg(notify_msg);
|
||||
}
|
||||
last_battle_hint_uniid_ = 0;
|
||||
}
|
||||
last_battle_hint_frameno_ = room->GetFrameNo();
|
||||
std::shared_ptr<cs::SMAddBattleHint> notify_msg;
|
||||
room->TraversePlayerList
|
||||
(
|
||||
[this, ¬ify_msg] (Player* hum) -> bool
|
||||
{
|
||||
if (!hum->dead) {
|
||||
float distance = hum->GetPos().Distance2D2(GetPos());
|
||||
if (distance >= mt::Param::s().battle_hint_view_range &&
|
||||
distance <= mt::Param::s().battle_hint_broadcast_range) {
|
||||
if (!notify_msg) {
|
||||
last_battle_hint_uniid_ = room->AllocUniid();
|
||||
notify_msg = std::make_shared<cs::SMAddBattleHint>();
|
||||
notify_msg->set_uniid(last_battle_hint_uniid_);
|
||||
notify_msg->set_duration(mt::Param::s().battle_hint_duration);
|
||||
TypeConvert::ToPb(GetPos(), notify_msg->mutable_pos());
|
||||
}
|
||||
hum->SendNotifyMsg(*notify_msg.get());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user