1
This commit is contained in:
parent
996c9316f6
commit
76a4cd945e
@ -3024,7 +3024,7 @@ std::shared_ptr<std::set<int>> Creature::CalcReporterList(const mt::Equip* weapo
|
|||||||
Creature* nearest_hum = nullptr;
|
Creature* nearest_hum = nullptr;
|
||||||
TraverseCreatures
|
TraverseCreatures
|
||||||
(
|
(
|
||||||
[nearest_distance, nearest_hum] (Creature*c, bool& stop) mutable
|
[this, &nearest_distance, &nearest_hum] (Creature* c, bool& stop) mutable
|
||||||
{
|
{
|
||||||
if (!c->IsHuman()) {
|
if (!c->IsHuman()) {
|
||||||
return;
|
return;
|
||||||
@ -3035,7 +3035,7 @@ std::shared_ptr<std::set<int>> Creature::CalcReporterList(const mt::Equip* weapo
|
|||||||
if (c->dead) {
|
if (c->dead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float distance = std::fabs(c->GetPos().GetX() - c->GetPos().GetX()) + std::fabs(c->GetPos().GetZ() - c->GetPos().GetZ());
|
float distance = std::fabs(c->GetPos().GetX() - GetPos().GetX()) + std::fabs(c->GetPos().GetZ() - GetPos().GetZ());
|
||||||
if (c->IsPlayer()) {
|
if (c->IsPlayer()) {
|
||||||
if (c->AsHuman()->socket_handle) {
|
if (c->AsHuman()->socket_handle) {
|
||||||
if (distance < nearest_distance) {
|
if (distance < nearest_distance) {
|
||||||
@ -3043,8 +3043,28 @@ std::shared_ptr<std::set<int>> Creature::CalcReporterList(const mt::Equip* weapo
|
|||||||
nearest_hum = c;
|
nearest_hum = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (c->AsHuman()->HasObserver()) {
|
||||||
|
c->AsHuman()->TraverseObservers
|
||||||
|
(
|
||||||
|
[this, &nearest_distance, &nearest_hum] (Human* hum, bool& stop) mutable
|
||||||
|
{
|
||||||
|
if (!hum->IsPlayer()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hum->socket_handle) {
|
||||||
|
float distance = std::fabs(hum->GetPos().GetX() - GetPos().GetX()) + std::fabs(hum->GetPos().GetZ() - GetPos().GetZ());
|
||||||
|
if (distance < nearest_distance) {
|
||||||
|
nearest_distance = distance;
|
||||||
|
nearest_hum = hum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (nearest_hum) {
|
||||||
|
p = std::make_shared<std::set<int>>();
|
||||||
|
p->insert(nearest_hum->GetUniId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user