mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
feat: debug for all physics components and fix inspect by ldf key (#1848)
This commit is contained in:
@@ -281,6 +281,8 @@ std::vector<Entity*> EntityManager::GetEntitiesByComponent(const eReplicaCompone
|
||||
|
||||
withComp.push_back(entity);
|
||||
}
|
||||
} else {
|
||||
for (auto* const entity : m_Entities | std::views::values) withComp.push_back(entity);
|
||||
}
|
||||
return withComp;
|
||||
}
|
||||
|
@@ -14,8 +14,12 @@
|
||||
#include "dZoneManager.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "eStateChangeType.h"
|
||||
#include "StringifiedEnum.h"
|
||||
#include "Amf3.h"
|
||||
|
||||
ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity, int32_t componentId) : PhysicsComponent(entity, componentId) {
|
||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &ControllablePhysicsComponent::OnGetObjectReportInfo);
|
||||
|
||||
m_Velocity = {};
|
||||
m_AngularVelocity = {};
|
||||
m_InJetpackMode = false;
|
||||
@@ -354,3 +358,55 @@ void ControllablePhysicsComponent::SetStunImmunity(
|
||||
bImmuneToStunUseItem
|
||||
);
|
||||
}
|
||||
|
||||
bool ControllablePhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
|
||||
PhysicsComponent::OnGetObjectReportInfo(msg);
|
||||
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
|
||||
auto& info = reportInfo.subCategory->PushDebug("Controllable Info");
|
||||
|
||||
auto& vel = info.PushDebug("Velocity");
|
||||
vel.PushDebug<AMFDoubleValue>("x") = m_Velocity.x;
|
||||
vel.PushDebug<AMFDoubleValue>("y") = m_Velocity.y;
|
||||
vel.PushDebug<AMFDoubleValue>("z") = m_Velocity.z;
|
||||
|
||||
auto& angularVelocity = info.PushDebug("Angular Velocity");
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("x") = m_AngularVelocity.x;
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("y") = m_AngularVelocity.y;
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("z") = m_AngularVelocity.z;
|
||||
|
||||
info.PushDebug<AMFBoolValue>("Is On Ground") = m_IsOnGround;
|
||||
info.PushDebug<AMFBoolValue>("Is On Rail") = m_IsOnRail;
|
||||
info.PushDebug<AMFBoolValue>("Is In Jetpack Mode") = m_InJetpackMode;
|
||||
info.PushDebug<AMFBoolValue>("Is Jetpack Flying") = m_JetpackFlying;
|
||||
info.PushDebug<AMFBoolValue>("Is Bypassing Jetpack Checks") = m_JetpackBypassChecks;
|
||||
info.PushDebug<AMFIntValue>("Jetpack Effect ID") = m_JetpackEffectID;
|
||||
info.PushDebug<AMFDoubleValue>("Speed Multiplier") = m_SpeedMultiplier;
|
||||
info.PushDebug<AMFDoubleValue>("Gravity Scale") = m_GravityScale;
|
||||
info.PushDebug<AMFBoolValue>("Is Static") = m_Static;
|
||||
|
||||
auto& pickupRadii = info.PushDebug("Active Pickup Radius Scales");
|
||||
for (const auto& scale : m_ActivePickupRadiusScales) {
|
||||
pickupRadii.PushDebug<AMFStringValue>(std::to_string(scale)) = "";
|
||||
}
|
||||
|
||||
info.PushDebug<AMFDoubleValue>("Largest Pickup Radius") = m_PickupRadius;
|
||||
info.PushDebug<AMFBoolValue>("Is Teleporting") = m_IsTeleporting;
|
||||
|
||||
auto& activeSpeedBoosts = info.PushDebug("Active Speed Boosts");
|
||||
for (const auto& boost : m_ActiveSpeedBoosts) {
|
||||
activeSpeedBoosts.PushDebug<AMFStringValue>(std::to_string(boost)) = "";
|
||||
}
|
||||
|
||||
info.PushDebug<AMFDoubleValue>("Speed Boost") = m_SpeedBoost;
|
||||
info.PushDebug<AMFBoolValue>("Is In Bubble") = m_IsInBubble;
|
||||
info.PushDebug<AMFStringValue>("Bubble Type") = StringifiedEnum::ToString(m_BubbleType).data();
|
||||
info.PushDebug<AMFBoolValue>("Special Anims") = m_SpecialAnims;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun Attack Count") = m_ImmuneToStunAttackCount;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun Equip Count") = m_ImmuneToStunEquipCount;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun Interact Count") = m_ImmuneToStunInteractCount;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun Jump Count") = m_ImmuneToStunJumpCount;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun Move Count") = m_ImmuneToStunMoveCount;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun Turn Count") = m_ImmuneToStunTurnCount;
|
||||
info.PushDebug<AMFIntValue>("Immune To Stun UseItem Count") = m_ImmuneToStunUseItemCount;
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,16 +1,18 @@
|
||||
#ifndef CONTROLLABLEPHYSICSCOMPONENT_H
|
||||
#define CONTROLLABLEPHYSICSCOMPONENT_H
|
||||
|
||||
#include "PhysicsComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "dCommonVars.h"
|
||||
#include "RakNetTypes.h"
|
||||
#include "NiPoint3.h"
|
||||
#include "NiQuaternion.h"
|
||||
#include "tinyxml2.h"
|
||||
#include "PhysicsComponent.h"
|
||||
#include "dpCollisionChecks.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "eBubbleType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
namespace tinyxml2 {
|
||||
class XMLDocument;
|
||||
}
|
||||
|
||||
class Entity;
|
||||
class dpEntity;
|
||||
@@ -281,6 +283,8 @@ public:
|
||||
const bool GetImmuneToStunUseItem() { return m_ImmuneToStunUseItemCount > 0;};
|
||||
|
||||
private:
|
||||
|
||||
bool OnGetObjectReportInfo(GameMessages::GameMsg& msg);
|
||||
/**
|
||||
* The entity that owns this component
|
||||
*/
|
||||
@@ -374,7 +378,7 @@ private:
|
||||
/**
|
||||
* The active speed boost for this entity
|
||||
*/
|
||||
float m_SpeedBoost;
|
||||
float m_SpeedBoost = 500.0f;
|
||||
|
||||
/*
|
||||
* If Bubble info is dirty
|
||||
|
@@ -1,7 +1,10 @@
|
||||
#include "HavokVehiclePhysicsComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Amf3.h"
|
||||
|
||||
HavokVehiclePhysicsComponent::HavokVehiclePhysicsComponent(Entity* parent, int32_t componentId) : PhysicsComponent(parent, componentId) {
|
||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &HavokVehiclePhysicsComponent::OnGetObjectReportInfo);
|
||||
|
||||
m_Velocity = NiPoint3Constant::ZERO;
|
||||
m_AngularVelocity = NiPoint3Constant::ZERO;
|
||||
m_IsOnGround = true;
|
||||
@@ -98,3 +101,34 @@ void HavokVehiclePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bo
|
||||
|
||||
outBitStream.Write0();
|
||||
}
|
||||
|
||||
bool HavokVehiclePhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
|
||||
PhysicsComponent::OnGetObjectReportInfo(msg);
|
||||
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
|
||||
if (!reportInfo.subCategory) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& info = reportInfo.subCategory->PushDebug("Havok Vehicle Physics Info");
|
||||
|
||||
auto& velocity = info.PushDebug("Velocity");
|
||||
velocity.PushDebug<AMFDoubleValue>("x") = m_Velocity.x;
|
||||
velocity.PushDebug<AMFDoubleValue>("y") = m_Velocity.y;
|
||||
velocity.PushDebug<AMFDoubleValue>("z") = m_Velocity.z;
|
||||
|
||||
auto& angularVelocity = info.PushDebug("Angular Velocity");
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("x") = m_AngularVelocity.x;
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("y") = m_AngularVelocity.y;
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("z") = m_AngularVelocity.z;
|
||||
|
||||
info.PushDebug<AMFBoolValue>("Is On Ground") = m_IsOnGround;
|
||||
info.PushDebug<AMFBoolValue>("Is On Rail") = m_IsOnRail;
|
||||
info.PushDebug<AMFIntValue>("End Behavior") = m_EndBehavior;
|
||||
|
||||
auto& remoteInputInfo = info.PushDebug("Remote Input Info");
|
||||
remoteInputInfo.PushDebug<AMFDoubleValue>("Remote Input X") = m_RemoteInputInfo.m_RemoteInputX;
|
||||
remoteInputInfo.PushDebug<AMFDoubleValue>("Remote Input Y") = m_RemoteInputInfo.m_RemoteInputY;
|
||||
remoteInputInfo.PushDebug<AMFBoolValue>("Is Powersliding") = m_RemoteInputInfo.m_IsPowersliding;
|
||||
remoteInputInfo.PushDebug<AMFBoolValue>("Is Modified") = m_RemoteInputInfo.m_IsModified;
|
||||
return true;
|
||||
}
|
||||
|
@@ -68,6 +68,8 @@ public:
|
||||
void SetRemoteInputInfo(const RemoteInputInfo&);
|
||||
|
||||
private:
|
||||
bool OnGetObjectReportInfo(GameMessages::GameMsg& msg);
|
||||
|
||||
NiPoint3 m_Velocity;
|
||||
NiPoint3 m_AngularVelocity;
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
#include "dServer.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "Amf3.h"
|
||||
|
||||
#include "dpWorld.h"
|
||||
#include "dpEntity.h"
|
||||
@@ -28,6 +29,8 @@
|
||||
#include "dpShapeSphere.h"
|
||||
|
||||
PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent, int32_t componentId) : PhysicsComponent(parent, componentId) {
|
||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &PhantomPhysicsComponent::OnGetObjectReportInfo);
|
||||
|
||||
m_Position = m_Parent->GetDefaultPosition();
|
||||
m_Rotation = m_Parent->GetDefaultRotation();
|
||||
m_Scale = m_Parent->GetDefaultScale();
|
||||
@@ -238,3 +241,43 @@ void PhantomPhysicsComponent::SetRotation(const NiQuaternion& rot) {
|
||||
PhysicsComponent::SetRotation(rot);
|
||||
if (m_dpEntity) m_dpEntity->SetRotation(rot);
|
||||
}
|
||||
|
||||
bool PhantomPhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
|
||||
PhysicsComponent::OnGetObjectReportInfo(msg);
|
||||
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
|
||||
if (!reportInfo.subCategory) {
|
||||
return false;
|
||||
}
|
||||
auto& info = reportInfo.subCategory->PushDebug("Phantom Physics Info");
|
||||
info.PushDebug<AMFDoubleValue>("Scale") = m_Scale;
|
||||
info.PushDebug<AMFBoolValue>("Is Physics Effect Active") = m_IsPhysicsEffectActive;
|
||||
info.PushDebug<AMFIntValue>("Effect Type") = static_cast<int>(m_EffectType);
|
||||
info.PushDebug<AMFDoubleValue>("Directional Multiplier") = m_DirectionalMultiplier;
|
||||
info.PushDebug<AMFBoolValue>("Is Directional") = m_IsDirectional;
|
||||
auto& direction = info.PushDebug("Direction");
|
||||
direction.PushDebug<AMFDoubleValue>("x") = m_Direction.x;
|
||||
direction.PushDebug<AMFDoubleValue>("y") = m_Direction.y;
|
||||
direction.PushDebug<AMFDoubleValue>("z") = m_Direction.z;
|
||||
|
||||
if (m_MinMax) {
|
||||
auto& minMaxInfo = info.PushDebug("Min Max Info");
|
||||
minMaxInfo.PushDebug<AMFIntValue>("Min") = m_Min;
|
||||
minMaxInfo.PushDebug<AMFIntValue>("Max") = m_Max;
|
||||
}
|
||||
|
||||
if (m_IsRespawnVolume) {
|
||||
auto& respawnInfo = info.PushDebug("Respawn Info");
|
||||
respawnInfo.PushDebug<AMFBoolValue>("Is Respawn Volume") = m_IsRespawnVolume;
|
||||
auto& respawnPos = respawnInfo.PushDebug("Respawn Position");
|
||||
respawnPos.PushDebug<AMFDoubleValue>("x") = m_RespawnPos.x;
|
||||
respawnPos.PushDebug<AMFDoubleValue>("y") = m_RespawnPos.y;
|
||||
respawnPos.PushDebug<AMFDoubleValue>("z") = m_RespawnPos.z;
|
||||
auto& respawnRot = respawnInfo.PushDebug("Respawn Rotation");
|
||||
respawnRot.PushDebug<AMFDoubleValue>("w") = m_RespawnRot.w;
|
||||
respawnRot.PushDebug<AMFDoubleValue>("x") = m_RespawnRot.x;
|
||||
respawnRot.PushDebug<AMFDoubleValue>("y") = m_RespawnRot.y;
|
||||
respawnRot.PushDebug<AMFDoubleValue>("z") = m_RespawnRot.z;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -9,8 +9,6 @@
|
||||
#include "NiQuaternion.h"
|
||||
#include "BitStream.h"
|
||||
#include <vector>
|
||||
#include "CppScripts.h"
|
||||
#include "InvalidScript.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "PhysicsComponent.h"
|
||||
|
||||
@@ -118,6 +116,8 @@ public:
|
||||
void SetMax(uint32_t max);
|
||||
|
||||
private:
|
||||
bool OnGetObjectReportInfo(GameMessages::GameMsg& msg);
|
||||
|
||||
/**
|
||||
* A scale to apply to the size of the physics object
|
||||
*/
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "dpShapeSphere.h"
|
||||
|
||||
#include "EntityInfo.h"
|
||||
#include "Amf3.h"
|
||||
|
||||
PhysicsComponent::PhysicsComponent(Entity* parent, int32_t componentId) : Component(parent) {
|
||||
m_Position = NiPoint3Constant::ZERO;
|
||||
@@ -243,3 +244,24 @@ void PhysicsComponent::SpawnVertices(dpEntity* entity) const {
|
||||
Game::entityManager->ConstructEntity(newEntity);
|
||||
}
|
||||
}
|
||||
|
||||
bool PhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
|
||||
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
|
||||
auto& info = reportInfo.info->PushDebug("Physics");
|
||||
reportInfo.subCategory = &info;
|
||||
|
||||
auto& pos = info.PushDebug("Position");
|
||||
pos.PushDebug<AMFDoubleValue>("x") = m_Position.x;
|
||||
pos.PushDebug<AMFDoubleValue>("y") = m_Position.y;
|
||||
pos.PushDebug<AMFDoubleValue>("z") = m_Position.z;
|
||||
|
||||
auto& rot = info.PushDebug("Rotation");
|
||||
rot.PushDebug<AMFDoubleValue>("w") = m_Rotation.w;
|
||||
rot.PushDebug<AMFDoubleValue>("x") = m_Rotation.x;
|
||||
rot.PushDebug<AMFDoubleValue>("y") = m_Rotation.y;
|
||||
rot.PushDebug<AMFDoubleValue>("z") = m_Rotation.z;
|
||||
|
||||
info.PushDebug<AMFIntValue>("CollisionGroup") = m_CollisionGroup;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -5,6 +5,10 @@
|
||||
#include "NiPoint3.h"
|
||||
#include "NiQuaternion.h"
|
||||
|
||||
namespace GameMessages {
|
||||
struct GetObjectReportInfo;
|
||||
};
|
||||
|
||||
namespace Raknet {
|
||||
class BitStream;
|
||||
};
|
||||
@@ -29,6 +33,8 @@ public:
|
||||
int32_t GetCollisionGroup() const noexcept { return m_CollisionGroup; }
|
||||
void SetCollisionGroup(int32_t group) noexcept { m_CollisionGroup = group; }
|
||||
protected:
|
||||
bool OnGetObjectReportInfo(GameMessages::GameMsg& msg);
|
||||
|
||||
dpEntity* CreatePhysicsEntity(eReplicaComponentType type);
|
||||
|
||||
dpEntity* CreatePhysicsLnv(const float scale, const eReplicaComponentType type) const;
|
||||
|
@@ -10,9 +10,12 @@
|
||||
#include "dpWorld.h"
|
||||
#include "dpShapeBox.h"
|
||||
#include "dpShapeSphere.h"
|
||||
#include"EntityInfo.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "Amf3.h"
|
||||
|
||||
RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* parent, int32_t componentId) : PhysicsComponent(parent, componentId) {
|
||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &RigidbodyPhantomPhysicsComponent::OnGetObjectReportInfo);
|
||||
|
||||
m_Position = m_Parent->GetDefaultPosition();
|
||||
m_Rotation = m_Parent->GetDefaultRotation();
|
||||
m_Scale = m_Parent->GetDefaultScale();
|
||||
@@ -55,3 +58,11 @@ void RigidbodyPhantomPhysicsComponent::SpawnVertices() const {
|
||||
}
|
||||
PhysicsComponent::SpawnVertices(m_dpEntity);
|
||||
}
|
||||
|
||||
bool RigidbodyPhantomPhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
|
||||
PhysicsComponent::OnGetObjectReportInfo(msg);
|
||||
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
|
||||
auto& info = reportInfo.subCategory->PushDebug("Rigidbody Phantom Info");
|
||||
info.PushDebug<AMFDoubleValue>("Scale") = m_Scale;
|
||||
return true;
|
||||
}
|
||||
|
@@ -29,6 +29,8 @@ public:
|
||||
|
||||
void SpawnVertices() const;
|
||||
private:
|
||||
bool OnGetObjectReportInfo(GameMessages::GameMsg& msg);
|
||||
|
||||
float m_Scale{};
|
||||
|
||||
dpEntity* m_dpEntity{};
|
||||
|
@@ -12,8 +12,12 @@
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
|
||||
#include "Entity.h"
|
||||
#include "StringifiedEnum.h"
|
||||
#include "Amf3.h"
|
||||
|
||||
SimplePhysicsComponent::SimplePhysicsComponent(Entity* parent, int32_t componentID) : PhysicsComponent(parent, componentID) {
|
||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &SimplePhysicsComponent::OnGetObjectReportInfo);
|
||||
|
||||
m_Position = m_Parent->GetDefaultPosition();
|
||||
m_Rotation = m_Parent->GetDefaultRotation();
|
||||
|
||||
@@ -71,3 +75,20 @@ void SimplePhysicsComponent::SetPhysicsMotionState(uint32_t value) {
|
||||
m_DirtyPhysicsMotionState = m_PhysicsMotionState != value;
|
||||
m_PhysicsMotionState = value;
|
||||
}
|
||||
|
||||
bool SimplePhysicsComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) {
|
||||
PhysicsComponent::OnGetObjectReportInfo(msg);
|
||||
auto& reportInfo = static_cast<GameMessages::GetObjectReportInfo&>(msg);
|
||||
auto& info = reportInfo.subCategory->PushDebug("Simple Physics Info");
|
||||
auto& velocity = info.PushDebug("Velocity");
|
||||
velocity.PushDebug<AMFDoubleValue>("x") = m_Velocity.x;
|
||||
velocity.PushDebug<AMFDoubleValue>("y") = m_Velocity.y;
|
||||
velocity.PushDebug<AMFDoubleValue>("z") = m_Velocity.z;
|
||||
auto& angularVelocity = info.PushDebug("Angular Velocity");
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("x") = m_AngularVelocity.x;
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("y") = m_AngularVelocity.y;
|
||||
angularVelocity.PushDebug<AMFDoubleValue>("z") = m_AngularVelocity.z;
|
||||
info.PushDebug<AMFIntValue>("Physics Motion State") = m_PhysicsMotionState;
|
||||
info.PushDebug<AMFStringValue>("Climbable Type") = StringifiedEnum::ToString(m_ClimbableType).data();
|
||||
return true;
|
||||
}
|
||||
|
@@ -86,6 +86,8 @@ public:
|
||||
void SetClimbableType(const eClimbableType& value) { m_ClimbableType = value; }
|
||||
|
||||
private:
|
||||
bool OnGetObjectReportInfo(GameMessages::GameMsg& msg);
|
||||
|
||||
/**
|
||||
* The current velocity of the entity
|
||||
*/
|
||||
|
@@ -791,6 +791,7 @@ namespace GameMessages {
|
||||
|
||||
struct GetObjectReportInfo : public GameMsg {
|
||||
AMFArrayValue* info{};
|
||||
AMFArrayValue* subCategory{};
|
||||
bool bVerbose{};
|
||||
|
||||
GetObjectReportInfo() : GameMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, eGameMasterLevel::DEVELOPER) {}
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "TriggerComponent.h"
|
||||
#include "RigidbodyPhantomPhysicsComponent.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
|
||||
// Enums
|
||||
#include "eGameMasterLevel.h"
|
||||
|
Reference in New Issue
Block a user