mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-13 02:04:20 +00:00
fix: buggy hitboxes during ag foot race (#1993)
* physics fixes * check ptr
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
#include "Amf3.h"
|
||||
#include "dpShapeSphere.h"
|
||||
|
||||
const std::unordered_set<LWOOBJID> ProximityMonitorComponent::m_EmptyObjectSet = {};
|
||||
|
||||
@@ -12,6 +14,7 @@ ProximityMonitorComponent::ProximityMonitorComponent(Entity* parent, const int32
|
||||
SetProximityRadius(radiusSmall, "rocketSmall");
|
||||
SetProximityRadius(radiusLarge, "rocketLarge");
|
||||
}
|
||||
RegisterMsg(&ProximityMonitorComponent::OnGetObjectReportInfo);
|
||||
}
|
||||
|
||||
ProximityMonitorComponent::~ProximityMonitorComponent() {
|
||||
@@ -60,6 +63,31 @@ bool ProximityMonitorComponent::IsInProximity(const std::string& name, LWOOBJID
|
||||
return collisions.contains(objectID);
|
||||
}
|
||||
|
||||
bool ProximityMonitorComponent::OnGetObjectReportInfo(GameMessages::GetObjectReportInfo& reportInfo) {
|
||||
auto& proxInfo = reportInfo.info->PushDebug("Proximity Monitor");
|
||||
for (const auto& [name, entity] : m_ProximitiesData) {
|
||||
if (!entity) continue;
|
||||
auto& proxAmf = proxInfo.PushDebug(name);
|
||||
const auto* const shape = entity->GetShape();
|
||||
if (shape && shape->GetShapeType() == dpShapeType::Sphere) {
|
||||
const auto* const sphere = static_cast<const dpShapeSphere*>(shape);
|
||||
proxAmf.PushDebug<AMFDoubleValue>("Radius") = sphere->GetRadius();
|
||||
}
|
||||
proxAmf.PushDebug<AMFBoolValue>("Sleeping") = entity->GetSleeping();
|
||||
proxAmf.PushDebug<AMFDoubleValue>("Scale") = entity->GetScale();
|
||||
proxAmf.PushDebug<AMFBoolValue>("Gargantuan") = entity->GetIsGargantuan();
|
||||
proxAmf.PushDebug<AMFBoolValue>("Static") = entity->GetIsStatic();
|
||||
proxAmf.PushDebug("Position").PushDebug(entity->GetPosition());
|
||||
proxAmf.PushDebug("Rotation").PushDebug(entity->GetRotation());
|
||||
auto& collidingAmf = proxAmf.PushDebug("Colliding Objects");
|
||||
for (const auto& colliding : entity->GetCurrentlyCollidingObjects()) {
|
||||
collidingAmf.PushDebug(std::to_string(colliding));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::Update(float deltaTime) {
|
||||
for (const auto& prox : m_ProximitiesData) {
|
||||
if (!prox.second) continue;
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
bool OnGetObjectReportInfo(GameMessages::GetObjectReportInfo& reportInfo);
|
||||
/**
|
||||
* All the proximity sensors for this component, indexed by name
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user