mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-25 00:38:08 +00:00
Visual Debugger implementation
This commit is contained in:
@@ -54,7 +54,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
|
||||
auto* presetTarget = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (presetTarget != nullptr) {
|
||||
if (this->m_radius * this->m_radius >= Vector3::DistanceSquared(reference, presetTarget->GetPosition())) {
|
||||
if (this->m_radius * this->m_radius >= NiPoint3::DistanceSquared(reference, presetTarget->GetPosition())) {
|
||||
targets.push_back(presetTarget);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto distance = Vector3::DistanceSquared(reference, entity->GetPosition());
|
||||
const auto distance = NiPoint3::DistanceSquared(reference, entity->GetPosition());
|
||||
|
||||
if (this->m_radius * this->m_radius >= distance && (this->m_maxTargets == 0 || targets.size() < this->m_maxTargets)) {
|
||||
targets.push_back(entity);
|
||||
@@ -98,8 +98,8 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
|
||||
}
|
||||
|
||||
std::sort(targets.begin(), targets.end(), [reference](Entity* a, Entity* b) {
|
||||
const auto aDistance = Vector3::DistanceSquared(a->GetPosition(), reference);
|
||||
const auto bDistance = Vector3::DistanceSquared(b->GetPosition(), reference);
|
||||
const auto aDistance = NiPoint3::DistanceSquared(a->GetPosition(), reference);
|
||||
const auto bDistance = NiPoint3::DistanceSquared(b->GetPosition(), reference);
|
||||
|
||||
return aDistance > bDistance;
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
||||
|
||||
const auto position = entity->GetPosition() + this->m_offset;
|
||||
|
||||
const auto distance = Vector3::Distance(position, other->GetPosition());
|
||||
const auto distance = NiPoint3::Distance(position, other->GetPosition());
|
||||
|
||||
const auto time = distance / this->m_projectileSpeed;
|
||||
|
||||
|
||||
@@ -154,19 +154,19 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
// reference is the position of the caster.
|
||||
// If we cast a ray forward from the caster, does it come within m_farWidth of the target?
|
||||
|
||||
const auto distance = Vector3::Distance(reference, otherPosition);
|
||||
const auto distance = NiPoint3::Distance(reference, otherPosition);
|
||||
|
||||
if (m_method == 2) {
|
||||
NiPoint3 rayPoint = casterPosition + forward * distance;
|
||||
|
||||
if (m_farWidth > 0 && Vector3::DistanceSquared(rayPoint, otherPosition) > this->m_farWidth * this->m_farWidth) {
|
||||
if (m_farWidth > 0 && NiPoint3::DistanceSquared(rayPoint, otherPosition) > this->m_farWidth * this->m_farWidth) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
auto normalized = (reference - otherPosition) / distance;
|
||||
|
||||
const float degreeAngle = std::abs(Vector3::Angle(forward, normalized) * (180 / 3.14) - 180);
|
||||
const float degreeAngle = std::abs(NiPoint3::Angle(forward, normalized) * (180 / 3.14) - 180);
|
||||
|
||||
if (distance >= this->m_minDistance && this->m_maxDistance >= distance && degreeAngle <= 2 * this->m_angle) {
|
||||
targets.push_back(entity);
|
||||
@@ -174,8 +174,8 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
}
|
||||
|
||||
std::sort(targets.begin(), targets.end(), [reference](Entity* a, Entity* b) {
|
||||
const auto aDistance = Vector3::DistanceSquared(reference, a->GetPosition());
|
||||
const auto bDistance = Vector3::DistanceSquared(reference, b->GetPosition());
|
||||
const auto aDistance = NiPoint3::DistanceSquared(reference, a->GetPosition());
|
||||
const auto bDistance = NiPoint3::DistanceSquared(reference, b->GetPosition());
|
||||
|
||||
return aDistance > bDistance;
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
return;
|
||||
}
|
||||
|
||||
const auto distance = Vector3::DistanceSquared(self->GetPosition(), entity->GetPosition());
|
||||
const auto distance = NiPoint3::DistanceSquared(self->GetPosition(), entity->GetPosition());
|
||||
|
||||
if (distance > this->m_range * this->m_range) {
|
||||
success = false;
|
||||
|
||||
Reference in New Issue
Block a user