Further re-implement Entity::Initialize

wheee
This commit is contained in:
David Markowitz 2023-06-09 04:05:04 -07:00
parent 0b37dc1e4d
commit e3a716a9cf
2 changed files with 152 additions and 105 deletions

View File

@ -74,6 +74,8 @@
#include "eGameMasterLevel.h" #include "eGameMasterLevel.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "eReplicaPacketType.h" #include "eReplicaPacketType.h"
#include "RacingStatsComponent.h"
#include "MinigameControlComponent.h"
// Table includes // Table includes
#include "CDComponentsRegistryTable.h" #include "CDComponentsRegistryTable.h"
@ -134,28 +136,55 @@ Entity::~Entity() {
} }
void Entity::Initialize() { void Entity::Initialize() {
// A few edge cases to tackle first
const auto triggerInfo = GetVarAsString(u"trigger_id");
if (!triggerInfo.empty()) AddComponent<TriggerComponent>(triggerInfo);
const auto groupIDs = GetVarAsString(u"groupID");
if (!groupIDs.empty()) {
m_Groups = GeneralUtils::SplitString(groupIDs, ';');
if (m_Groups.back().empty()) m_Groups.erase(m_Groups.end() - 1);
}
if (m_ParentEntity) m_ParentEntity->AddChild(this);
// Brick-by-Brick models don't have all their components in the registry for some reason? Might have to be related to using ldf keys for physics
if (GetLOT() == 14) {
AddComponent<SimplePhysicsComponent>(0);
AddComponent<ModelBehaviorComponent>();
AddComponent<RenderComponent>();
AddComponent<DestroyableComponent>();
return;
}
auto* componentsRegistry = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>(); auto* componentsRegistry = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
auto components = componentsRegistry->GetTemplateComponents(m_TemplateID); auto components = componentsRegistry->GetTemplateComponents(m_TemplateID);
// Apply the whitelist here based on the corresponding ldf key. Removes components that are not whitelisted. List is determined based on the clients whitelist data.
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>();
break; break;
case eReplicaComponentType::RENDER: case eReplicaComponentType::RENDER:
AddComponent<RenderComponent>();
break; break;
case eReplicaComponentType::SIMPLE_PHYSICS: case eReplicaComponentType::SIMPLE_PHYSICS:
break; break;
case eReplicaComponentType::CHARACTER: case eReplicaComponentType::CHARACTER:
AddComponent<CharacterComponent>(m_Character);
AddComponent<MissionComponent>();
break; break;
case eReplicaComponentType::SCRIPT: case eReplicaComponentType::SCRIPT:
break; break;
case eReplicaComponentType::BOUNCER: case eReplicaComponentType::BOUNCER:
AddComponent<BouncerComponent>();
break; break;
case eReplicaComponentType::DESTROYABLE: case eReplicaComponentType::DESTROYABLE:
break; break;
case eReplicaComponentType::GHOST: case eReplicaComponentType::GHOST:
break; break;
case eReplicaComponentType::SKILL: case eReplicaComponentType::SKILL:
AddComponent<SkillComponent>();
break; break;
case eReplicaComponentType::SPAWN: case eReplicaComponentType::SPAWN:
break; break;
@ -170,12 +199,14 @@ void Entity::Initialize() {
case eReplicaComponentType::ICON_ONLY: case eReplicaComponentType::ICON_ONLY:
break; break;
case eReplicaComponentType::VENDOR: case eReplicaComponentType::VENDOR:
AddComponent<VendorComponent>();
break; break;
case eReplicaComponentType::INVENTORY: case eReplicaComponentType::INVENTORY:
break; break;
case eReplicaComponentType::PROJECTILE_PHYSICS: case eReplicaComponentType::PROJECTILE_PHYSICS:
break; break;
case eReplicaComponentType::SHOOTING_GALLERY: case eReplicaComponentType::SHOOTING_GALLERY:
AddComponent<ShootingGalleryComponent>();
break; break;
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS: case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
break; break;
@ -190,6 +221,7 @@ void Entity::Initialize() {
case eReplicaComponentType::MOVING_PLATFORM: case eReplicaComponentType::MOVING_PLATFORM:
break; break;
case eReplicaComponentType::PET: case eReplicaComponentType::PET:
AddComponent<PetComponent>(componentId);
break; break;
case eReplicaComponentType::PLATFORM_BOUNDARY: case eReplicaComponentType::PLATFORM_BOUNDARY:
break; break;
@ -210,12 +242,14 @@ void Entity::Initialize() {
case eReplicaComponentType::MINIFIG: case eReplicaComponentType::MINIFIG:
break; break;
case eReplicaComponentType::PROPERTY: case eReplicaComponentType::PROPERTY:
AddComponent<PropertyComponent>();
break; break;
case eReplicaComponentType::PET_CREATOR: case eReplicaComponentType::PET_CREATOR:
break; break;
case eReplicaComponentType::MODEL_BUILDER: case eReplicaComponentType::MODEL_BUILDER:
break; break;
case eReplicaComponentType::SCRIPTED_ACTIVITY: case eReplicaComponentType::SCRIPTED_ACTIVITY:
AddComponent<ScriptedActivityComponent>(componentId);
break; break;
case eReplicaComponentType::PHANTOM_PHYSICS: case eReplicaComponentType::PHANTOM_PHYSICS:
break; break;
@ -224,10 +258,12 @@ void Entity::Initialize() {
case eReplicaComponentType::MODEL_BEHAVIOR: case eReplicaComponentType::MODEL_BEHAVIOR:
break; break;
case eReplicaComponentType::PROPERTY_ENTRANCE: case eReplicaComponentType::PROPERTY_ENTRANCE:
AddComponent<PropertyEntranceComponent>(componentId);
break; break;
case eReplicaComponentType::FX: case eReplicaComponentType::FX:
break; break;
case eReplicaComponentType::PROPERTY_MANAGEMENT: case eReplicaComponentType::PROPERTY_MANAGEMENT:
AddComponent<PropertyManagementComponent>();
break; break;
case eReplicaComponentType::VEHICLE_PHYSICS: case eReplicaComponentType::VEHICLE_PHYSICS:
break; break;
@ -236,8 +272,10 @@ void Entity::Initialize() {
case eReplicaComponentType::QUICK_BUILD: case eReplicaComponentType::QUICK_BUILD:
break; break;
case eReplicaComponentType::SWITCH: case eReplicaComponentType::SWITCH:
AddComponent<SwitchComponent>();
break; break;
case eReplicaComponentType::MINIGAME_CONTROL: case eReplicaComponentType::MINIGAME_CONTROL:
AddComponent<MinigameControlComponent>();
break; break;
case eReplicaComponentType::CHANGLING_BUILD: case eReplicaComponentType::CHANGLING_BUILD:
break; break;
@ -258,8 +296,10 @@ void Entity::Initialize() {
case eReplicaComponentType::CUSTOM_BUILD_ASSEMBLY: case eReplicaComponentType::CUSTOM_BUILD_ASSEMBLY:
break; break;
case eReplicaComponentType::BASE_COMBAT_AI: case eReplicaComponentType::BASE_COMBAT_AI:
AddComponent<BaseCombatAIComponent>(componentId);
break; break;
case eReplicaComponentType::MODULE_ASSEMBLY: case eReplicaComponentType::MODULE_ASSEMBLY:
AddComponent<ModuleAssemblyComponent>();
break; break;
case eReplicaComponentType::SHOWCASE_MODEL_HANDLER: case eReplicaComponentType::SHOWCASE_MODEL_HANDLER:
break; break;
@ -268,6 +308,7 @@ void Entity::Initialize() {
case eReplicaComponentType::GENERIC_ACTIVATOR: case eReplicaComponentType::GENERIC_ACTIVATOR:
break; break;
case eReplicaComponentType::PROPERTY_VENDOR: case eReplicaComponentType::PROPERTY_VENDOR:
AddComponent<PropertyVendorComponent>();
break; break;
case eReplicaComponentType::HF_LIGHT_DIRECTION_GADGET: case eReplicaComponentType::HF_LIGHT_DIRECTION_GADGET:
break; break;
@ -280,14 +321,18 @@ void Entity::Initialize() {
case eReplicaComponentType::DROPPED_LOOT: case eReplicaComponentType::DROPPED_LOOT:
break; break;
case eReplicaComponentType::RACING_CONTROL: case eReplicaComponentType::RACING_CONTROL:
AddComponent<RacingControlComponent>();
break; break;
case eReplicaComponentType::FACTION_TRIGGER: case eReplicaComponentType::FACTION_TRIGGER:
break; break;
case eReplicaComponentType::MISSION_OFFER: case eReplicaComponentType::MISSION_OFFER:
AddComponent<MissionOfferComponent>(GetLOT());
break; break;
case eReplicaComponentType::RACING_STATS: case eReplicaComponentType::RACING_STATS:
AddComponent<RacingStatsComponent>();
break; break;
case eReplicaComponentType::LUP_EXHIBIT: case eReplicaComponentType::LUP_EXHIBIT:
AddComponent<LUPExhibitComponent>();
break; break;
case eReplicaComponentType::BBB: case eReplicaComponentType::BBB:
break; break;
@ -354,6 +399,7 @@ void Entity::Initialize() {
case eReplicaComponentType::CRAFTING: case eReplicaComponentType::CRAFTING:
break; break;
case eReplicaComponentType::POSSESSABLE: case eReplicaComponentType::POSSESSABLE:
AddComponent<PossessableComponent>(componentId);
break; break;
case eReplicaComponentType::LEVEL_PROGRESSION: case eReplicaComponentType::LEVEL_PROGRESSION:
break; break;
@ -366,6 +412,7 @@ void Entity::Initialize() {
case eReplicaComponentType::PROPERTY_PLAQUE: case eReplicaComponentType::PROPERTY_PLAQUE:
break; break;
case eReplicaComponentType::BUILD_BORDER: case eReplicaComponentType::BUILD_BORDER:
AddComponent<BuildBorderComponent>();
break; break;
case eReplicaComponentType::UNKNOWN_115: case eReplicaComponentType::UNKNOWN_115:
break; break;

View File

@ -3,54 +3,54 @@ Entity::Initialize() {
* Setup trigger * Setup trigger
*/ */
const auto triggerInfo = GetVarAsString(u"trigger_id"); // const auto triggerInfo = GetVarAsString(u"trigger_id");
if (!triggerInfo.empty()) m_Components.emplace(eReplicaComponentType::TRIGGER, new TriggerComponent(this, triggerInfo)); // if (!triggerInfo.empty()) m_Components.emplace(eReplicaComponentType::TRIGGER, new TriggerComponent(this, triggerInfo));
/** /**
* Setup groups * Setup groups
*/ */
const auto groupIDs = GetVarAsString(u"groupID"); // const auto groupIDs = GetVarAsString(u"groupID");
if (!groupIDs.empty()) { // if (!groupIDs.empty()) {
m_Groups = GeneralUtils::SplitString(groupIDs, ';'); // m_Groups = GeneralUtils::SplitString(groupIDs, ';');
m_Groups.erase(m_Groups.end() - 1); // if (m_Groups.back().empty()) m_Groups.erase(m_Groups.end() - 1);
} // }
/** /**
* Set ourselves as a child of our parent * Set ourselves as a child of our parent
*/ */
if (m_ParentEntity != nullptr) { // if (m_ParentEntity != nullptr) {
m_ParentEntity->AddChild(this); // m_ParentEntity->AddChild(this);
} // }
// Get the registry table // Get the registry table
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>(); // CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
/** /**
* Special case for BBB models. They have components not corresponding to the registry. * Special case for BBB models. They have components not corresponding to the registry.
*/ */
if (m_TemplateID == 14) { if (m_TemplateID == 14) {
const auto simplePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SIMPLE_PHYSICS); // const auto simplePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SIMPLE_PHYSICS);
SimplePhysicsComponent* comp = new SimplePhysicsComponent(simplePhysicsComponentID, this); // SimplePhysicsComponent* comp = new SimplePhysicsComponent(simplePhysicsComponentID, this);
m_Components.insert(std::make_pair(eReplicaComponentType::SIMPLE_PHYSICS, comp)); // m_Components.insert(std::make_pair(eReplicaComponentType::SIMPLE_PHYSICS, comp));
ModelComponent* modelcomp = new ModelComponent(this); // ModelComponent* modelcomp = new ModelComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::MODEL, modelcomp)); // m_Components.insert(std::make_pair(eReplicaComponentType::MODEL, modelcomp));
RenderComponent* render = new RenderComponent(this); // RenderComponent* render = new RenderComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render)); // m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render));
auto destroyableComponent = new DestroyableComponent(this); // auto destroyableComponent = new DestroyableComponent(this);
destroyableComponent->SetHealth(1); destroyableComponent->SetHealth(1);
destroyableComponent->SetMaxHealth(1.0f); destroyableComponent->SetMaxHealth(1.0f);
destroyableComponent->SetFaction(-1, true); destroyableComponent->SetFaction(-1, true);
destroyableComponent->SetIsSmashable(true); destroyableComponent->SetIsSmashable(true);
m_Components.insert(std::make_pair(eReplicaComponentType::DESTROYABLE, destroyableComponent)); // m_Components.insert(std::make_pair(eReplicaComponentType::DESTROYABLE, destroyableComponent));
// We have all our components. // We have all our components.
return; return;
} }
@ -61,47 +61,47 @@ Entity::Initialize() {
* Not all components are implemented. Some are represented by a nullptr, as they hold no data. * Not all components are implemented. Some are represented by a nullptr, as they hold no data.
*/ */
if (GetParentUser()) { // if (GetParentUser()) {
auto missions = new MissionComponent(this); // auto missions = new MissionComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::MISSION, missions)); // m_Components.insert(std::make_pair(eReplicaComponentType::MISSION, missions));
missions->LoadFromXml(m_Character->GetXMLDoc()); // missions->LoadFromXml(m_Character->GetXMLDoc());
} // }
uint32_t petComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PET); // uint32_t petComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PET);
if (petComponentId > 0) { // if (petComponentId > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::PET, new PetComponent(this, petComponentId))); // m_Components.insert(std::make_pair(eReplicaComponentType::PET, new PetComponent(this, petComponentId)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ZONE_CONTROL) > 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ZONE_CONTROL) > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::ZONE_CONTROL, nullptr)); // m_Components.insert(std::make_pair(eReplicaComponentType::ZONE_CONTROL, nullptr));
} // }
uint32_t possessableComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::POSSESSABLE); // uint32_t possessableComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::POSSESSABLE);
if (possessableComponentId > 0) { // if (possessableComponentId > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::POSSESSABLE, new PossessableComponent(this, possessableComponentId))); // m_Components.insert(std::make_pair(eReplicaComponentType::POSSESSABLE, new PossessableComponent(this, possessableComponentId)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODULE_ASSEMBLY) > 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODULE_ASSEMBLY) > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::MODULE_ASSEMBLY, new ModuleAssemblyComponent(this))); // m_Components.insert(std::make_pair(eReplicaComponentType::MODULE_ASSEMBLY, new ModuleAssemblyComponent(this)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_STATS) > 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_STATS) > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::RACING_STATS, nullptr)); // m_Components.insert(std::make_pair(eReplicaComponentType::RACING_STATS, nullptr));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::LUP_EXHIBIT, -1) >= 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::LUP_EXHIBIT, -1) >= 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::LUP_EXHIBIT, new LUPExhibitComponent(this))); // m_Components.insert(std::make_pair(eReplicaComponentType::LUP_EXHIBIT, new LUPExhibitComponent(this)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_CONTROL) > 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_CONTROL) > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::RACING_CONTROL, new RacingControlComponent(this))); // m_Components.insert(std::make_pair(eReplicaComponentType::RACING_CONTROL, new RacingControlComponent(this)));
} // }
const auto propertyEntranceComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_ENTRANCE); // const auto propertyEntranceComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_ENTRANCE);
if (propertyEntranceComponentID > 0) { // if (propertyEntranceComponentID > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::PROPERTY_ENTRANCE, // m_Components.insert(std::make_pair(eReplicaComponentType::PROPERTY_ENTRANCE,
new PropertyEntranceComponent(propertyEntranceComponentID, this))); // new PropertyEntranceComponent(propertyEntranceComponentID, this)));
} // }
// if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CONTROLLABLE_PHYSICS) > 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CONTROLLABLE_PHYSICS) > 0) {
// ControllablePhysicsComponent* controllablePhysics = new ControllablePhysicsComponent(this); // ControllablePhysicsComponent* controllablePhysics = new ControllablePhysicsComponent(this);
@ -371,16 +371,16 @@ Entity::Initialize() {
} }
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SKILL, -1) != -1 || m_Character) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SKILL, -1) != -1 || m_Character) {
SkillComponent* comp = new SkillComponent(this); // SkillComponent* comp = new SkillComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::SKILL, comp)); // m_Components.insert(std::make_pair(eReplicaComponentType::SKILL, comp));
} // }
const auto combatAiId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BASE_COMBAT_AI); // const auto combatAiId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BASE_COMBAT_AI);
if (combatAiId > 0) { // if (combatAiId > 0) {
BaseCombatAIComponent* comp = new BaseCombatAIComponent(this, combatAiId); // BaseCombatAIComponent* comp = new BaseCombatAIComponent(this, combatAiId);
m_Components.insert(std::make_pair(eReplicaComponentType::BASE_COMBAT_AI, comp)); // m_Components.insert(std::make_pair(eReplicaComponentType::BASE_COMBAT_AI, comp));
} // }
if (int componentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD) > 0) { if (int componentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD) > 0) {
RebuildComponent* comp = new RebuildComponent(this); RebuildComponent* comp = new RebuildComponent(this);
@ -424,50 +424,50 @@ Entity::Initialize() {
} }
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SWITCH, -1) != -1) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SWITCH, -1) != -1) {
SwitchComponent* comp = new SwitchComponent(this); // SwitchComponent* comp = new SwitchComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::SWITCH, comp)); // m_Components.insert(std::make_pair(eReplicaComponentType::SWITCH, comp));
} // }
if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VENDOR) > 0)) { // if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VENDOR) > 0)) {
VendorComponent* comp = new VendorComponent(this); // VendorComponent* comp = new VendorComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::VENDOR, comp)); // m_Components.insert(std::make_pair(eReplicaComponentType::VENDOR, comp));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_VENDOR, -1) != -1) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_VENDOR, -1) != -1) {
auto* component = new PropertyVendorComponent(this); // auto* component = new PropertyVendorComponent(this);
m_Components.insert_or_assign(eReplicaComponentType::PROPERTY_VENDOR, component); // m_Components.insert_or_assign(eReplicaComponentType::PROPERTY_VENDOR, component);
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_MANAGEMENT, -1) != -1) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_MANAGEMENT, -1) != -1) {
auto* component = new PropertyManagementComponent(this); // auto* component = new PropertyManagementComponent(this);
m_Components.insert_or_assign(eReplicaComponentType::PROPERTY_MANAGEMENT, component); // m_Components.insert_or_assign(eReplicaComponentType::PROPERTY_MANAGEMENT, component);
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BOUNCER, -1) != -1) { // you have to determine it like this because all bouncers have a componentID of 0 // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BOUNCER, -1) != -1) { // you have to determine it like this because all bouncers have a componentID of 0
BouncerComponent* comp = new BouncerComponent(this); // BouncerComponent* comp = new BouncerComponent(this);
m_Components.insert(std::make_pair(eReplicaComponentType::BOUNCER, comp)); // m_Components.insert(std::make_pair(eReplicaComponentType::BOUNCER, comp));
} // }
int32_t renderComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER); // int32_t renderComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER);
if ((renderComponentId > 0 && m_TemplateID != 2365) || m_Character) { // if ((renderComponentId > 0 && m_TemplateID != 2365) || m_Character) {
RenderComponent* render = new RenderComponent(this, renderComponentId); // RenderComponent* render = new RenderComponent(this, renderComponentId);
m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render)); // m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render));
} // }
if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MISSION_OFFER) > 0) || m_Character) { // if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MISSION_OFFER) > 0) || m_Character) {
m_Components.insert(std::make_pair(eReplicaComponentType::MISSION_OFFER, new MissionOfferComponent(this, m_TemplateID))); // m_Components.insert(std::make_pair(eReplicaComponentType::MISSION_OFFER, new MissionOfferComponent(this, m_TemplateID)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUILD_BORDER, -1) != -1) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUILD_BORDER, -1) != -1) {
m_Components.insert(std::make_pair(eReplicaComponentType::BUILD_BORDER, new BuildBorderComponent(this))); // m_Components.insert(std::make_pair(eReplicaComponentType::BUILD_BORDER, new BuildBorderComponent(this)));
} // }
// Scripted activity component // Scripted activity component
int scriptedActivityID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SCRIPTED_ACTIVITY); // int scriptedActivityID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SCRIPTED_ACTIVITY);
if ((scriptedActivityID > 0)) { // if ((scriptedActivityID > 0)) {
m_Components.insert(std::make_pair(eReplicaComponentType::SCRIPTED_ACTIVITY, new ScriptedActivityComponent(this, scriptedActivityID))); // m_Components.insert(std::make_pair(eReplicaComponentType::SCRIPTED_ACTIVITY, new ScriptedActivityComponent(this, scriptedActivityID)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODEL, -1) != -1 && !GetComponent<PetComponent>()) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODEL, -1) != -1 && !GetComponent<PetComponent>()) {
m_Components.insert(std::make_pair(eReplicaComponentType::MODEL, new ModelComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::MODEL, new ModelComponent(this)));
@ -487,9 +487,9 @@ Entity::Initialize() {
} }
// Shooting gallery component // Shooting gallery component
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SHOOTING_GALLERY) > 0) { // if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SHOOTING_GALLERY) > 0) {
m_Components.insert(std::make_pair(eReplicaComponentType::SHOOTING_GALLERY, new ShootingGalleryComponent(this))); // m_Components.insert(std::make_pair(eReplicaComponentType::SHOOTING_GALLERY, new ShootingGalleryComponent(this)));
} // }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY, -1) != -1) {
m_Components.insert(std::make_pair(eReplicaComponentType::PROPERTY, new PropertyComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::PROPERTY, new PropertyComponent(this)));