mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 23:47:21 +00:00
move vars to be local
This commit is contained in:
parent
c237c16c33
commit
485a88dfd4
@ -220,8 +220,15 @@ void Entity::AddPathComponent(TemplateComponents& components) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Entity::Initialize() {
|
void Entity::Initialize() {
|
||||||
// TODO DoPreLoadObject
|
bool hasPhysicsComponent = false;
|
||||||
// TODO set m_HasModelBehaviors accordingly and used appropiately: see Ghidra;
|
bool hasDestroyableComponent = false;
|
||||||
|
bool hasPathFindingComponent = false;
|
||||||
|
bool hasProximityMonitorComponent = false;
|
||||||
|
bool hasScriptComponent = false;
|
||||||
|
bool hasDroppedLootComponent = false;
|
||||||
|
bool hasModelBehaviors = false;
|
||||||
|
uint32_t physicsComponentID = -1;
|
||||||
|
uint32_t modelType = -1;
|
||||||
|
|
||||||
// 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");
|
||||||
@ -245,14 +252,14 @@ void Entity::Initialize() {
|
|||||||
switch (componentTemplate) {
|
switch (componentTemplate) {
|
||||||
case eReplicaComponentType::CONTROLLABLE_PHYSICS:
|
case eReplicaComponentType::CONTROLLABLE_PHYSICS:
|
||||||
AddComponent<ControllablePhysicsComponent>();
|
AddComponent<ControllablePhysicsComponent>();
|
||||||
m_HasPhysicsComponent = true;
|
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;
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::CHARACTER:
|
case eReplicaComponentType::CHARACTER:
|
||||||
AddComponent<CharacterComponent>(m_Character);
|
AddComponent<CharacterComponent>(m_Character);
|
||||||
@ -285,9 +292,7 @@ void Entity::Initialize() {
|
|||||||
break;
|
break;
|
||||||
case eReplicaComponentType::VENDOR:
|
case eReplicaComponentType::VENDOR:
|
||||||
AddComponent<VendorComponent>();
|
AddComponent<VendorComponent>();
|
||||||
if (!HasComponent(eReplicaComponentType::PROXIMITY_MONITOR)) {
|
if (!hasProximityMonitorComponent) AddComponent<ProximityMonitorComponent>();
|
||||||
AddComponent<ProximityMonitorComponent>();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::INVENTORY:
|
case eReplicaComponentType::INVENTORY:
|
||||||
AddComponent<InventoryComponent>();
|
AddComponent<InventoryComponent>();
|
||||||
@ -297,11 +302,11 @@ void Entity::Initialize() {
|
|||||||
break;
|
break;
|
||||||
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
||||||
AddComponent<RigidbodyPhantomPhysicsComponent>();
|
AddComponent<RigidbodyPhantomPhysicsComponent>();
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::COLLECTIBLE:
|
case eReplicaComponentType::COLLECTIBLE:
|
||||||
AddComponent<CollectibleComponent>();
|
AddComponent<CollectibleComponent>();
|
||||||
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>(componentId);
|
if (!hasDestroyableComponent) AddComponent<DestroyableComponent>(componentId);
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::MOVING_PLATFORM:
|
case eReplicaComponentType::MOVING_PLATFORM:
|
||||||
AddComponent<MovingPlatformComponent>(GetVarAsString(u"attached_path"));
|
AddComponent<MovingPlatformComponent>(GetVarAsString(u"attached_path"));
|
||||||
@ -311,15 +316,16 @@ 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
|
if (GetVar<bool>(u"use_simple_physics")) {
|
||||||
// AddComponent<SimplePhysicsComponent>(componentId);
|
AddComponent<SimplePhysicsComponent>(componentId);
|
||||||
// else
|
} else {
|
||||||
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>();
|
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>(componentId);
|
||||||
if (havokVehiclePhysicsComponent) {
|
if (havokVehiclePhysicsComponent) {
|
||||||
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
||||||
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
||||||
}
|
}
|
||||||
m_HasPhysicsComponent = true;
|
}
|
||||||
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eReplicaComponentType::MOVEMENT_AI:
|
case eReplicaComponentType::MOVEMENT_AI:
|
||||||
@ -334,24 +340,23 @@ 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;
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eReplicaComponentType::MODEL_BEHAVIOR: {
|
case eReplicaComponentType::MODEL_BEHAVIOR: {
|
||||||
uint32_t modelType = -1;
|
|
||||||
// Get Model Type form ldf/DB
|
// Get Model Type form ldf/DB
|
||||||
if (!m_HasModelBehaviors && !m_HasPhysicsComponent){
|
if (!hasModelBehaviors && !hasPhysicsComponent){
|
||||||
AddComponent<SimplePhysicsComponent>(m_PhysicsComponentID);
|
AddComponent<SimplePhysicsComponent>(physicsComponentID);
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
} else if (!m_HasPhysicsComponent) {
|
} else if (!hasPhysicsComponent) {
|
||||||
if (modelType == 0){
|
if (modelType == 0){
|
||||||
if(m_PhysicsComponentID == -1) m_PhysicsComponentID = 4246U;
|
if(physicsComponentID == -1) physicsComponentID = 4246U;
|
||||||
AddComponent<ControllablePhysicsComponent>(m_PhysicsComponentID);
|
AddComponent<ControllablePhysicsComponent>(physicsComponentID);
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
} else {
|
} else {
|
||||||
if(m_PhysicsComponentID == -1) m_PhysicsComponentID = 4247U;
|
if(physicsComponentID == -1) physicsComponentID = 4247U;
|
||||||
AddComponent<SimplePhysicsComponent>(m_PhysicsComponentID);
|
AddComponent<SimplePhysicsComponent>(physicsComponentID);
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if has LDF of propertyObjectID || inInventory is true
|
// if has LDF of propertyObjectID || inInventory is true
|
||||||
@ -445,9 +450,7 @@ void Entity::Initialize() {
|
|||||||
break;
|
break;
|
||||||
case eReplicaComponentType::DONATION_VENDOR:
|
case eReplicaComponentType::DONATION_VENDOR:
|
||||||
AddComponent<DonationVendorComponent>();
|
AddComponent<DonationVendorComponent>();
|
||||||
if (!HasComponent(eReplicaComponentType::PROXIMITY_MONITOR)) {
|
if (!hasProximityMonitorComponent) AddComponent<ProximityMonitorComponent>();
|
||||||
AddComponent<ProximityMonitorComponent>();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::GATE_RUSH_CONTROL:
|
case eReplicaComponentType::GATE_RUSH_CONTROL:
|
||||||
AddComponent<GateRushControlComponent>();
|
AddComponent<GateRushControlComponent>();
|
||||||
@ -460,15 +463,15 @@ void Entity::Initialize() {
|
|||||||
break;
|
break;
|
||||||
case eReplicaComponentType::PROJECTILE_PHYSICS:
|
case eReplicaComponentType::PROJECTILE_PHYSICS:
|
||||||
// AddComponent<ProjectilePhysicsComponent>();
|
// AddComponent<ProjectilePhysicsComponent>();
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::VEHICLE_PHYSICS:
|
case eReplicaComponentType::VEHICLE_PHYSICS:
|
||||||
// AddComponent<VehiclePhysicsComponent>();
|
// AddComponent<VehiclePhysicsComponent>();
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::PHYSICS_SYSTEM:
|
case eReplicaComponentType::PHYSICS_SYSTEM:
|
||||||
// AddComponent<PhysicsSystemComponent>();
|
// AddComponent<PhysicsSystemComponent>();
|
||||||
m_HasPhysicsComponent = true;
|
hasPhysicsComponent = true;
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::GHOST:
|
case eReplicaComponentType::GHOST:
|
||||||
case eReplicaComponentType::SPAWN:
|
case eReplicaComponentType::SPAWN:
|
||||||
|
@ -379,10 +379,6 @@ 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…
Reference in New Issue
Block a user