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() {
|
||||
// TODO DoPreLoadObject
|
||||
// TODO set m_HasModelBehaviors accordingly and used appropiately: see Ghidra;
|
||||
bool hasPhysicsComponent = false;
|
||||
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
|
||||
const auto triggerInfo = GetVarAsString(u"trigger_id");
|
||||
@ -245,14 +252,14 @@ void Entity::Initialize() {
|
||||
switch (componentTemplate) {
|
||||
case eReplicaComponentType::CONTROLLABLE_PHYSICS:
|
||||
AddComponent<ControllablePhysicsComponent>();
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
case eReplicaComponentType::RENDER:
|
||||
AddComponent<RenderComponent>();
|
||||
break;
|
||||
case eReplicaComponentType::SIMPLE_PHYSICS:
|
||||
AddComponent<SimplePhysicsComponent>(componentId);
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
case eReplicaComponentType::CHARACTER:
|
||||
AddComponent<CharacterComponent>(m_Character);
|
||||
@ -285,9 +292,7 @@ void Entity::Initialize() {
|
||||
break;
|
||||
case eReplicaComponentType::VENDOR:
|
||||
AddComponent<VendorComponent>();
|
||||
if (!HasComponent(eReplicaComponentType::PROXIMITY_MONITOR)) {
|
||||
AddComponent<ProximityMonitorComponent>();
|
||||
}
|
||||
if (!hasProximityMonitorComponent) AddComponent<ProximityMonitorComponent>();
|
||||
break;
|
||||
case eReplicaComponentType::INVENTORY:
|
||||
AddComponent<InventoryComponent>();
|
||||
@ -297,11 +302,11 @@ void Entity::Initialize() {
|
||||
break;
|
||||
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
||||
AddComponent<RigidbodyPhantomPhysicsComponent>();
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
case eReplicaComponentType::COLLECTIBLE:
|
||||
AddComponent<CollectibleComponent>();
|
||||
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>(componentId);
|
||||
if (!hasDestroyableComponent) AddComponent<DestroyableComponent>(componentId);
|
||||
break;
|
||||
case eReplicaComponentType::MOVING_PLATFORM:
|
||||
AddComponent<MovingPlatformComponent>(GetVarAsString(u"attached_path"));
|
||||
@ -311,15 +316,16 @@ void Entity::Initialize() {
|
||||
AddComponent<MovementAIComponent>();
|
||||
break;
|
||||
case eReplicaComponentType::HAVOK_VEHICLE_PHYSICS: {
|
||||
// if ldf of use_simple_physics == true
|
||||
// AddComponent<SimplePhysicsComponent>(componentId);
|
||||
// else
|
||||
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>();
|
||||
if (GetVar<bool>(u"use_simple_physics")) {
|
||||
AddComponent<SimplePhysicsComponent>(componentId);
|
||||
} else {
|
||||
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>(componentId);
|
||||
if (havokVehiclePhysicsComponent) {
|
||||
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
||||
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
||||
}
|
||||
m_HasPhysicsComponent = true;
|
||||
}
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
}
|
||||
case eReplicaComponentType::MOVEMENT_AI:
|
||||
@ -334,24 +340,23 @@ void Entity::Initialize() {
|
||||
case eReplicaComponentType::PHANTOM_PHYSICS: {
|
||||
auto* phantomPhysicsComponent = AddComponent<PhantomPhysicsComponent>();
|
||||
if (phantomPhysicsComponent) phantomPhysicsComponent->SetPhysicsEffectActive(false);
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
}
|
||||
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 (!hasModelBehaviors && !hasPhysicsComponent){
|
||||
AddComponent<SimplePhysicsComponent>(physicsComponentID);
|
||||
hasPhysicsComponent = true;
|
||||
} else if (!hasPhysicsComponent) {
|
||||
if (modelType == 0){
|
||||
if(m_PhysicsComponentID == -1) m_PhysicsComponentID = 4246U;
|
||||
AddComponent<ControllablePhysicsComponent>(m_PhysicsComponentID);
|
||||
m_HasPhysicsComponent = true;
|
||||
if(physicsComponentID == -1) physicsComponentID = 4246U;
|
||||
AddComponent<ControllablePhysicsComponent>(physicsComponentID);
|
||||
hasPhysicsComponent = true;
|
||||
} else {
|
||||
if(m_PhysicsComponentID == -1) m_PhysicsComponentID = 4247U;
|
||||
AddComponent<SimplePhysicsComponent>(m_PhysicsComponentID);
|
||||
m_HasPhysicsComponent = true;
|
||||
if(physicsComponentID == -1) physicsComponentID = 4247U;
|
||||
AddComponent<SimplePhysicsComponent>(physicsComponentID);
|
||||
hasPhysicsComponent = true;
|
||||
}
|
||||
}
|
||||
// if has LDF of propertyObjectID || inInventory is true
|
||||
@ -445,9 +450,7 @@ void Entity::Initialize() {
|
||||
break;
|
||||
case eReplicaComponentType::DONATION_VENDOR:
|
||||
AddComponent<DonationVendorComponent>();
|
||||
if (!HasComponent(eReplicaComponentType::PROXIMITY_MONITOR)) {
|
||||
AddComponent<ProximityMonitorComponent>();
|
||||
}
|
||||
if (!hasProximityMonitorComponent) AddComponent<ProximityMonitorComponent>();
|
||||
break;
|
||||
case eReplicaComponentType::GATE_RUSH_CONTROL:
|
||||
AddComponent<GateRushControlComponent>();
|
||||
@ -460,15 +463,15 @@ void Entity::Initialize() {
|
||||
break;
|
||||
case eReplicaComponentType::PROJECTILE_PHYSICS:
|
||||
// AddComponent<ProjectilePhysicsComponent>();
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
case eReplicaComponentType::VEHICLE_PHYSICS:
|
||||
// AddComponent<VehiclePhysicsComponent>();
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
case eReplicaComponentType::PHYSICS_SYSTEM:
|
||||
// AddComponent<PhysicsSystemComponent>();
|
||||
m_HasPhysicsComponent = true;
|
||||
hasPhysicsComponent = true;
|
||||
break;
|
||||
case eReplicaComponentType::GHOST:
|
||||
case eReplicaComponentType::SPAWN:
|
||||
|
@ -379,10 +379,6 @@ protected:
|
||||
std::vector<LWOOBJID> m_TargetsInPhantom;
|
||||
|
||||
static const std::vector<ComponentWhitelist> m_ComponentWhitelists;
|
||||
|
||||
bool m_HasModelBehaviors = false;
|
||||
bool m_HasPhysicsComponent = false;
|
||||
uint32_t m_PhysicsComponentID = -1;
|
||||
};
|
||||
|
||||
#include "Entity.tcc"
|
||||
|
Loading…
Reference in New Issue
Block a user