mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-13 03:28:28 +00:00
feat: Add component ID to root component object
This commit is contained in:
236
dGame/Entity.cpp
236
dGame/Entity.cpp
@@ -199,7 +199,7 @@ void Entity::Initialize() {
|
|||||||
|
|
||||||
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>(-1, triggerInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup groups
|
* Setup groups
|
||||||
@@ -234,11 +234,11 @@ void Entity::Initialize() {
|
|||||||
|
|
||||||
AddComponent<SimplePhysicsComponent>(simplePhysicsComponentID);
|
AddComponent<SimplePhysicsComponent>(simplePhysicsComponentID);
|
||||||
|
|
||||||
AddComponent<ModelComponent>()->LoadBehaviors();
|
AddComponent<ModelComponent>(-1)->LoadBehaviors();
|
||||||
|
|
||||||
AddComponent<RenderComponent>();
|
AddComponent<RenderComponent>(-1);
|
||||||
|
|
||||||
auto* destroyableComponent = AddComponent<DestroyableComponent>();
|
auto* destroyableComponent = AddComponent<DestroyableComponent>(-1);
|
||||||
destroyableComponent->SetHealth(1);
|
destroyableComponent->SetHealth(1);
|
||||||
destroyableComponent->SetMaxHealth(1.0f);
|
destroyableComponent->SetMaxHealth(1.0f);
|
||||||
destroyableComponent->SetFaction(-1, true);
|
destroyableComponent->SetFaction(-1, true);
|
||||||
@@ -254,37 +254,42 @@ void Entity::Initialize() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (m_Character && m_Character->GetParentUser()) {
|
if (m_Character && m_Character->GetParentUser()) {
|
||||||
AddComponent<MissionComponent>()->LoadFromXml(m_Character->GetXMLDoc());
|
AddComponent<MissionComponent>(-1)->LoadFromXml(m_Character->GetXMLDoc());
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t petComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PET);
|
const auto petComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PET);
|
||||||
if (petComponentId > 0) {
|
if (petComponentID > 0) {
|
||||||
AddComponent<PetComponent>(petComponentId);
|
AddComponent<PetComponent>(petComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MINI_GAME_CONTROL) > 0) {
|
const auto minigameControlID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MINI_GAME_CONTROL);
|
||||||
AddComponent<MiniGameControlComponent>();
|
if (minigameControlID > 0) {
|
||||||
|
AddComponent<MiniGameControlComponent>(minigameControlID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t possessableComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::POSSESSABLE);
|
const auto possessableComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::POSSESSABLE);
|
||||||
if (possessableComponentId > 0) {
|
if (possessableComponentID > 0) {
|
||||||
AddComponent<PossessableComponent>(possessableComponentId);
|
AddComponent<PossessableComponent>(possessableComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODULE_ASSEMBLY) > 0) {
|
const auto moduleAssemblyID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODULE_ASSEMBLY);
|
||||||
AddComponent<ModuleAssemblyComponent>();
|
if (moduleAssemblyID > 0) {
|
||||||
|
AddComponent<ModuleAssemblyComponent>(moduleAssemblyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_STATS) > 0) {
|
const auto racingStatsID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_STATS);
|
||||||
AddComponent<RacingStatsComponent>();
|
if (racingStatsID > 0) {
|
||||||
|
AddComponent<RacingStatsComponent>(racingStatsID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::LUP_EXHIBIT, -1) >= 0) {
|
const auto lupExhibitID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::LUP_EXHIBIT, -1);
|
||||||
AddComponent<LUPExhibitComponent>();
|
if (lupExhibitID >= 0) {
|
||||||
|
AddComponent<LUPExhibitComponent>(lupExhibitID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_CONTROL) > 0) {
|
const auto racingControlID =compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_CONTROL);
|
||||||
AddComponent<RacingControlComponent>();
|
if (racingControlID > 0) {
|
||||||
|
AddComponent<RacingControlComponent>(racingControlID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto propertyEntranceComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_ENTRANCE);
|
const auto propertyEntranceComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_ENTRANCE);
|
||||||
@@ -292,7 +297,7 @@ void Entity::Initialize() {
|
|||||||
AddComponent<PropertyEntranceComponent>(propertyEntranceComponentID);
|
AddComponent<PropertyEntranceComponent>(propertyEntranceComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t controllablePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CONTROLLABLE_PHYSICS);
|
const auto controllablePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CONTROLLABLE_PHYSICS);
|
||||||
if (controllablePhysicsComponentID > 0) {
|
if (controllablePhysicsComponentID > 0) {
|
||||||
auto* controllablePhysics = AddComponent<ControllablePhysicsComponent>(controllablePhysicsComponentID);
|
auto* controllablePhysics = AddComponent<ControllablePhysicsComponent>(controllablePhysicsComponentID);
|
||||||
|
|
||||||
@@ -337,46 +342,48 @@ void Entity::Initialize() {
|
|||||||
AddComponent<SimplePhysicsComponent>(simplePhysicsComponentID);
|
AddComponent<SimplePhysicsComponent>(simplePhysicsComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t rigidBodyPhantomPhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS);
|
const auto rigidBodyPhantomPhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS);
|
||||||
if (rigidBodyPhantomPhysicsComponentID > 0) {
|
if (rigidBodyPhantomPhysicsComponentID > 0) {
|
||||||
AddComponent<RigidbodyPhantomPhysicsComponent>(rigidBodyPhantomPhysicsComponentID);
|
AddComponent<RigidbodyPhantomPhysicsComponent>(rigidBodyPhantomPhysicsComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t phantomPhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PHANTOM_PHYSICS);
|
const auto phantomPhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PHANTOM_PHYSICS);
|
||||||
if (markedAsPhantom || phantomPhysicsComponentID > 0) {
|
if (markedAsPhantom || phantomPhysicsComponentID > 0) {
|
||||||
AddComponent<PhantomPhysicsComponent>(phantomPhysicsComponentID)->SetPhysicsEffectActive(false);
|
AddComponent<PhantomPhysicsComponent>(phantomPhysicsComponentID)->SetPhysicsEffectActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t havokVehiclePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::HAVOK_VEHICLE_PHYSICS);
|
const auto havokVehiclePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::HAVOK_VEHICLE_PHYSICS);
|
||||||
if (havokVehiclePhysicsComponentID > 0) {
|
if (havokVehiclePhysicsComponentID > 0) {
|
||||||
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>(havokVehiclePhysicsComponentID);
|
auto* havokVehiclePhysicsComponent = AddComponent<HavokVehiclePhysicsComponent>(havokVehiclePhysicsComponentID);
|
||||||
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition);
|
||||||
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SOUND_TRIGGER, -1) != -1) {
|
const auto soundTriggerID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SOUND_TRIGGER, -1);
|
||||||
AddComponent<SoundTriggerComponent>();
|
const auto racingSoundTriggerID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_SOUND_TRIGGER, -1);
|
||||||
} else if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_SOUND_TRIGGER, -1) != -1) {
|
if (soundTriggerID > -1) {
|
||||||
AddComponent<RacingSoundTriggerComponent>();
|
AddComponent<SoundTriggerComponent>(soundTriggerID);
|
||||||
|
} else if (racingSoundTriggerID > -1) {
|
||||||
|
AddComponent<RacingSoundTriggerComponent>(racingSoundTriggerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF) > 0) {
|
const auto buffComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF);
|
||||||
AddComponent<BuffComponent>();
|
if (buffComponentID > 0) {
|
||||||
|
AddComponent<BuffComponent>(buffComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int collectibleComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::COLLECTIBLE);
|
const auto collectibleComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::COLLECTIBLE);
|
||||||
|
|
||||||
if (collectibleComponentID > 0) {
|
if (collectibleComponentID > 0) {
|
||||||
AddComponent<CollectibleComponent>(GetVarAs<int32_t>(u"collectible_id"));
|
AddComponent<CollectibleComponent>(collectibleComponentID, GetVarAs<int32_t>(u"collectible_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiple components require the destructible component.
|
* Multiple components require the destructible component.
|
||||||
*/
|
*/
|
||||||
const int buffComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF);
|
const auto quickBuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD);
|
||||||
const int quickBuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD);
|
|
||||||
|
|
||||||
int componentID = -1;
|
int32_t componentID = -1;
|
||||||
if (collectibleComponentID > 0) componentID = collectibleComponentID;
|
if (collectibleComponentID > 0) componentID = collectibleComponentID;
|
||||||
if (quickBuildComponentID > 0) componentID = quickBuildComponentID;
|
if (quickBuildComponentID > 0) componentID = quickBuildComponentID;
|
||||||
if (buffComponentID > 0) componentID = buffComponentID;
|
if (buffComponentID > 0) componentID = buffComponentID;
|
||||||
@@ -384,7 +391,7 @@ void Entity::Initialize() {
|
|||||||
|
|
||||||
bool isSmashable = GetVarAs<int32_t>(u"is_smashable") != 0;
|
bool isSmashable = GetVarAs<int32_t>(u"is_smashable") != 0;
|
||||||
if (buffComponentID > 0 || collectibleComponentID > 0 || isSmashable) {
|
if (buffComponentID > 0 || collectibleComponentID > 0 || isSmashable) {
|
||||||
DestroyableComponent* comp = AddComponent<DestroyableComponent>();
|
DestroyableComponent* comp = AddComponent<DestroyableComponent>(componentID);
|
||||||
auto* const destCompTable = CDClientManager::GetTable<CDDestructibleComponentTable>();
|
auto* const destCompTable = CDClientManager::GetTable<CDDestructibleComponentTable>();
|
||||||
std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([componentID](const CDDestructibleComponent& entry) { return (entry.id == componentID); });
|
std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([componentID](const CDDestructibleComponent& entry) { return (entry.id == componentID); });
|
||||||
|
|
||||||
@@ -473,27 +480,30 @@ void Entity::Initialize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CHARACTER) > 0 || m_Character) {
|
const auto characterID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CHARACTER);
|
||||||
|
if (characterID > 0 || m_Character) {
|
||||||
// Character Component always has a possessor, level, and forced movement components
|
// Character Component always has a possessor, level, and forced movement components
|
||||||
AddComponent<PossessorComponent>();
|
AddComponent<PossessorComponent>(characterID);
|
||||||
|
|
||||||
// load in the xml for the level
|
// load in the xml for the level
|
||||||
AddComponent<LevelProgressionComponent>()->LoadFromXml(m_Character->GetXMLDoc());
|
AddComponent<LevelProgressionComponent>(characterID)->LoadFromXml(m_Character->GetXMLDoc());
|
||||||
|
|
||||||
AddComponent<PlayerForcedMovementComponent>();
|
AddComponent<PlayerForcedMovementComponent>(characterID);
|
||||||
|
|
||||||
auto& systemAddress = m_Character->GetParentUser() ? m_Character->GetParentUser()->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS;
|
auto& systemAddress = m_Character->GetParentUser() ? m_Character->GetParentUser()->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS;
|
||||||
AddComponent<CharacterComponent>(m_Character, systemAddress)->LoadFromXml(m_Character->GetXMLDoc());
|
AddComponent<CharacterComponent>(characterID, m_Character, systemAddress)->LoadFromXml(m_Character->GetXMLDoc());
|
||||||
|
|
||||||
AddComponent<GhostComponent>();
|
AddComponent<GhostComponent>(characterID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::INVENTORY) > 0 || m_Character) {
|
const auto inventoryID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::INVENTORY);
|
||||||
AddComponent<InventoryComponent>();
|
if (inventoryID > 0 || m_Character) {
|
||||||
|
AddComponent<InventoryComponent>(inventoryID);
|
||||||
}
|
}
|
||||||
// if this component exists, then we initialize it. it's value is always 0
|
// if this component exists, then we initialize it. it's value is always 0
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MULTI_ZONE_ENTRANCE, -1) != -1) {
|
const auto multiZoneEntranceID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MULTI_ZONE_ENTRANCE, -1);
|
||||||
AddComponent<MultiZoneEntranceComponent>();
|
if (multiZoneEntranceID > -1) {
|
||||||
|
AddComponent<MultiZoneEntranceComponent>(multiZoneEntranceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -545,7 +555,7 @@ void Entity::Initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!scriptName.empty() || client || m_Character || scriptComponentID >= 0) {
|
if (!scriptName.empty() || client || m_Character || scriptComponentID >= 0) {
|
||||||
AddComponent<ScriptComponent>(scriptName, true, client && scriptName.empty());
|
AddComponent<ScriptComponent>(scriptComponentID, scriptName, true, client && scriptName.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZoneControl script
|
// ZoneControl script
|
||||||
@@ -554,26 +564,27 @@ void Entity::Initialize() {
|
|||||||
const CDZoneTable* const zoneData = CDZoneTableTable::Query(zoneID.GetMapID());
|
const CDZoneTable* const zoneData = CDZoneTableTable::Query(zoneID.GetMapID());
|
||||||
|
|
||||||
if (zoneData != nullptr) {
|
if (zoneData != nullptr) {
|
||||||
int zoneScriptID = zoneData->scriptID;
|
const int32_t zoneScriptID = zoneData->scriptID;
|
||||||
CDScriptComponent zoneScriptData = scriptCompTable->GetByID(zoneScriptID);
|
CDScriptComponent zoneScriptData = scriptCompTable->GetByID(zoneScriptID);
|
||||||
AddComponent<ScriptComponent>(zoneScriptData.script_name, true);
|
AddComponent<ScriptComponent>(zoneScriptID, zoneScriptData.script_name, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SKILL, -1) != -1 || m_Character) {
|
const auto skillID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SKILL, -1);
|
||||||
AddComponent<SkillComponent>();
|
if (skillID > -1 || m_Character) {
|
||||||
|
AddComponent<SkillComponent>(skillID);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
AddComponent<BaseCombatAIComponent>(combatAiId);
|
AddComponent<BaseCombatAIComponent>(combatAiID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const int componentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD) > 0) {
|
if (quickBuildComponentID > 0) {
|
||||||
auto* const quickBuildComponent = AddComponent<QuickBuildComponent>();
|
auto* const quickBuildComponent = AddComponent<QuickBuildComponent>(quickBuildComponentID);
|
||||||
|
|
||||||
CDRebuildComponentTable* const rebCompTable = CDClientManager::GetTable<CDRebuildComponentTable>();
|
CDRebuildComponentTable* const rebCompTable = CDClientManager::GetTable<CDRebuildComponentTable>();
|
||||||
const std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([=](CDRebuildComponent entry) { return (entry.id == quickBuildComponentID); });
|
const std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([quickBuildComponentID](CDRebuildComponent entry) { return (entry.id == quickBuildComponentID); });
|
||||||
|
|
||||||
if (!rebCompData.empty()) {
|
if (!rebCompData.empty()) {
|
||||||
quickBuildComponent->SetResetTime(rebCompData[0].reset_time);
|
quickBuildComponent->SetResetTime(rebCompData[0].reset_time);
|
||||||
@@ -618,53 +629,63 @@ void Entity::Initialize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SWITCH, -1) != -1) {
|
const auto switchID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SWITCH, -1);
|
||||||
AddComponent<SwitchComponent>();
|
if (switchID > -1) {
|
||||||
|
AddComponent<SwitchComponent>(switchID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VENDOR) > 0)) {
|
const auto vendorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VENDOR);
|
||||||
AddComponent<VendorComponent>();
|
const auto donationVendorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::DONATION_VENDOR, -1);
|
||||||
} else if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::DONATION_VENDOR, -1) != -1)) {
|
const auto achievementVendorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ACHIEVEMENT_VENDOR, -1);
|
||||||
AddComponent<DonationVendorComponent>();
|
if (vendorID > 0) {
|
||||||
} else if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ACHIEVEMENT_VENDOR, -1) != -1)) {
|
AddComponent<VendorComponent>(vendorID);
|
||||||
AddComponent<AchievementVendorComponent>();
|
} else if (donationVendorID > -1) {
|
||||||
|
AddComponent<DonationVendorComponent>(donationVendorID);
|
||||||
|
} else if (achievementVendorID > -1) {
|
||||||
|
AddComponent<AchievementVendorComponent>(achievementVendorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_VENDOR, -1) != -1) {
|
const auto propertyVendorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_VENDOR, -1);
|
||||||
AddComponent<PropertyVendorComponent>();
|
if (propertyVendorID > -1) {
|
||||||
|
AddComponent<PropertyVendorComponent>(propertyVendorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_MANAGEMENT, -1) != -1) {
|
const auto propertyManagementID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_MANAGEMENT, -1);
|
||||||
AddComponent<PropertyManagementComponent>();
|
if (propertyManagementID > -1) {
|
||||||
|
AddComponent<PropertyManagementComponent>(propertyManagementID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BOUNCER, -1) != -1) { // you have to determine it like this because all bouncers have a componentID of 0
|
const auto bouncerID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BOUNCER, -1);
|
||||||
AddComponent<BouncerComponent>();
|
if (bouncerID > -1) { // you have to determine it like this because all bouncers have a componentID of 0
|
||||||
|
AddComponent<BouncerComponent>(bouncerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t renderComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER);
|
const auto renderComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER);
|
||||||
if ((renderComponentId > 0 && m_TemplateID != 2365) || m_Character) {
|
if ((renderComponentID > 0 && m_TemplateID != 2365) || m_Character) {
|
||||||
AddComponent<RenderComponent>(renderComponentId);
|
AddComponent<RenderComponent>(renderComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MISSION_OFFER) > 0) || m_Character) {
|
const auto missionOfferComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MISSION_OFFER, -1);
|
||||||
AddComponent<MissionOfferComponent>(m_TemplateID);
|
if (missionOfferComponentID > -1 || m_Character) {
|
||||||
|
AddComponent<MissionOfferComponent>(missionOfferComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUILD_BORDER, -1) != -1) {
|
const auto buildBorderID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUILD_BORDER, -1);
|
||||||
AddComponent<BuildBorderComponent>();
|
if (buildBorderID > -1) {
|
||||||
|
AddComponent<BuildBorderComponent>(buildBorderID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scripted activity component
|
// Scripted activity component
|
||||||
const int32_t scriptedActivityID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SCRIPTED_ACTIVITY, -1);
|
const auto scriptedActivityID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SCRIPTED_ACTIVITY, -1);
|
||||||
if (scriptedActivityID != -1) {
|
if (scriptedActivityID > -1) {
|
||||||
AddComponent<ScriptedActivityComponent>(scriptedActivityID);
|
AddComponent<ScriptedActivityComponent>(scriptedActivityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODEL, -1) != -1 && !GetComponent<PetComponent>()) {
|
const auto modelID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODEL, -1);
|
||||||
AddComponent<ModelComponent>()->LoadBehaviors();
|
if (modelID > -1 && !GetComponent<PetComponent>()) {
|
||||||
|
AddComponent<ModelComponent>(modelID)->LoadBehaviors();
|
||||||
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
|
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
|
||||||
auto* const destroyableComponent = AddComponent<DestroyableComponent>();
|
auto* const destroyableComponent = AddComponent<DestroyableComponent>(-1);
|
||||||
destroyableComponent->SetHealth(1);
|
destroyableComponent->SetHealth(1);
|
||||||
destroyableComponent->SetMaxHealth(1.0f);
|
destroyableComponent->SetMaxHealth(1.0f);
|
||||||
destroyableComponent->SetFaction(-1, true);
|
destroyableComponent->SetFaction(-1, true);
|
||||||
@@ -672,9 +693,10 @@ void Entity::Initialize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PetComponent* petComponent;
|
PetComponent* petComponent{};
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ITEM) > 0 && !TryGetComponent(eReplicaComponentType::PET, petComponent) && !HasComponent(eReplicaComponentType::MODEL)) {
|
const auto itemID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ITEM);
|
||||||
AddComponent<ItemComponent>();
|
if (itemID > 0 && !TryGetComponent(eReplicaComponentType::PET, petComponent) && !HasComponent(eReplicaComponentType::MODEL)) {
|
||||||
|
AddComponent<ItemComponent>(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shooting gallery component
|
// Shooting gallery component
|
||||||
@@ -683,16 +705,17 @@ void Entity::Initialize() {
|
|||||||
AddComponent<ShootingGalleryComponent>(shootingGalleryComponentID);
|
AddComponent<ShootingGalleryComponent>(shootingGalleryComponentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY, -1) != -1) {
|
const auto propertyID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY, -1);
|
||||||
AddComponent<PropertyComponent>();
|
if (propertyID > -1) {
|
||||||
|
AddComponent<PropertyComponent>(propertyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int rocketId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ROCKET_LAUNCH);
|
const auto rocketID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ROCKET_LAUNCH);
|
||||||
if ((rocketId > 0)) {
|
if ((rocketID > 0)) {
|
||||||
AddComponent<RocketLaunchpadControlComponent>(rocketId);
|
AddComponent<RocketLaunchpadControlComponent>(rocketID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t railComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RAIL_ACTIVATOR);
|
const auto railComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RAIL_ACTIVATOR);
|
||||||
if (railComponentID > 0) {
|
if (railComponentID > 0) {
|
||||||
AddComponent<RailActivatorComponent>(railComponentID);
|
AddComponent<RailActivatorComponent>(railComponentID);
|
||||||
}
|
}
|
||||||
@@ -722,9 +745,9 @@ void Entity::Initialize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddComponent<MovementAIComponent>(moveInfo);
|
AddComponent<MovementAIComponent>(movementAIID, moveInfo);
|
||||||
}
|
}
|
||||||
} else if (petComponentId > 0 || combatAiId > 0 && GetComponent<BaseCombatAIComponent>()->GetTetherSpeed() > 0) {
|
} else if (petComponentID > 0 || combatAiID > 0 && GetComponent<BaseCombatAIComponent>()->GetTetherSpeed() > 0) {
|
||||||
MovementAIInfo moveInfo{
|
MovementAIInfo moveInfo{
|
||||||
.movementType = "",
|
.movementType = "",
|
||||||
.wanderRadius = 16,
|
.wanderRadius = 16,
|
||||||
@@ -734,7 +757,7 @@ void Entity::Initialize() {
|
|||||||
.wanderDelayMax = 5,
|
.wanderDelayMax = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
AddComponent<MovementAIComponent>(moveInfo);
|
AddComponent<MovementAIComponent>(-1, moveInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string pathName = GetVarAsString(u"attached_path");
|
const std::string pathName = GetVarAsString(u"attached_path");
|
||||||
@@ -744,10 +767,10 @@ void Entity::Initialize() {
|
|||||||
if (path) {
|
if (path) {
|
||||||
// if we have a moving platform path, then we need a moving platform component
|
// if we have a moving platform path, then we need a moving platform component
|
||||||
if (path->pathType == PathType::MovingPlatform) {
|
if (path->pathType == PathType::MovingPlatform) {
|
||||||
AddComponent<MovingPlatformComponent>(pathName);
|
AddComponent<MovingPlatformComponent>(-1, pathName);
|
||||||
} else if (path->pathType == PathType::Movement) {
|
} else if (path->pathType == PathType::Movement) {
|
||||||
auto* const movementAIcomponent = GetComponent<MovementAIComponent>();
|
auto* const movementAIcomponent = GetComponent<MovementAIComponent>();
|
||||||
if (movementAIcomponent && combatAiId == 0) {
|
if (movementAIcomponent && combatAiID == 0) {
|
||||||
movementAIcomponent->SetPath(pathName);
|
movementAIcomponent->SetPath(pathName);
|
||||||
} else {
|
} else {
|
||||||
MovementAIInfo moveInfo{
|
MovementAIInfo moveInfo{
|
||||||
@@ -759,24 +782,24 @@ void Entity::Initialize() {
|
|||||||
.wanderDelayMax = 5,
|
.wanderDelayMax = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
AddComponent<MovementAIComponent>(moveInfo);
|
AddComponent<MovementAIComponent>(-1, moveInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// else we still need to setup moving platform if it has a moving platform comp but no path
|
// else we still need to setup moving platform if it has a moving platform comp but no path
|
||||||
const int32_t movingPlatformComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MOVING_PLATFORM, -1);
|
const auto movingPlatformComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MOVING_PLATFORM, -1);
|
||||||
if (movingPlatformComponentId >= 0) {
|
if (movingPlatformComponentID >= 0) {
|
||||||
AddComponent<MovingPlatformComponent>(pathName);
|
AddComponent<MovingPlatformComponent>(movingPlatformComponentID, pathName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int proximityMonitorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROXIMITY_MONITOR);
|
const auto proximityMonitorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROXIMITY_MONITOR);
|
||||||
if (proximityMonitorID > 0) {
|
if (proximityMonitorID > 0) {
|
||||||
auto* const proxCompTable = CDClientManager::GetTable<CDProximityMonitorComponentTable>();
|
auto* const proxCompTable = CDClientManager::GetTable<CDProximityMonitorComponentTable>();
|
||||||
const auto proxCompData = proxCompTable->Query([proximityMonitorID](const CDProximityMonitorComponent& entry) { return (entry.id == proximityMonitorID); });
|
const auto proxCompData = proxCompTable->Query([proximityMonitorID](const CDProximityMonitorComponent& entry) { return (entry.id == proximityMonitorID); });
|
||||||
if (proxCompData.size() > 0) {
|
if (proxCompData.size() > 0) {
|
||||||
std::vector<std::string> proximityStr = GeneralUtils::SplitString(proxCompData[0].Proximities, ',');
|
std::vector<std::string> proximityStr = GeneralUtils::SplitString(proxCompData[0].Proximities, ',');
|
||||||
AddComponent<ProximityMonitorComponent>(std::stoi(proximityStr[0]), std::stoi(proximityStr[1]));
|
AddComponent<ProximityMonitorComponent>(proximityMonitorID, std::stoi(proximityStr[0]), std::stoi(proximityStr[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -882,12 +905,13 @@ void Entity::Unsubscribe(LWOOBJID scriptObjId, const std::string& notificationNa
|
|||||||
|
|
||||||
void Entity::SetProximityRadius(float proxRadius, std::string name) {
|
void Entity::SetProximityRadius(float proxRadius, std::string name) {
|
||||||
auto* proxMon = GetComponent<ProximityMonitorComponent>();
|
auto* proxMon = GetComponent<ProximityMonitorComponent>();
|
||||||
if (!proxMon) proxMon = AddComponent<ProximityMonitorComponent>();
|
if (!proxMon) proxMon = AddComponent<ProximityMonitorComponent>(-1);
|
||||||
proxMon->SetProximityRadius(proxRadius, name);
|
proxMon->SetProximityRadius(proxRadius, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::SetProximityRadius(dpEntity* entity, std::string name) {
|
void Entity::SetProximityRadius(dpEntity* entity, std::string name) {
|
||||||
ProximityMonitorComponent* proxMon = AddComponent<ProximityMonitorComponent>();
|
auto* proxMon = GetComponent<ProximityMonitorComponent>();
|
||||||
|
if (!proxMon) proxMon = AddComponent<ProximityMonitorComponent>(-1);
|
||||||
proxMon->SetProximityRadius(entity, name);
|
proxMon->SetProximityRadius(entity, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
#include "CDMissionsTable.h"
|
#include "CDMissionsTable.h"
|
||||||
|
|
||||||
AchievementVendorComponent::AchievementVendorComponent(Entity* parent) : VendorComponent(parent) {
|
AchievementVendorComponent::AchievementVendorComponent(Entity* parent, const int32_t componentID) : VendorComponent(parent, componentID) {
|
||||||
RefreshInventory(true);
|
RefreshInventory(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Entity;
|
|||||||
class AchievementVendorComponent final : public VendorComponent {
|
class AchievementVendorComponent final : public VendorComponent {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ACHIEVEMENT_VENDOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ACHIEVEMENT_VENDOR;
|
||||||
AchievementVendorComponent(Entity* parent);
|
AchievementVendorComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
void RefreshInventory(bool isCreation = false) override;
|
void RefreshInventory(bool isCreation = false) override;
|
||||||
bool SellsItem(Entity* buyer, const LOT lot);
|
bool SellsItem(Entity* buyer, const LOT lot);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
|
|
||||||
ActivityComponent::ActivityComponent(Entity* parent, int32_t activityID) : Component(parent) {
|
ActivityComponent::ActivityComponent(Entity* parent, int32_t componentID) : Component(parent, componentID) {
|
||||||
using namespace GameMessages;
|
using namespace GameMessages;
|
||||||
RegisterMsg<GetObjectReportInfo>(this, &ActivityComponent::OnGetObjectReportInfo);
|
RegisterMsg<GetObjectReportInfo>(this, &ActivityComponent::OnGetObjectReportInfo);
|
||||||
/*
|
/*
|
||||||
@@ -39,8 +39,8 @@ ActivityComponent::ActivityComponent(Entity* parent, int32_t activityID) : Compo
|
|||||||
* if activityID is specified and if that column exists in the activities table, update the activity info with that data.
|
* if activityID is specified and if that column exists in the activities table, update the activity info with that data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
m_ActivityID = activityID;
|
m_ActivityID = componentID;
|
||||||
LoadActivityData(activityID);
|
LoadActivityData(componentID);
|
||||||
if (m_Parent->HasVar(u"activityID")) {
|
if (m_Parent->HasVar(u"activityID")) {
|
||||||
m_ActivityID = parent->GetVar<int32_t>(u"activityID");
|
m_ActivityID = parent->GetVar<int32_t>(u"activityID");
|
||||||
LoadActivityData(m_ActivityID);
|
LoadActivityData(m_ActivityID);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "CDPhysicsComponentTable.h"
|
#include "CDPhysicsComponentTable.h"
|
||||||
#include "dNavMesh.h"
|
#include "dNavMesh.h"
|
||||||
|
|
||||||
BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id) : Component(parent) {
|
BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Target = LWOOBJID_EMPTY;
|
m_Target = LWOOBJID_EMPTY;
|
||||||
m_DirtyStateOrTarget = true;
|
m_DirtyStateOrTarget = true;
|
||||||
m_State = AiState::spawn;
|
m_State = AiState::spawn;
|
||||||
@@ -43,7 +43,7 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id)
|
|||||||
//Grab the aggro information from BaseCombatAI:
|
//Grab the aggro information from BaseCombatAI:
|
||||||
auto componentQuery = CDClientDatabase::CreatePreppedStmt(
|
auto componentQuery = CDClientDatabase::CreatePreppedStmt(
|
||||||
"SELECT aggroRadius, tetherSpeed, pursuitSpeed, softTetherRadius, hardTetherRadius FROM BaseCombatAIComponent WHERE id = ?;");
|
"SELECT aggroRadius, tetherSpeed, pursuitSpeed, softTetherRadius, hardTetherRadius FROM BaseCombatAIComponent WHERE id = ?;");
|
||||||
componentQuery.bind(1, static_cast<int>(id));
|
componentQuery.bind(1, static_cast<int>(componentID));
|
||||||
|
|
||||||
auto componentResult = componentQuery.execQuery();
|
auto componentResult = componentQuery.execQuery();
|
||||||
|
|
||||||
@@ -111,12 +111,12 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id)
|
|||||||
int32_t collisionGroup = (COLLISION_GROUP_DYNAMIC | COLLISION_GROUP_ENEMY);
|
int32_t collisionGroup = (COLLISION_GROUP_DYNAMIC | COLLISION_GROUP_ENEMY);
|
||||||
|
|
||||||
CDComponentsRegistryTable* componentRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
CDComponentsRegistryTable* componentRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
||||||
auto componentID = componentRegistryTable->GetByIDAndType(parent->GetLOT(), eReplicaComponentType::CONTROLLABLE_PHYSICS);
|
const auto controllablePhysicsID = componentRegistryTable->GetByIDAndType(parent->GetLOT(), eReplicaComponentType::CONTROLLABLE_PHYSICS);
|
||||||
|
|
||||||
CDPhysicsComponentTable* physicsComponentTable = CDClientManager::GetTable<CDPhysicsComponentTable>();
|
CDPhysicsComponentTable* physicsComponentTable = CDClientManager::GetTable<CDPhysicsComponentTable>();
|
||||||
|
|
||||||
if (physicsComponentTable != nullptr) {
|
if (physicsComponentTable != nullptr) {
|
||||||
auto* info = physicsComponentTable->GetByID(componentID);
|
auto* info = physicsComponentTable->GetByID(controllablePhysicsID);
|
||||||
if (info != nullptr) {
|
if (info != nullptr) {
|
||||||
collisionGroup = info->bStatic ? COLLISION_GROUP_NEUTRAL : info->collisionGroup;
|
collisionGroup = info->bStatic ? COLLISION_GROUP_NEUTRAL : info->collisionGroup;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class BaseCombatAIComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI;
|
||||||
|
|
||||||
BaseCombatAIComponent(Entity* parentEntity, uint32_t id);
|
BaseCombatAIComponent(Entity* parentEntity, int32_t componentID);
|
||||||
~BaseCombatAIComponent() override;
|
~BaseCombatAIComponent() override;
|
||||||
|
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "eTriggerEventType.h"
|
#include "eTriggerEventType.h"
|
||||||
|
|
||||||
BouncerComponent::BouncerComponent(Entity* parent) : Component(parent) {
|
BouncerComponent::BouncerComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_PetEnabled = false;
|
m_PetEnabled = false;
|
||||||
m_PetBouncerEnabled = false;
|
m_PetBouncerEnabled = false;
|
||||||
m_PetSwitchLoaded = false;
|
m_PetSwitchLoaded = false;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class BouncerComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER;
|
||||||
|
|
||||||
BouncerComponent(Entity* parentEntity);
|
BouncerComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
~BouncerComponent() override;
|
~BouncerComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
BuffComponent::BuffComponent(Entity* parent) : Component(parent) {
|
BuffComponent::BuffComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BuffComponent::~BuffComponent() {
|
BuffComponent::~BuffComponent() {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class BuffComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BUFF;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BUFF;
|
||||||
|
|
||||||
explicit BuffComponent(Entity* parent);
|
explicit BuffComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
~BuffComponent();
|
~BuffComponent();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
|
|
||||||
BuildBorderComponent::BuildBorderComponent(Entity* parent) : Component(parent) {
|
BuildBorderComponent::BuildBorderComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildBorderComponent::~BuildBorderComponent() {
|
BuildBorderComponent::~BuildBorderComponent() {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class BuildBorderComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
|
||||||
|
|
||||||
BuildBorderComponent(Entity* parent);
|
BuildBorderComponent(Entity* parent, const int32_t componentID);
|
||||||
~BuildBorderComponent() override;
|
~BuildBorderComponent() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "MessageType/Game.h"
|
#include "MessageType/Game.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
CharacterComponent::CharacterComponent(Entity* parent, Character* character, const SystemAddress& systemAddress) : Component(parent) {
|
CharacterComponent::CharacterComponent(Entity* parent, const int32_t componentID, Character* character, const SystemAddress& systemAddress) : Component(parent, componentID) {
|
||||||
m_Character = character;
|
m_Character = character;
|
||||||
|
|
||||||
m_IsRacing = false;
|
m_IsRacing = false;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class CharacterComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::CHARACTER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::CHARACTER;
|
||||||
|
|
||||||
CharacterComponent(Entity* parent, Character* character, const SystemAddress& systemAddress);
|
CharacterComponent(Entity* parent, const int32_t componentID, Character* character, const SystemAddress& systemAddress);
|
||||||
~CharacterComponent() override;
|
~CharacterComponent() override;
|
||||||
|
|
||||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
class CollectibleComponent final : public Component {
|
class CollectibleComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::COLLECTIBLE;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::COLLECTIBLE;
|
||||||
CollectibleComponent(Entity* parentEntity, int32_t collectibleId) : Component(parentEntity), m_CollectibleId(collectibleId) {}
|
CollectibleComponent(Entity* parentEntity, const int32_t componentID, const int32_t collectibleId) : Component(parentEntity, componentID), m_CollectibleId(collectibleId) {}
|
||||||
|
|
||||||
int16_t GetCollectibleId() const { return m_CollectibleId; }
|
int16_t GetCollectibleId() const { return m_CollectibleId; }
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool isConstruction) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool isConstruction) override;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Entity;
|
|||||||
*/
|
*/
|
||||||
class Component {
|
class Component {
|
||||||
public:
|
public:
|
||||||
Component(Entity* parent) : m_Parent{ parent } {}
|
Component(Entity* parent, const int32_t componentID) : m_Parent{ parent }, m_ComponentID{componentID} {}
|
||||||
virtual ~Component() = default;
|
virtual ~Component() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +28,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Entity* GetParent() const { return m_Parent; }
|
Entity* GetParent() const { return m_Parent; }
|
||||||
|
|
||||||
|
[[nodiscard]] int32_t GetComponentID() const noexcept { return m_ComponentID; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the component in the game loop
|
* Updates the component in the game loop
|
||||||
* @param deltaTime time passed since last update
|
* @param deltaTime time passed since last update
|
||||||
@@ -70,4 +72,11 @@ protected:
|
|||||||
* The entity that owns this component
|
* The entity that owns this component
|
||||||
*/
|
*/
|
||||||
Entity* m_Parent;
|
Entity* m_Parent;
|
||||||
|
|
||||||
|
// The component ID, this should never be changed after initialization
|
||||||
|
// This is used in various different ways
|
||||||
|
// 1. To identify which entry this component is in its corresponding table
|
||||||
|
// 2. To mark that an Entity should have the component with no database entry (it will be 0 in this case)
|
||||||
|
// 3. The component exists implicitly due to design (CollectibleComponent always has a DestructibleComponent accompanying it). In this case the ID will be -1.
|
||||||
|
const int32_t m_ComponentID;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "StringifiedEnum.h"
|
#include "StringifiedEnum.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
|
|
||||||
ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity, int32_t componentId) : PhysicsComponent(entity, componentId) {
|
ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity, const int32_t componentID) : PhysicsComponent(entity, componentID) {
|
||||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &ControllablePhysicsComponent::OnGetObjectReportInfo);
|
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &ControllablePhysicsComponent::OnGetObjectReportInfo);
|
||||||
|
|
||||||
m_Velocity = {};
|
m_Velocity = {};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class ControllablePhysicsComponent : public PhysicsComponent {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::CONTROLLABLE_PHYSICS;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::CONTROLLABLE_PHYSICS;
|
||||||
|
|
||||||
ControllablePhysicsComponent(Entity* entity, int32_t componentId);
|
ControllablePhysicsComponent(Entity* entity, const int32_t componentID);
|
||||||
~ControllablePhysicsComponent() override;
|
~ControllablePhysicsComponent() override;
|
||||||
|
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
Implementation<bool, const Entity*> DestroyableComponent::IsEnemyImplentation;
|
Implementation<bool, const Entity*> DestroyableComponent::IsEnemyImplentation;
|
||||||
Implementation<bool, const Entity*> DestroyableComponent::IsFriendImplentation;
|
Implementation<bool, const Entity*> DestroyableComponent::IsFriendImplentation;
|
||||||
|
|
||||||
DestroyableComponent::DestroyableComponent(Entity* parent) : Component(parent) {
|
DestroyableComponent::DestroyableComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
using namespace GameMessages;
|
using namespace GameMessages;
|
||||||
m_iArmor = 0;
|
m_iArmor = 0;
|
||||||
m_fMaxArmor = 0.0f;
|
m_fMaxArmor = 0.0f;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class DestroyableComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE;
|
||||||
|
|
||||||
DestroyableComponent(Entity* parentEntity);
|
DestroyableComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
~DestroyableComponent() override;
|
~DestroyableComponent() override;
|
||||||
|
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "DonationVendorComponent.h"
|
#include "DonationVendorComponent.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
|
|
||||||
DonationVendorComponent::DonationVendorComponent(Entity* parent) : VendorComponent(parent) {
|
DonationVendorComponent::DonationVendorComponent(Entity* parent, const int32_t componentID) : VendorComponent(parent, componentID) {
|
||||||
//LoadConfigData
|
//LoadConfigData
|
||||||
m_PercentComplete = 0.0;
|
m_PercentComplete = 0.0;
|
||||||
m_TotalDonated = 0;
|
m_TotalDonated = 0;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Entity;
|
|||||||
class DonationVendorComponent final : public VendorComponent {
|
class DonationVendorComponent final : public VendorComponent {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::DONATION_VENDOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::DONATION_VENDOR;
|
||||||
DonationVendorComponent(Entity* parent);
|
DonationVendorComponent(Entity* parent, const int32_t componentID);
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
uint32_t GetActivityID() {return m_ActivityId;};
|
uint32_t GetActivityID() {return m_ActivityId;};
|
||||||
void SubmitDonation(uint32_t count);
|
void SubmitDonation(uint32_t count);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "GhostComponent.h"
|
#include "GhostComponent.h"
|
||||||
|
|
||||||
GhostComponent::GhostComponent(Entity* parent) : Component(parent) {
|
GhostComponent::GhostComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_GhostReferencePoint = NiPoint3Constant::ZERO;
|
m_GhostReferencePoint = NiPoint3Constant::ZERO;
|
||||||
m_GhostOverridePoint = NiPoint3Constant::ZERO;
|
m_GhostOverridePoint = NiPoint3Constant::ZERO;
|
||||||
m_GhostOverride = false;
|
m_GhostOverride = false;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class NiPoint3;
|
|||||||
class GhostComponent final : public Component {
|
class GhostComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
static inline const eReplicaComponentType ComponentType = eReplicaComponentType::GHOST;
|
static inline const eReplicaComponentType ComponentType = eReplicaComponentType::GHOST;
|
||||||
GhostComponent(Entity* parent);
|
GhostComponent(Entity* parent, const int32_t componentID);
|
||||||
~GhostComponent() override;
|
~GhostComponent() override;
|
||||||
|
|
||||||
void SetGhostOverride(bool value) { m_GhostOverride = value; };
|
void SetGhostOverride(bool value) { m_GhostOverride = value; };
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
|
|
||||||
HavokVehiclePhysicsComponent::HavokVehiclePhysicsComponent(Entity* parent, int32_t componentId) : PhysicsComponent(parent, componentId) {
|
HavokVehiclePhysicsComponent::HavokVehiclePhysicsComponent(Entity* parent, const int32_t componentID) : PhysicsComponent(parent, componentID) {
|
||||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &HavokVehiclePhysicsComponent::OnGetObjectReportInfo);
|
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &HavokVehiclePhysicsComponent::OnGetObjectReportInfo);
|
||||||
|
|
||||||
m_Velocity = NiPoint3Constant::ZERO;
|
m_Velocity = NiPoint3Constant::ZERO;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class HavokVehiclePhysicsComponent : public PhysicsComponent {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::HAVOK_VEHICLE_PHYSICS;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::HAVOK_VEHICLE_PHYSICS;
|
||||||
|
|
||||||
HavokVehiclePhysicsComponent(Entity* parentEntity, int32_t componentId);
|
HavokVehiclePhysicsComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
InventoryComponent::InventoryComponent(Entity* parent) : Component(parent) {
|
InventoryComponent::InventoryComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
this->m_Dirty = true;
|
this->m_Dirty = true;
|
||||||
this->m_Equipped = {};
|
this->m_Equipped = {};
|
||||||
this->m_Pushed = {};
|
this->m_Pushed = {};
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
static constexpr uint32_t MaximumGroupCount = 50;
|
static constexpr uint32_t MaximumGroupCount = 50;
|
||||||
|
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
|
||||||
InventoryComponent(Entity* parent);
|
InventoryComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class ItemComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ITEM;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ITEM;
|
||||||
|
|
||||||
ItemComponent(Entity* entity) : Component(entity) {}
|
ItemComponent(Entity* entity, const int32_t componentID) : Component(entity, componentID) {}
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& bitStream, bool isConstruction) override;
|
void Serialize(RakNet::BitStream& bitStream, bool isConstruction) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class LUPExhibitComponent final : public Component
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::LUP_EXHIBIT;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::LUP_EXHIBIT;
|
||||||
|
|
||||||
LUPExhibitComponent(Entity* parent) : Component(parent) {};
|
LUPExhibitComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {};
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
void NextLUPExhibit();
|
void NextLUPExhibit();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "CDRewardsTable.h"
|
#include "CDRewardsTable.h"
|
||||||
|
|
||||||
LevelProgressionComponent::LevelProgressionComponent(Entity* parent) : Component(parent) {
|
LevelProgressionComponent::LevelProgressionComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_Level = 1;
|
m_Level = 1;
|
||||||
m_SpeedBase = 500.0f;
|
m_SpeedBase = 500.0f;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
* Constructor for this component
|
* Constructor for this component
|
||||||
* @param parent parent that contains this component
|
* @param parent parent that contains this component
|
||||||
*/
|
*/
|
||||||
LevelProgressionComponent(Entity* parent);
|
LevelProgressionComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class MiniGameControlComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MINI_GAME_CONTROL;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MINI_GAME_CONTROL;
|
||||||
|
|
||||||
MiniGameControlComponent(Entity* parent) : Component(parent) {}
|
MiniGameControlComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {}
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool isConstruction);
|
void Serialize(RakNet::BitStream& outBitStream, bool isConstruction);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
#include "MinigameComponent.h"
|
|
||||||
|
|
||||||
void MinigameComponent::Serialize(RakNet::BitStream& outBitStream, bool isConstruction) {
|
|
||||||
outBitStream.Write<uint32_t>(0x40000000);
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
std::unordered_map<AchievementCacheKey, std::vector<uint32_t>> MissionComponent::m_AchievementCache = {};
|
std::unordered_map<AchievementCacheKey, std::vector<uint32_t>> MissionComponent::m_AchievementCache = {};
|
||||||
|
|
||||||
//! Initializer
|
//! Initializer
|
||||||
MissionComponent::MissionComponent(Entity* parent) : Component(parent) {
|
MissionComponent::MissionComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_LastUsedMissionOrderUID = Game::zoneManager->GetUniqueMissionIdStartingValue();
|
m_LastUsedMissionOrderUID = Game::zoneManager->GetUniqueMissionIdStartingValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class MissionComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MISSION;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MISSION;
|
||||||
|
|
||||||
explicit MissionComponent(Entity* parent);
|
explicit MissionComponent(Entity* parent, const int32_t componentID);
|
||||||
~MissionComponent() override;
|
~MissionComponent() override;
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||||
|
|||||||
@@ -39,19 +39,13 @@ bool OfferedMission::GetAcceptsMission() const {
|
|||||||
|
|
||||||
//------------------------ MissionOfferComponent below ------------------------
|
//------------------------ MissionOfferComponent below ------------------------
|
||||||
|
|
||||||
MissionOfferComponent::MissionOfferComponent(Entity* parent, const LOT parentLot) : Component(parent) {
|
MissionOfferComponent::MissionOfferComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
auto* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
if (componentID != -1) {
|
||||||
|
|
||||||
auto value = compRegistryTable->GetByIDAndType(parentLot, eReplicaComponentType::MISSION_OFFER, -1);
|
|
||||||
|
|
||||||
if (value != -1) {
|
|
||||||
const uint32_t componentId = value;
|
|
||||||
|
|
||||||
// Now lookup the missions in the MissionNPCComponent table
|
// Now lookup the missions in the MissionNPCComponent table
|
||||||
auto* missionNpcComponentTable = CDClientManager::GetTable<CDMissionNPCComponentTable>();
|
auto* missionNpcComponentTable = CDClientManager::GetTable<CDMissionNPCComponentTable>();
|
||||||
|
|
||||||
auto missions = missionNpcComponentTable->Query([=](const CDMissionNPCComponent& entry) {
|
auto missions = missionNpcComponentTable->Query([componentID](const CDMissionNPCComponent& entry) {
|
||||||
return entry.id == static_cast<unsigned>(componentId);
|
return entry.id == static_cast<unsigned>(componentID);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto& mission : missions) {
|
for (auto& mission : missions) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class MissionOfferComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MISSION_OFFER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MISSION_OFFER;
|
||||||
|
|
||||||
MissionOfferComponent(Entity* parent, LOT parentLot);
|
MissionOfferComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the OnUse event triggered by some entity, determines which missions to show based on what they may
|
* Handles the OnUse event triggered by some entity, determines which missions to show based on what they may
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "DluAssert.h"
|
#include "DluAssert.h"
|
||||||
|
|
||||||
ModelComponent::ModelComponent(Entity* parent) : Component(parent) {
|
ModelComponent::ModelComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
using namespace GameMessages;
|
using namespace GameMessages;
|
||||||
m_OriginalPosition = m_Parent->GetDefaultPosition();
|
m_OriginalPosition = m_Parent->GetDefaultPosition();
|
||||||
m_OriginalRotation = m_Parent->GetDefaultRotation();
|
m_OriginalRotation = m_Parent->GetDefaultRotation();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class ModelComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MODEL;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MODEL;
|
||||||
|
|
||||||
ModelComponent(Entity* parent);
|
ModelComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
void LoadBehaviors();
|
void LoadBehaviors();
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "ModuleAssemblyComponent.h"
|
#include "ModuleAssemblyComponent.h"
|
||||||
|
|
||||||
ModuleAssemblyComponent::ModuleAssemblyComponent(Entity* parent) : Component(parent) {
|
ModuleAssemblyComponent::ModuleAssemblyComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_SubKey = LWOOBJID_EMPTY;
|
m_SubKey = LWOOBJID_EMPTY;
|
||||||
m_UseOptionalParts = false;
|
m_UseOptionalParts = false;
|
||||||
m_AssemblyPartsLOTs = u"";
|
m_AssemblyPartsLOTs = u"";
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class ModuleAssemblyComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MODULE_ASSEMBLY;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MODULE_ASSEMBLY;
|
||||||
|
|
||||||
ModuleAssemblyComponent(Entity* parent);
|
ModuleAssemblyComponent(Entity* parent, const int32_t componentID);
|
||||||
~ModuleAssemblyComponent() override;
|
~ModuleAssemblyComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace {
|
|||||||
std::map<LOT, float> m_PhysicsSpeedCache;
|
std::map<LOT, float> m_PhysicsSpeedCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) : Component(parent) {
|
MovementAIComponent::MovementAIComponent(Entity* parent, const int32_t componentID, MovementAIInfo info) : Component(parent, componentID) {
|
||||||
m_Info = info;
|
m_Info = info;
|
||||||
m_AtFinalWaypoint = true;
|
m_AtFinalWaypoint = true;
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class MovementAIComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MOVEMENT_AI;
|
||||||
|
|
||||||
MovementAIComponent(Entity* parentEntity, MovementAIInfo info);
|
MovementAIComponent(Entity* parentEntity, const int32_t componentID, MovementAIInfo info);
|
||||||
|
|
||||||
void SetPath(const std::string pathName);
|
void SetPath(const std::string pathName);
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void MoverSubComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsIniti
|
|||||||
|
|
||||||
//------------- MovingPlatformComponent below --------------
|
//------------- MovingPlatformComponent below --------------
|
||||||
|
|
||||||
MovingPlatformComponent::MovingPlatformComponent(Entity* parent, const std::string& pathName) : Component(parent) {
|
MovingPlatformComponent::MovingPlatformComponent(Entity* parent, const int32_t componentID, const std::string& pathName) : Component(parent, componentID) {
|
||||||
m_MoverSubComponentType = eMoverSubComponentType::mover;
|
m_MoverSubComponentType = eMoverSubComponentType::mover;
|
||||||
m_MoverSubComponent = new MoverSubComponent(m_Parent->GetDefaultPosition());
|
m_MoverSubComponent = new MoverSubComponent(m_Parent->GetDefaultPosition());
|
||||||
m_PathName = GeneralUtils::ASCIIToUTF16(pathName);
|
m_PathName = GeneralUtils::ASCIIToUTF16(pathName);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class MovingPlatformComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MOVING_PLATFORM;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MOVING_PLATFORM;
|
||||||
|
|
||||||
MovingPlatformComponent(Entity* parent, const std::string& pathName);
|
MovingPlatformComponent(Entity* parent, const int32_t componentID, const std::string& pathName);
|
||||||
~MovingPlatformComponent() override;
|
~MovingPlatformComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
|
|
||||||
MultiZoneEntranceComponent::MultiZoneEntranceComponent(Entity* parent) : Component(parent) {
|
MultiZoneEntranceComponent::MultiZoneEntranceComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_Parent->GetVar<std::u16string>(u"MultiZoneIDs"));
|
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_Parent->GetVar<std::u16string>(u"MultiZoneIDs"));
|
||||||
std::stringstream ss(zoneString);
|
std::stringstream ss(zoneString);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
* Constructor for this component, builds the m_LUPWorlds vector
|
* Constructor for this component, builds the m_LUPWorlds vector
|
||||||
* @param parent parent that contains this component
|
* @param parent parent that contains this component
|
||||||
*/
|
*/
|
||||||
MultiZoneEntranceComponent(Entity* parent);
|
MultiZoneEntranceComponent(Entity* parent, const int32_t componentID);
|
||||||
~MultiZoneEntranceComponent() override;
|
~MultiZoneEntranceComponent() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,9 +43,8 @@ std::unordered_map<LWOOBJID, LWOOBJID> PetComponent::activePets{};
|
|||||||
* while the faction ones could be checked using their respective missions.
|
* while the faction ones could be checked using their respective missions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Component{ parentEntity } {
|
PetComponent::PetComponent(Entity* parentEntity, const int32_t componentID) : Component{ parentEntity, componentID } {
|
||||||
m_PetInfo = CDClientManager::GetTable<CDPetComponentTable>()->GetByID(componentId); // TODO: Make reference when safe
|
m_PetInfo = CDClientManager::GetTable<CDPetComponentTable>()->GetByID(componentID); // TODO: Make reference when safe
|
||||||
m_ComponentId = componentId;
|
|
||||||
|
|
||||||
m_Interaction = LWOOBJID_EMPTY;
|
m_Interaction = LWOOBJID_EMPTY;
|
||||||
m_Owner = LWOOBJID_EMPTY;
|
m_Owner = LWOOBJID_EMPTY;
|
||||||
@@ -537,7 +536,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
|||||||
|
|
||||||
// Triggers the catch a pet missions
|
// Triggers the catch a pet missions
|
||||||
constexpr auto PET_FLAG_BASE = 800;
|
constexpr auto PET_FLAG_BASE = 800;
|
||||||
tamer->GetCharacter()->SetPlayerFlag(PET_FLAG_BASE + m_ComponentId, true);
|
tamer->GetCharacter()->SetPlayerFlag(PET_FLAG_BASE + m_ComponentID, true);
|
||||||
|
|
||||||
auto* missionComponent = tamer->GetComponent<MissionComponent>();
|
auto* missionComponent = tamer->GetComponent<MissionComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class PetComponent final : public Component
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PET;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PET;
|
||||||
|
|
||||||
explicit PetComponent(Entity* parentEntity, uint32_t componentId);
|
explicit PetComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
~PetComponent() override;
|
~PetComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
@@ -250,11 +250,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
static std::unordered_map<LWOOBJID, LWOOBJID> currentActivities;
|
static std::unordered_map<LWOOBJID, LWOOBJID> currentActivities;
|
||||||
|
|
||||||
/**
|
|
||||||
* The ID of the component in the pet component table
|
|
||||||
*/
|
|
||||||
uint32_t m_ComponentId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ID of the model that was built to complete the taming minigame for this pet
|
* The ID of the model that was built to complete the taming minigame for this pet
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "dpShapeBox.h"
|
#include "dpShapeBox.h"
|
||||||
#include "dpShapeSphere.h"
|
#include "dpShapeSphere.h"
|
||||||
|
|
||||||
PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent, int32_t componentId) : PhysicsComponent(parent, componentId) {
|
PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent, const int32_t componentID) : PhysicsComponent(parent, componentID) {
|
||||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &PhantomPhysicsComponent::OnGetObjectReportInfo);
|
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &PhantomPhysicsComponent::OnGetObjectReportInfo);
|
||||||
|
|
||||||
m_Position = m_Parent->GetDefaultPosition();
|
m_Position = m_Parent->GetDefaultPosition();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class PhantomPhysicsComponent final : public PhysicsComponent {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
|
||||||
|
|
||||||
PhantomPhysicsComponent(Entity* parent, int32_t componentId);
|
PhantomPhysicsComponent(Entity* parent, const int32_t componentID);
|
||||||
~PhantomPhysicsComponent() override;
|
~PhantomPhysicsComponent() override;
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "EntityInfo.h"
|
#include "EntityInfo.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
|
|
||||||
PhysicsComponent::PhysicsComponent(Entity* parent, int32_t componentId) : Component(parent) {
|
PhysicsComponent::PhysicsComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Position = NiPoint3Constant::ZERO;
|
m_Position = NiPoint3Constant::ZERO;
|
||||||
m_Rotation = QuatUtils::IDENTITY;
|
m_Rotation = QuatUtils::IDENTITY;
|
||||||
m_DirtyPosition = false;
|
m_DirtyPosition = false;
|
||||||
@@ -23,7 +23,7 @@ PhysicsComponent::PhysicsComponent(Entity* parent, int32_t componentId) : Compon
|
|||||||
CDPhysicsComponentTable* physicsComponentTable = CDClientManager::GetTable<CDPhysicsComponentTable>();
|
CDPhysicsComponentTable* physicsComponentTable = CDClientManager::GetTable<CDPhysicsComponentTable>();
|
||||||
|
|
||||||
if (physicsComponentTable) {
|
if (physicsComponentTable) {
|
||||||
auto* info = physicsComponentTable->GetByID(componentId);
|
auto* info = physicsComponentTable->GetByID(componentID);
|
||||||
if (info) {
|
if (info) {
|
||||||
m_CollisionGroup = info->collisionGroup;
|
m_CollisionGroup = info->collisionGroup;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class dpEntity;
|
|||||||
|
|
||||||
class PhysicsComponent : public Component {
|
class PhysicsComponent : public Component {
|
||||||
public:
|
public:
|
||||||
PhysicsComponent(Entity* parent, int32_t componentId);
|
PhysicsComponent(Entity* parent, const int32_t componentID);
|
||||||
virtual ~PhysicsComponent() = default;
|
virtual ~PhysicsComponent() = default;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "PlayerForcedMovementComponent.h"
|
#include "PlayerForcedMovementComponent.h"
|
||||||
|
|
||||||
PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent) : Component(parent) {
|
PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
* Constructor for this component
|
* Constructor for this component
|
||||||
* @param parent parent that contains this component
|
* @param parent parent that contains this component
|
||||||
*/
|
*/
|
||||||
PlayerForcedMovementComponent(Entity* parent);
|
PlayerForcedMovementComponent(Entity* parent, const int32_t componentID);
|
||||||
~PlayerForcedMovementComponent() override;
|
~PlayerForcedMovementComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Inventory.h"
|
#include "Inventory.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
|
|
||||||
PossessableComponent::PossessableComponent(Entity* parent, uint32_t componentId) : Component(parent) {
|
PossessableComponent::PossessableComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Possessor = LWOOBJID_EMPTY;
|
m_Possessor = LWOOBJID_EMPTY;
|
||||||
CDItemComponent item = Inventory::FindItemComponent(m_Parent->GetLOT());
|
CDItemComponent item = Inventory::FindItemComponent(m_Parent->GetLOT());
|
||||||
m_AnimationFlag = static_cast<eAnimationFlags>(item.animationFlag);
|
m_AnimationFlag = static_cast<eAnimationFlags>(item.animationFlag);
|
||||||
@@ -12,7 +12,7 @@ PossessableComponent::PossessableComponent(Entity* parent, uint32_t componentId)
|
|||||||
// Get the possession Type from the CDClient
|
// Get the possession Type from the CDClient
|
||||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT possessionType, depossessOnHit FROM PossessableComponent WHERE id = ?;");
|
auto query = CDClientDatabase::CreatePreppedStmt("SELECT possessionType, depossessOnHit FROM PossessableComponent WHERE id = ?;");
|
||||||
|
|
||||||
query.bind(1, static_cast<int>(componentId));
|
query.bind(1, static_cast<int>(componentID));
|
||||||
|
|
||||||
auto result = query.execQuery();
|
auto result = query.execQuery();
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,10 @@ class PossessableComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSABLE;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSABLE;
|
||||||
|
|
||||||
PossessableComponent(Entity* parentEntity, uint32_t componentId);
|
PossessableComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief mounts the Entity
|
|
||||||
*/
|
|
||||||
void Mount();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief dismounts the Entity
|
* @brief dismounts the Entity
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "eControlScheme.h"
|
#include "eControlScheme.h"
|
||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
|
|
||||||
PossessorComponent::PossessorComponent(Entity* parent) : Component(parent) {
|
PossessorComponent::PossessorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Possessable = LWOOBJID_EMPTY;
|
m_Possessable = LWOOBJID_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class PossessorComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::POSSESSOR;
|
||||||
|
|
||||||
PossessorComponent(Entity* parent);
|
PossessorComponent(Entity* parent, const int32_t componentID);
|
||||||
~PossessorComponent() override;
|
~PossessorComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
class PropertyComponent final : public Component {
|
class PropertyComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY;
|
||||||
explicit PropertyComponent(Entity* const parentEntity) noexcept : Component{ parentEntity } {}
|
explicit PropertyComponent(Entity* const parentEntity, const int32_t componentID) noexcept : Component{ parentEntity, componentID } {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !PROPERTYCOMPONENT_H
|
#endif // !PROPERTYCOMPONENT_H
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "ePropertySortType.h"
|
#include "ePropertySortType.h"
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
|
|
||||||
PropertyEntranceComponent::PropertyEntranceComponent(Entity* parent, uint32_t componentID) : Component(parent) {
|
PropertyEntranceComponent::PropertyEntranceComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
this->propertyQueries = {};
|
this->propertyQueries = {};
|
||||||
|
|
||||||
auto table = CDClientManager::GetTable<CDPropertyEntranceComponentTable>();
|
auto table = CDClientManager::GetTable<CDPropertyEntranceComponentTable>();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
class PropertyEntranceComponent final : public Component {
|
class PropertyEntranceComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
explicit PropertyEntranceComponent(Entity* parent, uint32_t componentID);
|
explicit PropertyEntranceComponent(Entity* parent, const int32_t componentID);
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_ENTRANCE;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_ENTRANCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
PropertyManagementComponent* PropertyManagementComponent::instance = nullptr;
|
PropertyManagementComponent* PropertyManagementComponent::instance = nullptr;
|
||||||
|
|
||||||
PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Component(parent) {
|
PropertyManagementComponent::PropertyManagementComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
this->owner = LWOOBJID_EMPTY;
|
this->owner = LWOOBJID_EMPTY;
|
||||||
this->templateId = 0;
|
this->templateId = 0;
|
||||||
this->propertyId = LWOOBJID_EMPTY;
|
this->propertyId = LWOOBJID_EMPTY;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ enum class PropertyPrivacyOption {
|
|||||||
class PropertyManagementComponent final : public Component {
|
class PropertyManagementComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_MANAGEMENT;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_MANAGEMENT;
|
||||||
PropertyManagementComponent(Entity* parent);
|
PropertyManagementComponent(Entity* parent, const int32_t componentID);
|
||||||
static PropertyManagementComponent* Instance();
|
static PropertyManagementComponent* Instance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
|
|
||||||
PropertyVendorComponent::PropertyVendorComponent(Entity* parent) : Component(parent) {
|
PropertyVendorComponent::PropertyVendorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyVendorComponent::OnUse(Entity* originator) {
|
void PropertyVendorComponent::OnUse(Entity* originator) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
class PropertyVendorComponent final : public Component {
|
class PropertyVendorComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROPERTY_VENDOR;
|
||||||
explicit PropertyVendorComponent(Entity* parent);
|
explicit PropertyVendorComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a use event from some entity, if the property is cleared this allows the entity to claim it
|
* Handles a use event from some entity, if the property is cleared this allows the entity to claim it
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
const std::unordered_set<LWOOBJID> ProximityMonitorComponent::m_EmptyObjectSet = {};
|
const std::unordered_set<LWOOBJID> ProximityMonitorComponent::m_EmptyObjectSet = {};
|
||||||
|
|
||||||
ProximityMonitorComponent::ProximityMonitorComponent(Entity* parent, int radiusSmall, int radiusLarge) : Component(parent) {
|
ProximityMonitorComponent::ProximityMonitorComponent(Entity* parent, const int32_t componentID, int radiusSmall, int radiusLarge) : Component(parent, componentID) {
|
||||||
if (radiusSmall != -1 && radiusLarge != -1) {
|
if (radiusSmall != -1 && radiusLarge != -1) {
|
||||||
SetProximityRadius(radiusSmall, "rocketSmall");
|
SetProximityRadius(radiusSmall, "rocketSmall");
|
||||||
SetProximityRadius(radiusLarge, "rocketLarge");
|
SetProximityRadius(radiusLarge, "rocketLarge");
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class ProximityMonitorComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROXIMITY_MONITOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PROXIMITY_MONITOR;
|
||||||
|
|
||||||
ProximityMonitorComponent(Entity* parentEntity, int smallRadius = -1, int largeRadius = -1);
|
ProximityMonitorComponent(Entity* parentEntity, const int32_t componentID, int smallRadius = -1, int largeRadius = -1);
|
||||||
~ProximityMonitorComponent() override;
|
~ProximityMonitorComponent() override;
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
|
|
||||||
QuickBuildComponent::QuickBuildComponent(Entity* const entity) : Component{ entity } {
|
QuickBuildComponent::QuickBuildComponent(Entity* const entity, const int32_t componentID) : Component{ entity, componentID } {
|
||||||
std::u16string checkPreconditions = entity->GetVar<std::u16string>(u"CheckPrecondition");
|
std::u16string checkPreconditions = entity->GetVar<std::u16string>(u"CheckPrecondition");
|
||||||
|
|
||||||
if (!checkPreconditions.empty()) {
|
if (!checkPreconditions.empty()) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class QuickBuildComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
||||||
|
|
||||||
QuickBuildComponent(Entity* const entity);
|
QuickBuildComponent(Entity* const entity, const int32_t componentID);
|
||||||
~QuickBuildComponent() override;
|
~QuickBuildComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#define M_PI 3.14159265358979323846264338327950288
|
#define M_PI 3.14159265358979323846264338327950288
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RacingControlComponent::RacingControlComponent(Entity* parent)
|
RacingControlComponent::RacingControlComponent(Entity* parent, const int32_t componentID)
|
||||||
: Component(parent) {
|
: Component(parent, componentID) {
|
||||||
m_PathName = u"MainPath";
|
m_PathName = u"MainPath";
|
||||||
m_NumberOfLaps = 3;
|
m_NumberOfLaps = 3;
|
||||||
m_RemainingLaps = m_NumberOfLaps;
|
m_RemainingLaps = m_NumberOfLaps;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class RacingControlComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
|
||||||
|
|
||||||
RacingControlComponent(Entity* parentEntity);
|
RacingControlComponent(Entity* parentEntity, const int32_t componentID);
|
||||||
~RacingControlComponent();
|
~RacingControlComponent();
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Entity;
|
|||||||
class RacingSoundTriggerComponent : public SoundTriggerComponent {
|
class RacingSoundTriggerComponent : public SoundTriggerComponent {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_SOUND_TRIGGER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_SOUND_TRIGGER;
|
||||||
RacingSoundTriggerComponent(Entity* parent) : SoundTriggerComponent(parent){};
|
RacingSoundTriggerComponent(Entity* parent, const int32_t componentID) : SoundTriggerComponent(parent, componentID){};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__RACINGSOUNDTRIGGERCOMPONENT__H__
|
#endif //!__RACINGSOUNDTRIGGERCOMPONENT__H__
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class RacingStatsComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_STATS;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RACING_STATS;
|
||||||
|
|
||||||
RacingStatsComponent(Entity* parent) : Component(parent) {}
|
RacingStatsComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__RACINGSTATSCOMPONENT__H__
|
#endif //!__RACINGSTATSCOMPONENT__H__
|
||||||
|
|||||||
@@ -11,9 +11,8 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
|
|
||||||
RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t componentID) : Component(parent) {
|
RailActivatorComponent::RailActivatorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_ComponentID = componentID;
|
const auto tableData = CDClientManager::GetTable<CDRailActivatorComponentTable>()->GetEntryByID(componentID);
|
||||||
const auto tableData = CDClientManager::GetTable<CDRailActivatorComponentTable>()->GetEntryByID(componentID);;
|
|
||||||
|
|
||||||
m_Path = parent->GetVar<std::u16string>(u"rail_path");
|
m_Path = parent->GetVar<std::u16string>(u"rail_path");
|
||||||
m_PathDirection = parent->GetVar<bool>(u"rail_path_direction");
|
m_PathDirection = parent->GetVar<bool>(u"rail_path_direction");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
class RailActivatorComponent final : public Component {
|
class RailActivatorComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
explicit RailActivatorComponent(Entity* parent, int32_t componentID);
|
explicit RailActivatorComponent(Entity* parent, const int32_t componentID);
|
||||||
~RailActivatorComponent() override;
|
~RailActivatorComponent() override;
|
||||||
|
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RAIL_ACTIVATOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RAIL_ACTIVATOR;
|
||||||
@@ -37,12 +37,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void OnCancelRailMovement(Entity* originator);
|
void OnCancelRailMovement(Entity* originator);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
|
||||||
* The ID of this component in the components database
|
|
||||||
*/
|
|
||||||
int32_t m_ComponentID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entities that are currently traversing the rail
|
* The entities that are currently traversing the rail
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
|
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
|
||||||
|
|
||||||
RenderComponent::RenderComponent(Entity* const parentEntity, const int32_t componentId) : Component{ parentEntity } {
|
RenderComponent::RenderComponent(Entity* const parentEntity, const int32_t componentID) : Component{ parentEntity, componentID } {
|
||||||
m_LastAnimationName = "";
|
m_LastAnimationName = "";
|
||||||
if (componentId == -1) return;
|
if (componentID == -1) return;
|
||||||
|
|
||||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM RenderComponent WHERE id = ?;");
|
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM RenderComponent WHERE id = ?;");
|
||||||
query.bind(1, componentId);
|
query.bind(1, componentID);
|
||||||
auto result = query.execQuery();
|
auto result = query.execQuery();
|
||||||
|
|
||||||
if (!result.eof()) {
|
if (!result.eof()) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class RenderComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RENDER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RENDER;
|
||||||
|
|
||||||
RenderComponent(Entity* const parentEntity, const int32_t componentId = -1);
|
RenderComponent(Entity* const parentEntity, const int32_t componentID);
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "EntityInfo.h"
|
#include "EntityInfo.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
|
|
||||||
RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* parent, int32_t componentId) : PhysicsComponent(parent, componentId) {
|
RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* parent, const int32_t componentID) : PhysicsComponent(parent, componentID) {
|
||||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &RigidbodyPhantomPhysicsComponent::OnGetObjectReportInfo);
|
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &RigidbodyPhantomPhysicsComponent::OnGetObjectReportInfo);
|
||||||
|
|
||||||
m_Position = m_Parent->GetDefaultPosition();
|
m_Position = m_Parent->GetDefaultPosition();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class RigidbodyPhantomPhysicsComponent : public PhysicsComponent {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS;
|
||||||
|
|
||||||
RigidbodyPhantomPhysicsComponent(Entity* parent, int32_t componentId);
|
RigidbodyPhantomPhysicsComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
void Update(const float deltaTime) override;
|
void Update(const float deltaTime) override;
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
#include "ServiceType.h"
|
#include "ServiceType.h"
|
||||||
#include "MessageType/Master.h"
|
#include "MessageType/Master.h"
|
||||||
|
|
||||||
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) {
|
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||||
"SELECT targetZone, defaultZoneID, targetScene, altLandingPrecondition, altLandingSpawnPointName FROM RocketLaunchpadControlComponent WHERE id = ?;");
|
"SELECT targetZone, defaultZoneID, targetScene, altLandingPrecondition, altLandingSpawnPointName FROM RocketLaunchpadControlComponent WHERE id = ?;");
|
||||||
query.bind(1, rocketId);
|
query.bind(1, componentID);
|
||||||
|
|
||||||
auto result = query.execQuery();
|
auto result = query.execQuery();
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class RocketLaunchpadControlComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ROCKET_LAUNCH;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ROCKET_LAUNCH;
|
||||||
|
|
||||||
RocketLaunchpadControlComponent(Entity* parent, int rocketId);
|
RocketLaunchpadControlComponent(Entity* parent, const int32_t componentID);
|
||||||
~RocketLaunchpadControlComponent() override;
|
~RocketLaunchpadControlComponent() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "ScriptComponent.h"
|
#include "ScriptComponent.h"
|
||||||
|
|
||||||
ScriptComponent::ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client) : Component(parent) {
|
ScriptComponent::ScriptComponent(Entity* parent, const int32_t componentID, std::string scriptName, bool serialized, bool client) : Component(parent, componentID) {
|
||||||
m_Serialized = serialized;
|
m_Serialized = serialized;
|
||||||
m_Client = client;
|
m_Client = client;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ScriptComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT;
|
||||||
|
|
||||||
ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client = false);
|
ScriptComponent(Entity* parent, const int32_t componentID, std::string scriptName, bool serialized, bool client);
|
||||||
~ScriptComponent() override;
|
~ScriptComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Entity;
|
|||||||
class ScriptedActivityComponent final : public ActivityComponent {
|
class ScriptedActivityComponent final : public ActivityComponent {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPTED_ACTIVITY;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPTED_ACTIVITY;
|
||||||
ScriptedActivityComponent(Entity* parent, int activityID) : ActivityComponent(parent, activityID){};
|
ScriptedActivityComponent(Entity* parent, const int32_t componentID) : ActivityComponent(parent, componentID){};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__SCRIPTEDACTIVITYCOMPONENT__H__
|
#endif //!__SCRIPTEDACTIVITYCOMPONENT__H__
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "ScriptedActivityComponent.h"
|
#include "ScriptedActivityComponent.h"
|
||||||
|
|
||||||
ShootingGalleryComponent::ShootingGalleryComponent(Entity* parent, int32_t activityID) : ActivityComponent(parent, activityID) {
|
ShootingGalleryComponent::ShootingGalleryComponent(Entity* parent, const int32_t componentID) : ActivityComponent(parent, componentID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShootingGalleryComponent::SetStaticParams(const StaticShootingGalleryParams& params) {
|
void ShootingGalleryComponent::SetStaticParams(const StaticShootingGalleryParams& params) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class ShootingGalleryComponent final : public ActivityComponent {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY;
|
||||||
|
|
||||||
explicit ShootingGalleryComponent(Entity* parent, int32_t activityID);
|
explicit ShootingGalleryComponent(Entity* parent, const int32_t componentID);
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool isInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool isInitialUpdate) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "StringifiedEnum.h"
|
#include "StringifiedEnum.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
|
|
||||||
SimplePhysicsComponent::SimplePhysicsComponent(Entity* parent, int32_t componentID) : PhysicsComponent(parent, componentID) {
|
SimplePhysicsComponent::SimplePhysicsComponent(Entity* parent, const int32_t componentID) : PhysicsComponent(parent, componentID) {
|
||||||
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &SimplePhysicsComponent::OnGetObjectReportInfo);
|
RegisterMsg(MessageType::Game::GET_OBJECT_REPORT_INFO, this, &SimplePhysicsComponent::OnGetObjectReportInfo);
|
||||||
|
|
||||||
m_Position = m_Parent->GetDefaultPosition();
|
m_Position = m_Parent->GetDefaultPosition();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class SimplePhysicsComponent : public PhysicsComponent {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SIMPLE_PHYSICS;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SIMPLE_PHYSICS;
|
||||||
|
|
||||||
SimplePhysicsComponent(Entity* parent, int32_t componentID);
|
SimplePhysicsComponent(Entity* parent, const int32_t componentID);
|
||||||
~SimplePhysicsComponent() override;
|
~SimplePhysicsComponent() override;
|
||||||
|
|
||||||
void Update(const float deltaTime) override;
|
void Update(const float deltaTime) override;
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID targ
|
|||||||
behavior->UnCast(&context, { target });
|
behavior->UnCast(&context, { target });
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillComponent::SkillComponent(Entity* parent) : Component(parent) {
|
SkillComponent::SkillComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
this->m_skillUid = 0;
|
this->m_skillUid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class SkillComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SKILL;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SKILL;
|
||||||
|
|
||||||
explicit SkillComponent(Entity* parent);
|
explicit SkillComponent(Entity* parent, const int32_t componentID);
|
||||||
~SkillComponent() override;
|
~SkillComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void MixerProgram::Serialize(RakNet::BitStream& outBitStream){
|
|||||||
outBitStream.Write(name.c_str(), name.size());
|
outBitStream.Write(name.c_str(), name.size());
|
||||||
outBitStream.Write(result);
|
outBitStream.Write(result);
|
||||||
}
|
}
|
||||||
SoundTriggerComponent::SoundTriggerComponent(Entity* parent) : Component(parent) {
|
SoundTriggerComponent::SoundTriggerComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
|
|
||||||
const auto musicCueName = parent->GetVar<std::string>(u"NDAudioMusicCue_Name");
|
const auto musicCueName = parent->GetVar<std::string>(u"NDAudioMusicCue_Name");
|
||||||
if (!musicCueName.empty()) {
|
if (!musicCueName.empty()) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ struct MixerProgram {
|
|||||||
class SoundTriggerComponent : public Component {
|
class SoundTriggerComponent : public Component {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SOUND_TRIGGER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SOUND_TRIGGER;
|
||||||
explicit SoundTriggerComponent(Entity* parent);
|
explicit SoundTriggerComponent(Entity* parent, const int32_t componentID);
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
void ActivateMusicCue(const std::string& name, float bordemTime = -1.0);
|
void ActivateMusicCue(const std::string& name, float bordemTime = -1.0);
|
||||||
void DeactivateMusicCue(const std::string& name);
|
void DeactivateMusicCue(const std::string& name);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
std::vector<SwitchComponent*> SwitchComponent::petSwitches;
|
std::vector<SwitchComponent*> SwitchComponent::petSwitches;
|
||||||
|
|
||||||
SwitchComponent::SwitchComponent(Entity* parent) : Component(parent) {
|
SwitchComponent::SwitchComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Active = false;
|
m_Active = false;
|
||||||
|
|
||||||
m_ResetTime = m_Parent->GetVarAs<int32_t>(u"switch_reset_time");
|
m_ResetTime = m_Parent->GetVarAs<int32_t>(u"switch_reset_time");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class SwitchComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SWITCH;
|
||||||
|
|
||||||
SwitchComponent(Entity* parent);
|
SwitchComponent(Entity* parent, const int32_t componentID);
|
||||||
~SwitchComponent() override;
|
~SwitchComponent() override;
|
||||||
|
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
|
||||||
TriggerComponent::TriggerComponent(Entity* parent, const std::string triggerInfo) : Component(parent) {
|
TriggerComponent::TriggerComponent(Entity* parent, const int32_t componentID, const std::string triggerInfo) : Component(parent, componentID) {
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_Trigger = nullptr;
|
m_Trigger = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class TriggerComponent final : public Component {
|
|||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::TRIGGER;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::TRIGGER;
|
||||||
|
|
||||||
explicit TriggerComponent(Entity* parent, const std::string triggerInfo);
|
explicit TriggerComponent(Entity* parent, const int32_t componentID, const std::string triggerInfo);
|
||||||
|
|
||||||
void TriggerEvent(eTriggerEventType event, Entity* optionalTarget = nullptr);
|
void TriggerEvent(eTriggerEventType event, Entity* optionalTarget = nullptr);
|
||||||
LUTriggers::Trigger* GetTrigger() const { return m_Trigger; }
|
LUTriggers::Trigger* GetTrigger() const { return m_Trigger; }
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
#include "CheatDetection.h"
|
#include "CheatDetection.h"
|
||||||
|
|
||||||
VendorComponent::VendorComponent(Entity* parent) : Component(parent) {
|
VendorComponent::VendorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_HasStandardCostItems = false;
|
m_HasStandardCostItems = false;
|
||||||
m_HasMultiCostItems = false;
|
m_HasMultiCostItems = false;
|
||||||
SetupConstants();
|
SetupConstants();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ struct SoldItem {
|
|||||||
class VendorComponent : public Component {
|
class VendorComponent : public Component {
|
||||||
public:
|
public:
|
||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::VENDOR;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::VENDOR;
|
||||||
VendorComponent(Entity* parent);
|
VendorComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user