mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-24 15:52:32 +00:00
rough logic around loading physics
as well as modelbehaviors
This commit is contained in:
parent
d153d66e26
commit
d44b18e38f
@ -74,6 +74,7 @@
|
|||||||
#include "GateRushControlComponent.h"
|
#include "GateRushControlComponent.h"
|
||||||
#include "RacingSoundTriggerComponent.h"
|
#include "RacingSoundTriggerComponent.h"
|
||||||
#include "AchievementVendorComponent.h"
|
#include "AchievementVendorComponent.h"
|
||||||
|
#include "MutableModelBehaviorComponent.h"
|
||||||
|
|
||||||
// Table includes
|
// Table includes
|
||||||
#include "CDComponentsRegistryTable.h"
|
#include "CDComponentsRegistryTable.h"
|
||||||
@ -219,6 +220,9 @@ void Entity::AddPathComponent(TemplateComponents& components) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Entity::Initialize() {
|
void Entity::Initialize() {
|
||||||
|
// TODO DoPreLoadObject
|
||||||
|
// TODO set m_HasModelBehaviors accordingly and used appropiately: see Ghidra;
|
||||||
|
|
||||||
// A few edge cases to tackle first
|
// A few edge cases to tackle first
|
||||||
const auto triggerInfo = GetVarAsString(u"trigger_id");
|
const auto triggerInfo = GetVarAsString(u"trigger_id");
|
||||||
if (!triggerInfo.empty()) AddComponent<TriggerComponent>(triggerInfo);
|
if (!triggerInfo.empty()) AddComponent<TriggerComponent>(triggerInfo);
|
||||||
@ -236,20 +240,19 @@ void Entity::Initialize() {
|
|||||||
ApplyComponentWhitelist(components);
|
ApplyComponentWhitelist(components);
|
||||||
ApplyComponentBlacklist(components);
|
ApplyComponentBlacklist(components);
|
||||||
AddPathComponent(components);
|
AddPathComponent(components);
|
||||||
// Brick-by-Brick models use custom physics depending on _something_ but the client uses 4246 as the simple
|
|
||||||
// physics component id and 4247 for phantom physics. We'll just use the simple physics component for now
|
|
||||||
// since we dont know what the phantom physics are for at the moment.
|
|
||||||
if (GetLOT() == LOT_MODEL_IN_WORLD) components.emplace_back(eReplicaComponentType::SIMPLE_PHYSICS, 4246U);
|
|
||||||
for (const auto& [componentTemplate, componentId] : components) {
|
for (const auto& [componentTemplate, componentId] : components) {
|
||||||
switch (componentTemplate) {
|
switch (componentTemplate) {
|
||||||
case eReplicaComponentType::CONTROLLABLE_PHYSICS:
|
case eReplicaComponentType::CONTROLLABLE_PHYSICS:
|
||||||
AddComponent<ControllablePhysicsComponent>();
|
AddComponent<ControllablePhysicsComponent>();
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::RENDER:
|
case eReplicaComponentType::RENDER:
|
||||||
AddComponent<RenderComponent>();
|
AddComponent<RenderComponent>();
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::SIMPLE_PHYSICS:
|
case eReplicaComponentType::SIMPLE_PHYSICS:
|
||||||
AddComponent<SimplePhysicsComponent>(componentId);
|
AddComponent<SimplePhysicsComponent>(componentId);
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::CHARACTER:
|
case eReplicaComponentType::CHARACTER:
|
||||||
AddComponent<CharacterComponent>(m_Character);
|
AddComponent<CharacterComponent>(m_Character);
|
||||||
@ -294,6 +297,7 @@ void Entity::Initialize() {
|
|||||||
break;
|
break;
|
||||||
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
||||||
AddComponent<RigidbodyPhantomPhysicsComponent>();
|
AddComponent<RigidbodyPhantomPhysicsComponent>();
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::COLLECTIBLE:
|
case eReplicaComponentType::COLLECTIBLE:
|
||||||
AddComponent<CollectibleComponent>();
|
AddComponent<CollectibleComponent>();
|
||||||
@ -307,11 +311,15 @@ void Entity::Initialize() {
|
|||||||
AddComponent<MovementAIComponent>();
|
AddComponent<MovementAIComponent>();
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::HAVOK_VEHICLE_PHYSICS: {
|
case eReplicaComponentType::HAVOK_VEHICLE_PHYSICS: {
|
||||||
|
// if ldf of use_simple_physics == true
|
||||||
|
// AddComponent<SimplePhysicsComponent>(componentId);
|
||||||
|
// else
|
||||||
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>();
|
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>();
|
||||||
if (havokVehiclePhysicsComponent) {
|
if (havokVehiclePhysicsComponent) {
|
||||||
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
||||||
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
||||||
}
|
}
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eReplicaComponentType::MOVEMENT_AI:
|
case eReplicaComponentType::MOVEMENT_AI:
|
||||||
@ -326,9 +334,29 @@ void Entity::Initialize() {
|
|||||||
case eReplicaComponentType::PHANTOM_PHYSICS: {
|
case eReplicaComponentType::PHANTOM_PHYSICS: {
|
||||||
auto* phantomPhysicsComponent = AddComponent<PhantomPhysicsComponent>();
|
auto* phantomPhysicsComponent = AddComponent<PhantomPhysicsComponent>();
|
||||||
if (phantomPhysicsComponent) phantomPhysicsComponent->SetPhysicsEffectActive(false);
|
if (phantomPhysicsComponent) phantomPhysicsComponent->SetPhysicsEffectActive(false);
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eReplicaComponentType::MODEL_BEHAVIOR: {
|
case eReplicaComponentType::MODEL_BEHAVIOR: {
|
||||||
|
uint32_t modelType = -1;
|
||||||
|
// Get Model Type form ldf/DB
|
||||||
|
if (!m_HasModelBehaviors && !m_HasPhysicsComponent){
|
||||||
|
AddComponent<SimplePhysicsComponent>(m_PhysicsComponentID);
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
|
} else if (!m_HasPhysicsComponent) {
|
||||||
|
if (modelType == 0){
|
||||||
|
if(m_PhysicsComponentID == -1) m_PhysicsComponentID = 4246U;
|
||||||
|
AddComponent<ControllablePhysicsComponent>(m_PhysicsComponentID);
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
|
} else {
|
||||||
|
if(m_PhysicsComponentID == -1) m_PhysicsComponentID = 4247U;
|
||||||
|
AddComponent<SimplePhysicsComponent>(m_PhysicsComponentID);
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if has LDF of propertyObjectID || inInventory is true
|
||||||
|
// AddComponent<MutableModelBehaviorComponent>();
|
||||||
|
// else
|
||||||
AddComponent<ModelBehaviorComponent>();
|
AddComponent<ModelBehaviorComponent>();
|
||||||
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
|
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
|
||||||
auto* destroyableComponent = AddComponent<DestroyableComponent>(componentId);
|
auto* destroyableComponent = AddComponent<DestroyableComponent>(componentId);
|
||||||
@ -430,13 +458,25 @@ void Entity::Initialize() {
|
|||||||
case eReplicaComponentType::ACHIEVEMENT_VENDOR:
|
case eReplicaComponentType::ACHIEVEMENT_VENDOR:
|
||||||
AddComponent<AchievementVendorComponent>();
|
AddComponent<AchievementVendorComponent>();
|
||||||
break;
|
break;
|
||||||
|
case eReplicaComponentType::PROJECTILE_PHYSICS:
|
||||||
|
// AddComponent<ProjectilePhysicsComponent>();
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
|
break;
|
||||||
|
case eReplicaComponentType::VEHICLE_PHYSICS:
|
||||||
|
// AddComponent<VehiclePhysicsComponent>();
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
|
break;
|
||||||
|
case eReplicaComponentType::PHYSICS_SYSTEM:
|
||||||
|
// AddComponent<PhysicsSystemComponent>();
|
||||||
|
m_HasPhysicsComponent = true;
|
||||||
|
break;
|
||||||
case eReplicaComponentType::GHOST:
|
case eReplicaComponentType::GHOST:
|
||||||
case eReplicaComponentType::SPAWN:
|
case eReplicaComponentType::SPAWN:
|
||||||
case eReplicaComponentType::MODULAR_BUILD:
|
case eReplicaComponentType::MODULAR_BUILD:
|
||||||
case eReplicaComponentType::BUILD_CONTROLLER:
|
case eReplicaComponentType::BUILD_CONTROLLER:
|
||||||
case eReplicaComponentType::BUILD_ACTIVATOR:
|
case eReplicaComponentType::BUILD_ACTIVATOR:
|
||||||
case eReplicaComponentType::ICON_ONLY:
|
case eReplicaComponentType::ICON_ONLY:
|
||||||
case eReplicaComponentType::PROJECTILE_PHYSICS:
|
|
||||||
case eReplicaComponentType::DROP_EFFECT:
|
case eReplicaComponentType::DROP_EFFECT:
|
||||||
case eReplicaComponentType::CHEST:
|
case eReplicaComponentType::CHEST:
|
||||||
case eReplicaComponentType::BLUEPRINT:
|
case eReplicaComponentType::BLUEPRINT:
|
||||||
@ -451,8 +491,6 @@ void Entity::Initialize() {
|
|||||||
case eReplicaComponentType::MODEL_BUILDER:
|
case eReplicaComponentType::MODEL_BUILDER:
|
||||||
case eReplicaComponentType::SPRINGPAD:
|
case eReplicaComponentType::SPRINGPAD:
|
||||||
case eReplicaComponentType::FX:
|
case eReplicaComponentType::FX:
|
||||||
case eReplicaComponentType::VEHICLE_PHYSICS:
|
|
||||||
case eReplicaComponentType::PHYSICS_SYSTEM:
|
|
||||||
case eReplicaComponentType::CHANGLING_BUILD:
|
case eReplicaComponentType::CHANGLING_BUILD:
|
||||||
case eReplicaComponentType::CHOICE_BUILD:
|
case eReplicaComponentType::CHOICE_BUILD:
|
||||||
case eReplicaComponentType::PACKAGE:
|
case eReplicaComponentType::PACKAGE:
|
||||||
|
@ -379,6 +379,10 @@ protected:
|
|||||||
std::vector<LWOOBJID> m_TargetsInPhantom;
|
std::vector<LWOOBJID> m_TargetsInPhantom;
|
||||||
|
|
||||||
static const std::vector<ComponentWhitelist> m_ComponentWhitelists;
|
static const std::vector<ComponentWhitelist> m_ComponentWhitelists;
|
||||||
|
|
||||||
|
bool m_HasModelBehaviors = false;
|
||||||
|
bool m_HasPhysicsComponent = false;
|
||||||
|
uint32_t m_PhysicsComponentID = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "Entity.tcc"
|
#include "Entity.tcc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user