mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
Rename some variables in Component
And add more virtuals
This commit is contained in:
parent
b589755655
commit
716a5fcf37
@ -17,7 +17,7 @@ __dynamic=1
|
||||
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
|
||||
# __compile_backtrace__=1
|
||||
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
|
||||
__maria_db_connector_compile_jobs__=1
|
||||
__maria_db_connector_compile_jobs__=
|
||||
# When set to 1 and uncommented, compiling and linking testing folders and libraries will be done.
|
||||
__enable_testing__=1
|
||||
# The path to OpenSSL. Change this if your OpenSSL install path is different than the default.
|
||||
|
@ -162,7 +162,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
}
|
||||
|
||||
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent || !destroyableComponent->GetParent()) {
|
||||
if (!destroyableComponent || !destroyableComponent->GetOwningEntity()) {
|
||||
Game::logger->Log("BasicAttackBehavior", "No destroyable component on %llu", branch.target);
|
||||
return;
|
||||
}
|
||||
|
@ -65,10 +65,10 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id):
|
||||
|
||||
// Get aggro and tether radius from settings and use this if it is present. Only overwrite the
|
||||
// radii if it is greater than the one in the database.
|
||||
if (m_Parent) {
|
||||
auto aggroRadius = m_Parent->GetVar<float>(u"aggroRadius");
|
||||
if (m_OwningEntity) {
|
||||
auto aggroRadius = m_OwningEntity->GetVar<float>(u"aggroRadius");
|
||||
m_AggroRadius = aggroRadius != 0 ? aggroRadius : m_AggroRadius;
|
||||
auto tetherRadius = m_Parent->GetVar<float>(u"tetherRadius");
|
||||
auto tetherRadius = m_OwningEntity->GetVar<float>(u"tetherRadius");
|
||||
m_HardTetherRadius = tetherRadius != 0 ? tetherRadius : m_HardTetherRadius;
|
||||
}
|
||||
|
||||
@ -120,14 +120,14 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id):
|
||||
}
|
||||
|
||||
//Create a phantom physics volume so we can detect when we're aggro'd.
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), m_AggroRadius);
|
||||
m_dpEntityEnemy = new dpEntity(m_Parent->GetObjectID(), m_AggroRadius, false);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), m_AggroRadius);
|
||||
m_dpEntityEnemy = new dpEntity(m_OwningEntity->GetObjectID(), m_AggroRadius, false);
|
||||
|
||||
m_dpEntity->SetCollisionGroup(collisionGroup);
|
||||
m_dpEntityEnemy->SetCollisionGroup(collisionGroup);
|
||||
|
||||
m_dpEntity->SetPosition(m_Parent->GetPosition());
|
||||
m_dpEntityEnemy->SetPosition(m_Parent->GetPosition());
|
||||
m_dpEntity->SetPosition(m_OwningEntity->GetPosition());
|
||||
m_dpEntityEnemy->SetPosition(m_OwningEntity->GetPosition());
|
||||
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
dpWorld::Instance().AddEntity(m_dpEntityEnemy);
|
||||
@ -146,17 +146,17 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
//First, we need to process physics:
|
||||
if (!m_dpEntity) return;
|
||||
|
||||
m_dpEntity->SetPosition(m_Parent->GetPosition()); //make sure our position is synced with our dpEntity
|
||||
m_dpEntityEnemy->SetPosition(m_Parent->GetPosition());
|
||||
m_dpEntity->SetPosition(m_OwningEntity->GetPosition()); //make sure our position is synced with our dpEntity
|
||||
m_dpEntityEnemy->SetPosition(m_OwningEntity->GetPosition());
|
||||
|
||||
//Process enter events
|
||||
for (auto en : m_dpEntity->GetNewObjects()) {
|
||||
m_Parent->OnCollisionPhantom(en->GetObjectID());
|
||||
m_OwningEntity->OnCollisionPhantom(en->GetObjectID());
|
||||
}
|
||||
|
||||
//Process exit events
|
||||
for (auto en : m_dpEntity->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionLeavePhantom(en->GetObjectID());
|
||||
m_OwningEntity->OnCollisionLeavePhantom(en->GetObjectID());
|
||||
}
|
||||
|
||||
// Check if we should stop the tether effect
|
||||
@ -165,31 +165,31 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
const auto& info = m_MovementAI->GetInfo();
|
||||
if (m_Target != LWOOBJID_EMPTY || (NiPoint3::DistanceSquared(
|
||||
m_StartPosition,
|
||||
m_Parent->GetPosition()) < 20 * 20 && m_TetherTime <= 0)
|
||||
m_OwningEntity->GetPosition()) < 20 * 20 && m_TetherTime <= 0)
|
||||
) {
|
||||
GameMessages::SendStopFXEffect(m_Parent, true, "tether");
|
||||
GameMessages::SendStopFXEffect(m_OwningEntity, true, "tether");
|
||||
m_TetherEffectActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_SoftTimer <= 0.0f) {
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
m_SoftTimer = 5.0f;
|
||||
} else {
|
||||
m_SoftTimer -= deltaTime;
|
||||
}
|
||||
|
||||
if (m_Disabled || m_Parent->GetIsDead())
|
||||
if (m_Disabled || m_OwningEntity->GetIsDead())
|
||||
return;
|
||||
bool stunnedThisFrame = m_Stunned;
|
||||
CalculateCombat(deltaTime); // Putting this here for now
|
||||
|
||||
if (m_StartPosition == NiPoint3::ZERO) {
|
||||
m_StartPosition = m_Parent->GetPosition();
|
||||
m_StartPosition = m_OwningEntity->GetPosition();
|
||||
}
|
||||
|
||||
m_MovementAI = m_Parent->GetComponent<MovementAIComponent>();
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (m_MovementAI == nullptr) {
|
||||
return;
|
||||
@ -243,7 +243,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
bool hadRemainingDowntime = m_SkillTime > 0.0f;
|
||||
if (m_SkillTime > 0.0f) m_SkillTime -= deltaTime;
|
||||
|
||||
auto* rebuild = m_Parent->GetComponent<RebuildComponent>();
|
||||
auto* rebuild = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuild != nullptr) {
|
||||
const auto state = rebuild->GetState();
|
||||
@ -253,7 +253,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
auto* skillComponent = m_OwningEntity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
@ -287,7 +287,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
}
|
||||
|
||||
if (!m_TetherEffectActive && m_OutOfCombat && (m_OutOfCombatTime -= deltaTime) <= 0) {
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr && destroyableComponent->HasFaction(4)) {
|
||||
auto serilizationRequired = false;
|
||||
@ -305,10 +305,10 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
|
||||
}
|
||||
|
||||
if (serilizationRequired) {
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 6270, u"tether", "tether");
|
||||
GameMessages::SendPlayFXEffect(m_OwningEntity->GetObjectID(), 6270, u"tether", "tether");
|
||||
|
||||
m_TetherEffectActive = true;
|
||||
|
||||
@ -496,10 +496,10 @@ LWOOBJID BaseCombatAIComponent::FindTarget() {
|
||||
std::vector<LWOOBJID> BaseCombatAIComponent::GetTargetWithinAggroRange() const {
|
||||
std::vector<LWOOBJID> targets;
|
||||
|
||||
for (auto id : m_Parent->GetTargetsInPhantom()) {
|
||||
for (auto id : m_OwningEntity->GetTargetsInPhantom()) {
|
||||
auto* other = EntityManager::Instance()->GetEntity(id);
|
||||
|
||||
const auto distance = Vector3::DistanceSquared(m_Parent->GetPosition(), other->GetPosition());
|
||||
const auto distance = Vector3::DistanceSquared(m_OwningEntity->GetPosition(), other->GetPosition());
|
||||
|
||||
if (distance > m_AggroRadius * m_AggroRadius) continue;
|
||||
|
||||
@ -510,7 +510,7 @@ std::vector<LWOOBJID> BaseCombatAIComponent::GetTargetWithinAggroRange() const {
|
||||
}
|
||||
|
||||
bool BaseCombatAIComponent::IsMech() {
|
||||
switch (m_Parent->GetLOT()) {
|
||||
switch (m_OwningEntity->GetLOT()) {
|
||||
case 6253:
|
||||
return true;
|
||||
|
||||
@ -535,7 +535,7 @@ void BaseCombatAIComponent::SetAiState(AiState newState) {
|
||||
if (newState == this->m_State) return;
|
||||
this->m_State = newState;
|
||||
m_DirtyStateOrTarget = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
||||
@ -553,10 +553,10 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* referenceDestroyable = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* referenceDestroyable = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (referenceDestroyable == nullptr) {
|
||||
Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!", m_Parent->GetObjectID());
|
||||
Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!", m_OwningEntity->GetObjectID());
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -588,7 +588,7 @@ void BaseCombatAIComponent::SetTarget(const LWOOBJID target) {
|
||||
if (this->m_Target == target) return;
|
||||
m_Target = target;
|
||||
m_DirtyStateOrTarget = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
Entity* BaseCombatAIComponent::GetTargetEntity() const {
|
||||
@ -597,7 +597,7 @@ Entity* BaseCombatAIComponent::GetTargetEntity() const {
|
||||
|
||||
void BaseCombatAIComponent::Taunt(LWOOBJID offender, float threat) {
|
||||
// Can't taunt self
|
||||
if (offender == m_Parent->GetObjectID())
|
||||
if (offender == m_OwningEntity->GetObjectID())
|
||||
return;
|
||||
|
||||
m_ThreatEntries[offender] += threat;
|
||||
@ -788,7 +788,7 @@ void BaseCombatAIComponent::LookAt(const NiPoint3& point) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_Parent->SetRotation(NiQuaternion::LookAt(m_Parent->GetPosition(), point));
|
||||
m_OwningEntity->SetRotation(NiQuaternion::LookAt(m_OwningEntity->GetPosition(), point));
|
||||
}
|
||||
|
||||
void BaseCombatAIComponent::SetDisabled(bool value) {
|
||||
|
@ -30,28 +30,28 @@ void BouncerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
|
||||
}
|
||||
|
||||
Entity* BouncerComponent::GetParentEntity() const {
|
||||
return m_Parent;
|
||||
return m_OwningEntity;
|
||||
}
|
||||
|
||||
void BouncerComponent::SetPetEnabled(bool value) {
|
||||
m_PetEnabled = value;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void BouncerComponent::SetPetBouncerEnabled(bool value) {
|
||||
m_PetBouncerEnabled = value;
|
||||
|
||||
GameMessages::SendBouncerActiveStatus(m_Parent->GetObjectID(), value, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendBouncerActiveStatus(m_OwningEntity->GetObjectID(), value, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
if (value) {
|
||||
m_Parent->TriggerEvent(eTriggerEventType::PET_ON_SWITCH, m_Parent);
|
||||
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 1513, u"create", "PetOnSwitch", LWOOBJID_EMPTY, 1, 1, true);
|
||||
m_OwningEntity->TriggerEvent(eTriggerEventType::PET_ON_SWITCH, m_OwningEntity);
|
||||
GameMessages::SendPlayFXEffect(m_OwningEntity->GetObjectID(), 1513, u"create", "PetOnSwitch", LWOOBJID_EMPTY, 1, 1, true);
|
||||
} else {
|
||||
m_Parent->TriggerEvent(eTriggerEventType::PET_OFF_SWITCH, m_Parent);
|
||||
GameMessages::SendStopFXEffect(m_Parent, true, "PetOnSwitch");
|
||||
m_OwningEntity->TriggerEvent(eTriggerEventType::PET_OFF_SWITCH, m_OwningEntity);
|
||||
GameMessages::SendStopFXEffect(m_OwningEntity, true, "PetOnSwitch");
|
||||
}
|
||||
|
||||
}
|
||||
@ -65,7 +65,7 @@ bool BouncerComponent::GetPetBouncerEnabled() const {
|
||||
}
|
||||
|
||||
void BouncerComponent::LookupPetSwitch() {
|
||||
const auto& groups = m_Parent->GetGroups();
|
||||
const auto& groups = m_OwningEntity->GetGroups();
|
||||
|
||||
for (const auto& group : groups) {
|
||||
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
@ -79,7 +79,7 @@ void BouncerComponent::LookupPetSwitch() {
|
||||
m_PetSwitchLoaded = true;
|
||||
m_PetEnabled = true;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
Game::logger->Log("BouncerComponent", "Loaded pet bouncer");
|
||||
}
|
||||
@ -89,7 +89,7 @@ void BouncerComponent::LookupPetSwitch() {
|
||||
if (!m_PetSwitchLoaded) {
|
||||
Game::logger->Log("BouncerComponent", "Failed to load pet bouncer");
|
||||
|
||||
m_Parent->AddCallbackTimer(0.5f, [this]() {
|
||||
m_OwningEntity->AddCallbackTimer(0.5f, [this]() {
|
||||
LookupPetSwitch();
|
||||
});
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void BuffComponent::Update(float deltaTime) {
|
||||
buff.second.tickTime = buff.second.tick;
|
||||
buff.second.stacks--;
|
||||
|
||||
SkillComponent::HandleUnmanaged(buff.second.behaviorID, m_Parent->GetObjectID(), buff.second.source);
|
||||
SkillComponent::HandleUnmanaged(buff.second.behaviorID, m_OwningEntity->GetObjectID(), buff.second.source);
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), source, (uint32_t)id,
|
||||
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_OwningEntity->GetObjectID()), source, (uint32_t)id,
|
||||
(uint32_t)duration * 1000, addImmunity, cancelOnDamaged, cancelOnDeath,
|
||||
cancelOnLogout, cancelOnRemoveBuff, cancelOnUi, cancelOnUnequip, cancelOnZone);
|
||||
|
||||
@ -132,7 +132,7 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
|
||||
GameMessages::SendRemoveBuff(m_OwningEntity, fromUnEquip, removeImmunity, id);
|
||||
|
||||
m_Buffs.erase(iter);
|
||||
|
||||
@ -149,7 +149,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||
if (parameter.name == "max_health") {
|
||||
const auto maxHealth = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetParent()->GetComponent<DestroyableComponent>();
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -157,7 +157,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_armor") {
|
||||
const auto maxArmor = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetParent()->GetComponent<DestroyableComponent>();
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -165,13 +165,13 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_imagination") {
|
||||
const auto maxImagination = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetParent()->GetComponent<DestroyableComponent>();
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination);
|
||||
} else if (parameter.name == "speed") {
|
||||
auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
const auto speed = parameter.value;
|
||||
controllablePhysicsComponent->AddSpeedboost(speed);
|
||||
@ -185,7 +185,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
||||
if (parameter.name == "max_health") {
|
||||
const auto maxHealth = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetParent()->GetComponent<DestroyableComponent>();
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -193,7 +193,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_armor") {
|
||||
const auto maxArmor = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetParent()->GetComponent<DestroyableComponent>();
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
@ -201,13 +201,13 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
||||
} else if (parameter.name == "max_imagination") {
|
||||
const auto maxImagination = parameter.value;
|
||||
|
||||
auto* destroyable = this->GetParent()->GetComponent<DestroyableComponent>();
|
||||
auto* destroyable = this->GetOwningEntity()->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) return;
|
||||
|
||||
destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination);
|
||||
} else if (parameter.name == "speed") {
|
||||
auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* controllablePhysicsComponent = this->GetOwningEntity()->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
const auto speed = parameter.value;
|
||||
controllablePhysicsComponent->RemoveSpeedboost(speed);
|
||||
@ -233,8 +233,8 @@ void BuffComponent::ReApplyBuffs() {
|
||||
}
|
||||
}
|
||||
|
||||
Entity* BuffComponent::GetParent() const {
|
||||
return m_Parent;
|
||||
Entity* BuffComponent::GetOwningEntity() const {
|
||||
return m_OwningEntity;
|
||||
}
|
||||
|
||||
void BuffComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
~BuffComponent();
|
||||
|
||||
Entity* GetParent() const;
|
||||
Entity* GetOwningEntity() const;
|
||||
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
|
||||
|
@ -19,7 +19,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
|
||||
if (originator->GetCharacter()) {
|
||||
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup("PropertyPlaque");
|
||||
|
||||
auto buildArea = m_Parent->GetObjectID();
|
||||
auto buildArea = m_OwningEntity->GetObjectID();
|
||||
|
||||
if (!entities.empty()) {
|
||||
buildArea = entities[0]->GetObjectID();
|
||||
@ -63,7 +63,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
|
||||
GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition());
|
||||
}
|
||||
|
||||
InventoryComponent* inv = m_Parent->GetComponent<InventoryComponent>();
|
||||
InventoryComponent* inv = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ void CharacterComponent::TrackRaceCompleted(bool won) {
|
||||
}
|
||||
|
||||
void CharacterComponent::TrackPositionUpdate(const NiPoint3& newPosition) {
|
||||
const auto distance = NiPoint3::Distance(newPosition, m_Parent->GetPosition());
|
||||
const auto distance = NiPoint3::Distance(newPosition, m_OwningEntity->GetPosition());
|
||||
|
||||
if (m_IsRacing) {
|
||||
UpdatePlayerStatistic(DistanceDriven, (uint64_t)distance);
|
||||
@ -732,8 +732,8 @@ void CharacterComponent::RemoveVentureVisionEffect(std::string ventureVisionType
|
||||
}
|
||||
|
||||
void CharacterComponent::UpdateClientMinimap(bool showFaction, std::string ventureVisionType) const {
|
||||
if (!m_Parent) return;
|
||||
if (!m_OwningEntity) return;
|
||||
AMFArrayValue arrayToSend;
|
||||
arrayToSend.Insert(ventureVisionType, showFaction);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", arrayToSend);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_OwningEntity, m_OwningEntity ? m_OwningEntity->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", arrayToSend);
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
#include "Component.h"
|
||||
#include "DluAssert.h"
|
||||
|
||||
|
||||
Component::Component(Entity* parent) {
|
||||
m_Parent = parent;
|
||||
Component::Component(Entity* owningEntity) {
|
||||
DluAssert(owningEntity != nullptr);
|
||||
m_OwningEntity = owningEntity;
|
||||
}
|
||||
|
||||
Component::~Component() {
|
||||
|
||||
}
|
||||
|
||||
Entity* Component::GetParent() const {
|
||||
return m_Parent;
|
||||
}
|
||||
|
||||
void Component::Update(float deltaTime) {
|
||||
|
||||
}
|
||||
@ -28,3 +25,15 @@ void Component::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
void Component::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
}
|
||||
|
||||
void Component::Startup() {
|
||||
|
||||
}
|
||||
|
||||
void Component::LoadConfigData() {
|
||||
|
||||
}
|
||||
|
||||
void Component::LoadTemplateData() {
|
||||
|
||||
}
|
||||
|
@ -1,29 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "../thirdparty/tinyxml2/tinyxml2.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
class Entity;
|
||||
|
||||
/**
|
||||
* Component base class, provides methods for game loop updates, usage events and loading and saving to XML.
|
||||
*/
|
||||
class Component
|
||||
{
|
||||
class Component {
|
||||
public:
|
||||
Component(Entity* parent);
|
||||
Component(Entity* owningEntity);
|
||||
virtual ~Component();
|
||||
|
||||
/**
|
||||
* Gets the owner of this component
|
||||
* @return the owner of this component
|
||||
*/
|
||||
Entity* GetParent() const;
|
||||
|
||||
/**
|
||||
* Updates the component in the game loop
|
||||
* @param deltaTime time passed since last update
|
||||
*/
|
||||
virtual void Update(float deltaTime);
|
||||
Entity* GetOwningEntity() const { return m_OwningEntity; };
|
||||
|
||||
/**
|
||||
* Event called when this component is being used, e.g. when some entity interacted with it
|
||||
@ -43,10 +36,30 @@ public:
|
||||
*/
|
||||
virtual void LoadFromXml(tinyxml2::XMLDocument* doc);
|
||||
|
||||
/**
|
||||
* Call after you have newed the component to initialize it
|
||||
*/
|
||||
virtual void Startup();
|
||||
|
||||
/**
|
||||
* Updates the component in the game loop
|
||||
* @param deltaTime time passed since last update
|
||||
*/
|
||||
virtual void Update(float deltaTime);
|
||||
|
||||
/**
|
||||
* Loads the data of this component from the luz/lvl configuration
|
||||
*/
|
||||
virtual void LoadConfigData();
|
||||
|
||||
/**
|
||||
* Loads the data of this component from the cdclient database
|
||||
*/
|
||||
virtual void LoadTemplateData();
|
||||
protected:
|
||||
|
||||
/**
|
||||
* The entity that owns this component
|
||||
*/
|
||||
Entity* m_Parent;
|
||||
Entity* m_OwningEntity;
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Com
|
||||
Game::logger->Log("ControllablePhysicsComponent", "Using patch to load minifig physics");
|
||||
|
||||
float radius = 1.5f;
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), radius, false);
|
||||
m_dpEntity->SetCollisionGroup(COLLISION_GROUP_DYNAMIC | COLLISION_GROUP_FRIENDLY);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
}
|
||||
@ -168,7 +168,7 @@ void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_Parent->GetCharacter()->LoadXmlRespawnCheckpoints();
|
||||
m_OwningEntity->GetCharacter()->LoadXmlRespawnCheckpoints();
|
||||
|
||||
character->QueryAttribute("lzx", &m_Position.x);
|
||||
character->QueryAttribute("lzy", &m_Position.y);
|
||||
@ -300,7 +300,7 @@ void ControllablePhysicsComponent::RemovePickupRadiusScale(float value) {
|
||||
auto candidateRadius = m_ActivePickupRadiusScales[i];
|
||||
if (m_PickupRadius < candidateRadius) m_PickupRadius = candidateRadius;
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::AddSpeedboost(float value) {
|
||||
@ -321,13 +321,13 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) {
|
||||
// Recalculate speedboost since we removed one
|
||||
m_SpeedBoost = 0.0f;
|
||||
if (m_ActiveSpeedBoosts.empty()) { // no active speed boosts left, so return to base speed
|
||||
auto* levelProgressionComponent = m_Parent->GetComponent<LevelProgressionComponent>();
|
||||
auto* levelProgressionComponent = m_OwningEntity->GetComponent<LevelProgressionComponent>();
|
||||
if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase();
|
||||
} else { // Used the last applied speedboost
|
||||
m_SpeedBoost = m_ActiveSpeedBoosts.back();
|
||||
}
|
||||
SetSpeedMultiplier(m_SpeedBoost / 500.0f); // 500 being the base speed
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bool specialAnims){
|
||||
@ -339,13 +339,13 @@ void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bo
|
||||
m_IsInBubble = true;
|
||||
m_DirtyBubble = true;
|
||||
m_SpecialAnims = specialAnims;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::DeactivateBubbleBuff(){
|
||||
m_DirtyBubble = true;
|
||||
m_IsInBubble = false;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
};
|
||||
|
||||
void ControllablePhysicsComponent::SetStunImmunity(
|
||||
@ -378,7 +378,7 @@ void ControllablePhysicsComponent::SetStunImmunity(
|
||||
}
|
||||
|
||||
GameMessages::SendSetStunImmunity(
|
||||
m_Parent->GetObjectID(), state, m_Parent->GetSystemAddress(), originator,
|
||||
m_OwningEntity->GetObjectID(), state, m_OwningEntity->GetSystemAddress(), originator,
|
||||
bImmuneToStunAttack,
|
||||
bImmuneToStunEquip,
|
||||
bImmuneToStunInteract,
|
||||
|
@ -185,7 +185,7 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
|
||||
auto* buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->LoadFromXml(doc);
|
||||
@ -207,7 +207,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
|
||||
auto* buffComponent = m_OwningEntity->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->UpdateXml(doc);
|
||||
@ -224,7 +224,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
void DestroyableComponent::SetHealth(int32_t value) {
|
||||
m_DirtyHealth = true;
|
||||
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackHealthDelta(value - m_iHealth);
|
||||
}
|
||||
@ -244,16 +244,16 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
||||
|
||||
if (playAnim) {
|
||||
// Now update the player bar
|
||||
if (!m_Parent->GetParentUser()) return;
|
||||
if (!m_OwningEntity->GetParentUser()) return;
|
||||
|
||||
AMFArrayValue args;
|
||||
args.Insert("amount", std::to_string(difference));
|
||||
args.Insert("type", "health");
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_OwningEntity, m_OwningEntity->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void DestroyableComponent::SetArmor(int32_t value) {
|
||||
@ -262,14 +262,14 @@ void DestroyableComponent::SetArmor(int32_t value) {
|
||||
// If Destroyable Component already has zero armor do not trigger the passive ability again.
|
||||
bool hadArmor = m_iArmor > 0;
|
||||
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackArmorDelta(value - m_iArmor);
|
||||
}
|
||||
|
||||
m_iArmor = value;
|
||||
|
||||
auto* inventroyComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
auto* inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (m_iArmor == 0 && inventroyComponent != nullptr && hadArmor) {
|
||||
inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::SentinelArmor);
|
||||
}
|
||||
@ -285,29 +285,29 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
|
||||
|
||||
if (playAnim) {
|
||||
// Now update the player bar
|
||||
if (!m_Parent->GetParentUser()) return;
|
||||
if (!m_OwningEntity->GetParentUser()) return;
|
||||
|
||||
AMFArrayValue args;
|
||||
args.Insert("amount", std::to_string(value));
|
||||
args.Insert("type", "armor");
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_OwningEntity, m_OwningEntity->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void DestroyableComponent::SetImagination(int32_t value) {
|
||||
m_DirtyHealth = true;
|
||||
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->TrackImaginationDelta(value - m_iImagination);
|
||||
}
|
||||
|
||||
m_iImagination = value;
|
||||
|
||||
auto* inventroyComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
auto* inventroyComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (m_iImagination == 0 && inventroyComponent != nullptr) {
|
||||
inventroyComponent->TriggerPassiveAbility(PassiveAbilityTrigger::AssemblyImagination);
|
||||
}
|
||||
@ -325,15 +325,15 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
|
||||
|
||||
if (playAnim) {
|
||||
// Now update the player bar
|
||||
if (!m_Parent->GetParentUser()) return;
|
||||
if (!m_OwningEntity->GetParentUser()) return;
|
||||
|
||||
AMFArrayValue args;
|
||||
args.Insert("amount", std::to_string(difference));
|
||||
args.Insert("type", "imagination");
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_OwningEntity, m_OwningEntity->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", args);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void DestroyableComponent::SetDamageToAbsorb(int32_t value) {
|
||||
@ -455,8 +455,8 @@ bool DestroyableComponent::IsImmune() const {
|
||||
}
|
||||
|
||||
bool DestroyableComponent::IsKnockbackImmune() const {
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* inventoryComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
|
||||
if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivity::QUICKBUILDING) {
|
||||
const auto hasPassive = inventoryComponent->HasAnyPassive({
|
||||
@ -532,7 +532,7 @@ void DestroyableComponent::Heal(const uint32_t health) {
|
||||
|
||||
SetHealth(current);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
|
||||
@ -550,7 +550,7 @@ void DestroyableComponent::Imagine(const int32_t deltaImagination) {
|
||||
|
||||
SetImagination(current);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
|
||||
@ -564,7 +564,7 @@ void DestroyableComponent::Repair(const uint32_t armor) {
|
||||
|
||||
SetArmor(current);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
|
||||
@ -616,13 +616,13 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
||||
SetIsShielded(absorb > 0);
|
||||
|
||||
// Dismount on the possessable hit
|
||||
auto possessable = m_Parent->GetComponent<PossessableComponent>();
|
||||
auto possessable = m_OwningEntity->GetComponent<PossessableComponent>();
|
||||
if (possessable && possessable->GetDepossessOnHit()) {
|
||||
possessable->Dismount();
|
||||
}
|
||||
|
||||
// Dismount on the possessor hit
|
||||
auto possessor = m_Parent->GetComponent<PossessorComponent>();
|
||||
auto possessor = m_OwningEntity->GetComponent<PossessorComponent>();
|
||||
if (possessor) {
|
||||
auto possessableId = possessor->GetPossessable();
|
||||
if (possessableId != LWOOBJID_EMPTY) {
|
||||
@ -633,17 +633,17 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Parent->GetLOT() != 1) {
|
||||
if (m_OwningEntity->GetLOT() != 1) {
|
||||
echo = true;
|
||||
}
|
||||
|
||||
if (echo) {
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
auto* attacker = EntityManager::Instance()->GetEntity(source);
|
||||
m_Parent->OnHit(attacker);
|
||||
m_Parent->OnHitOrHealResult(attacker, sourceDamage);
|
||||
m_OwningEntity->OnHit(attacker);
|
||||
m_OwningEntity->OnHitOrHealResult(attacker, sourceDamage);
|
||||
NotifySubscribers(attacker, sourceDamage);
|
||||
|
||||
for (const auto& cb : m_OnHitCallbacks) {
|
||||
@ -651,7 +651,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
||||
}
|
||||
|
||||
if (health != 0) {
|
||||
auto* combatComponent = m_Parent->GetComponent<BaseCombatAIComponent>();
|
||||
auto* combatComponent = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatComponent != nullptr) {
|
||||
combatComponent->Taunt(source, sourceDamage * 10); // * 10 is arbatrary
|
||||
@ -670,7 +670,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
||||
|
||||
void DestroyableComponent::Subscribe(LWOOBJID scriptObjId, CppScripts::Script* scriptToAdd) {
|
||||
m_SubscribedScripts.insert(std::make_pair(scriptObjId, scriptToAdd));
|
||||
Game::logger->LogDebug("DestroyableComponent", "Added script %llu to entity %llu", scriptObjId, m_Parent->GetObjectID());
|
||||
Game::logger->LogDebug("DestroyableComponent", "Added script %llu to entity %llu", scriptObjId, m_OwningEntity->GetObjectID());
|
||||
Game::logger->LogDebug("DestroyableComponent", "Number of subscribed scripts %i", m_SubscribedScripts.size());
|
||||
}
|
||||
|
||||
@ -678,16 +678,16 @@ void DestroyableComponent::Unsubscribe(LWOOBJID scriptObjId) {
|
||||
auto foundScript = m_SubscribedScripts.find(scriptObjId);
|
||||
if (foundScript != m_SubscribedScripts.end()) {
|
||||
m_SubscribedScripts.erase(foundScript);
|
||||
Game::logger->LogDebug("DestroyableComponent", "Removed script %llu from entity %llu", scriptObjId, m_Parent->GetObjectID());
|
||||
Game::logger->LogDebug("DestroyableComponent", "Removed script %llu from entity %llu", scriptObjId, m_OwningEntity->GetObjectID());
|
||||
} else {
|
||||
Game::logger->LogDebug("DestroyableComponent", "Tried to remove a script for Entity %llu but script %llu didnt exist", m_Parent->GetObjectID(), scriptObjId);
|
||||
Game::logger->LogDebug("DestroyableComponent", "Tried to remove a script for Entity %llu but script %llu didnt exist", m_OwningEntity->GetObjectID(), scriptObjId);
|
||||
}
|
||||
Game::logger->LogDebug("DestroyableComponent", "Number of subscribed scripts %i", m_SubscribedScripts.size());
|
||||
}
|
||||
|
||||
void DestroyableComponent::NotifySubscribers(Entity* attacker, uint32_t damage) {
|
||||
for (auto script : m_SubscribedScripts) {
|
||||
script.second->NotifyHitOrHealResult(m_Parent, attacker, damage);
|
||||
script.second->NotifyHitOrHealResult(m_OwningEntity, attacker, damage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
SetArmor(0);
|
||||
SetHealth(0);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
m_KillerID = source;
|
||||
@ -708,12 +708,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
auto* team = TeamManager::Instance()->GetTeam(owner->GetObjectID());
|
||||
|
||||
const auto isEnemy = m_Parent->GetComponent<BaseCombatAIComponent>() != nullptr;
|
||||
const auto isEnemy = m_OwningEntity->GetComponent<BaseCombatAIComponent>() != nullptr;
|
||||
|
||||
auto* inventoryComponent = owner->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent != nullptr && isEnemy) {
|
||||
inventoryComponent->TriggerPassiveAbility(PassiveAbilityTrigger::EnemySmashed, m_Parent);
|
||||
inventoryComponent->TriggerPassiveAbility(PassiveAbilityTrigger::EnemySmashed, m_OwningEntity);
|
||||
}
|
||||
|
||||
auto* missions = owner->GetComponent<MissionComponent>();
|
||||
@ -729,28 +729,28 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
if (memberMissions == nullptr) continue;
|
||||
|
||||
memberMissions->Progress(eMissionTaskType::SMASH, m_Parent->GetLOT());
|
||||
memberMissions->Progress(eMissionTaskType::USE_SKILL, m_Parent->GetLOT(), skillID);
|
||||
memberMissions->Progress(eMissionTaskType::SMASH, m_OwningEntity->GetLOT());
|
||||
memberMissions->Progress(eMissionTaskType::USE_SKILL, m_OwningEntity->GetLOT(), skillID);
|
||||
}
|
||||
} else {
|
||||
missions->Progress(eMissionTaskType::SMASH, m_Parent->GetLOT());
|
||||
missions->Progress(eMissionTaskType::USE_SKILL, m_Parent->GetLOT(), skillID);
|
||||
missions->Progress(eMissionTaskType::SMASH, m_OwningEntity->GetLOT());
|
||||
missions->Progress(eMissionTaskType::USE_SKILL, m_OwningEntity->GetLOT(), skillID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto isPlayer = m_Parent->IsPlayer();
|
||||
const auto isPlayer = m_OwningEntity->IsPlayer();
|
||||
|
||||
GameMessages::SendDie(m_Parent, source, source, true, killType, deathType, 0, 0, 0, isPlayer, false, 1);
|
||||
GameMessages::SendDie(m_OwningEntity, source, source, true, killType, deathType, 0, 0, 0, isPlayer, false, 1);
|
||||
|
||||
//NANI?!
|
||||
if (!isPlayer) {
|
||||
if (owner != nullptr) {
|
||||
auto* team = TeamManager::Instance()->GetTeam(owner->GetObjectID());
|
||||
|
||||
if (team != nullptr && m_Parent->GetComponent<BaseCombatAIComponent>() != nullptr) {
|
||||
if (team != nullptr && m_OwningEntity->GetComponent<BaseCombatAIComponent>() != nullptr) {
|
||||
LWOOBJID specificOwner = LWOOBJID_EMPTY;
|
||||
auto* scriptedActivityComponent = m_Parent->GetComponent<ScriptedActivityComponent>();
|
||||
auto* scriptedActivityComponent = m_OwningEntity->GetComponent<ScriptedActivityComponent>();
|
||||
uint32_t teamSize = team->members.size();
|
||||
uint32_t lootMatrixId = GetLootMatrixID();
|
||||
|
||||
@ -763,24 +763,24 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
auto* member = EntityManager::Instance()->GetEntity(specificOwner);
|
||||
|
||||
if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
|
||||
if (member) LootGenerator::Instance().DropLoot(member, m_OwningEntity, lootMatrixId, GetMinCoins(), GetMaxCoins());
|
||||
} else {
|
||||
for (const auto memberId : team->members) { // Free for all
|
||||
auto* member = EntityManager::Instance()->GetEntity(memberId);
|
||||
|
||||
if (member == nullptr) continue;
|
||||
|
||||
LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
|
||||
LootGenerator::Instance().DropLoot(member, m_OwningEntity, lootMatrixId, GetMinCoins(), GetMaxCoins());
|
||||
}
|
||||
}
|
||||
} else { // drop loot for non team user
|
||||
LootGenerator::Instance().DropLoot(owner, m_Parent, GetLootMatrixID(), GetMinCoins(), GetMaxCoins());
|
||||
LootGenerator::Instance().DropLoot(owner, m_OwningEntity, GetLootMatrixID(), GetMinCoins(), GetMaxCoins());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Check if this zone allows coin drops
|
||||
if (dZoneManager::Instance()->GetPlayerLoseCoinOnDeath()) {
|
||||
auto* character = m_Parent->GetCharacter();
|
||||
auto* character = m_OwningEntity->GetCharacter();
|
||||
uint64_t coinsTotal = character->GetCoins();
|
||||
const uint64_t minCoinsToLose = dZoneManager::Instance()->GetWorldConfig()->coinsLostOnDeathMin;
|
||||
if (coinsTotal >= minCoinsToLose) {
|
||||
@ -792,27 +792,27 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
|
||||
coinsTotal -= coinsToLose;
|
||||
|
||||
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLose, coinsToLose);
|
||||
LootGenerator::Instance().DropLoot(m_OwningEntity, m_OwningEntity, -1, coinsToLose, coinsToLose);
|
||||
character->SetCoins(coinsTotal, eLootSourceType::PICKUP);
|
||||
}
|
||||
}
|
||||
|
||||
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
|
||||
script->OnPlayerDied(zoneControl, m_Parent);
|
||||
script->OnPlayerDied(zoneControl, m_OwningEntity);
|
||||
}
|
||||
|
||||
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
|
||||
for (Entity* scriptEntity : scriptedActs) {
|
||||
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
|
||||
script->OnPlayerDied(scriptEntity, m_Parent);
|
||||
script->OnPlayerDied(scriptEntity, m_OwningEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Parent->Kill(owner);
|
||||
m_OwningEntity->Kill(owner);
|
||||
}
|
||||
|
||||
void DestroyableComponent::SetFaction(int32_t factionID, bool ignoreChecks) {
|
||||
@ -858,7 +858,7 @@ void DestroyableComponent::SetStatusImmunity(
|
||||
}
|
||||
|
||||
GameMessages::SendSetStatusImmunity(
|
||||
m_Parent->GetObjectID(), state, m_Parent->GetSystemAddress(),
|
||||
m_OwningEntity->GetObjectID(), state, m_OwningEntity->GetSystemAddress(),
|
||||
bImmuneToBasicAttack,
|
||||
bImmuneToDamageOverTime,
|
||||
bImmuneToKnockback,
|
||||
@ -872,7 +872,7 @@ void DestroyableComponent::SetStatusImmunity(
|
||||
}
|
||||
|
||||
void DestroyableComponent::FixStats() {
|
||||
auto* entity = GetParent();
|
||||
auto* entity = GetOwningEntity();
|
||||
|
||||
if (entity == nullptr) return;
|
||||
|
||||
@ -974,19 +974,19 @@ void DestroyableComponent::AddOnHitCallback(const std::function<void(Entity*)>&
|
||||
|
||||
void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
//check if this is a player:
|
||||
if (m_Parent->IsPlayer()) {
|
||||
if (m_OwningEntity->IsPlayer()) {
|
||||
//remove hardcore_lose_uscore_on_death_percent from the player's uscore:
|
||||
auto* character = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* character = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
auto uscore = character->GetUScore();
|
||||
|
||||
auto uscoreToLose = uscore * (EntityManager::Instance()->GetHardcoreLoseUscoreOnDeathPercent() / 100);
|
||||
character->SetUScore(uscore - uscoreToLose);
|
||||
|
||||
GameMessages::SendModifyLEGOScore(m_Parent, m_Parent->GetSystemAddress(), -uscoreToLose, eLootSourceType::MISSION);
|
||||
GameMessages::SendModifyLEGOScore(m_OwningEntity, m_OwningEntity->GetSystemAddress(), -uscoreToLose, eLootSourceType::MISSION);
|
||||
|
||||
if (EntityManager::Instance()->GetHardcoreDropinventoryOnDeath()) {
|
||||
//drop all items from inventory:
|
||||
auto* inventory = m_Parent->GetComponent<InventoryComponent>();
|
||||
auto* inventory = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
if (inventory) {
|
||||
//get the items inventory:
|
||||
auto items = inventory->GetInventory(eInventoryType::ITEMS);
|
||||
@ -998,17 +998,17 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
if (!item.second) continue;
|
||||
// don't drop the thinkng cap
|
||||
if (item.second->GetLot() == 6086) continue;
|
||||
GameMessages::SendDropClientLoot(m_Parent, source, item.second->GetLot(), 0, m_Parent->GetPosition(), item.second->GetCount());
|
||||
GameMessages::SendDropClientLoot(m_OwningEntity, source, item.second->GetLot(), 0, m_OwningEntity->GetPosition(), item.second->GetCount());
|
||||
item.second->SetCount(0, false, false);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get character:
|
||||
auto* chars = m_Parent->GetCharacter();
|
||||
auto* chars = m_OwningEntity->GetCharacter();
|
||||
if (chars) {
|
||||
auto coins = chars->GetCoins();
|
||||
|
||||
@ -1016,13 +1016,13 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
chars->SetCoins(0, eLootSourceType::NONE);
|
||||
|
||||
//drop all coins:
|
||||
GameMessages::SendDropClientLoot(m_Parent, source, LOT_NULL, coins, m_Parent->GetPosition());
|
||||
GameMessages::SendDropClientLoot(m_OwningEntity, source, LOT_NULL, coins, m_OwningEntity->GetPosition());
|
||||
}
|
||||
|
||||
// Reload the player since we can't normally reduce uscore from the server and we want the UI to update
|
||||
// do this last so we don't get killed.... again
|
||||
EntityManager::Instance()->DestructEntity(m_Parent);
|
||||
EntityManager::Instance()->ConstructEntity(m_Parent);
|
||||
EntityManager::Instance()->DestructEntity(m_OwningEntity);
|
||||
EntityManager::Instance()->ConstructEntity(m_OwningEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1039,7 +1039,7 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source){
|
||||
playerStats->SetUScore(playerStats->GetUScore() + uscore);
|
||||
GameMessages::SendModifyLEGOScore(player, player->GetSystemAddress(), uscore, eLootSourceType::MISSION);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void InventoryComponent::AddItem(
|
||||
inventoryType = Inventory::FindInventoryTypeForLot(lot);
|
||||
}
|
||||
|
||||
auto* missions = static_cast<MissionComponent*>(this->m_Parent->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto* missions = static_cast<MissionComponent*>(this->m_OwningEntity->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
auto* inventory = GetInventory(inventoryType);
|
||||
|
||||
@ -261,7 +261,7 @@ void InventoryComponent::AddItem(
|
||||
}
|
||||
|
||||
if (slot == -1) {
|
||||
auto* player = dynamic_cast<Player*>(GetParent());
|
||||
auto* player = dynamic_cast<Player*>(GetOwningEntity());
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@ -276,7 +276,7 @@ void InventoryComponent::AddItem(
|
||||
|
||||
case 1:
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
GameMessages::SendDropClientLoot(this->m_Parent, this->m_Parent->GetObjectID(), lot, 0, this->m_Parent->GetPosition(), 1);
|
||||
GameMessages::SendDropClientLoot(this->m_OwningEntity, this->m_OwningEntity->GetObjectID(), lot, 0, this->m_OwningEntity->GetPosition(), 1);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -378,7 +378,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
}
|
||||
|
||||
auto* missionComponent = m_Parent->GetComponent<MissionComponent>();
|
||||
auto* missionComponent = m_OwningEntity->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
if (IsTransferInventory(inventory)) {
|
||||
@ -479,7 +479,7 @@ bool InventoryComponent::HasSpaceForLoot(const std::unordered_map<LOT, int32_t>&
|
||||
}
|
||||
|
||||
if (slotsNeeded > 0) {
|
||||
GameMessages::SendNotifyNotEnoughInvSpace(m_Parent->GetObjectID(), slotsNeeded, ITEMS, m_Parent->GetSystemAddress());
|
||||
GameMessages::SendNotifyNotEnoughInvSpace(m_OwningEntity->GetObjectID(), slotsNeeded, ITEMS, m_OwningEntity->GetSystemAddress());
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -687,7 +687,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
||||
itemElement->SetAttribute("sk", item->GetSubKey());
|
||||
|
||||
// Begin custom xml
|
||||
itemElement->SetAttribute("parent", item->GetParent());
|
||||
itemElement->SetAttribute("parent", item->GetOwningEntity());
|
||||
// End custom xml
|
||||
|
||||
for (auto* data : item->GetConfig()) {
|
||||
@ -821,23 +821,23 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* character = m_Parent->GetCharacter();
|
||||
auto* character = m_OwningEntity->GetCharacter();
|
||||
|
||||
if (character != nullptr && !skipChecks) {
|
||||
// Hacky proximity rocket
|
||||
if (item->GetLot() == 6416) {
|
||||
const auto rocketLauchPads = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::ROCKET_LAUNCH);
|
||||
|
||||
const auto position = m_Parent->GetPosition();
|
||||
const auto position = m_OwningEntity->GetPosition();
|
||||
|
||||
for (auto* lauchPad : rocketLauchPads) {
|
||||
if (Vector3::DistanceSquared(lauchPad->GetPosition(), position) > 13 * 13) continue;
|
||||
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
|
||||
if (characterComponent != nullptr) characterComponent->SetLastRocketItemID(item->GetId());
|
||||
|
||||
lauchPad->OnUse(m_Parent);
|
||||
lauchPad->OnUse(m_OwningEntity);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -853,7 +853,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
|
||||
if (!building && (item->GetLot() == 6086 || type == eItemType::LOOT_MODEL || type == eItemType::VEHICLE)) return;
|
||||
|
||||
if (type != eItemType::LOOT_MODEL && type != eItemType::MODEL) {
|
||||
if (!item->GetBound() && !item->GetPreconditionExpression()->Check(m_Parent)) {
|
||||
if (!item->GetBound() && !item->GetPreconditionExpression()->Check(m_OwningEntity)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -879,7 +879,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
|
||||
|
||||
EquipScripts(item);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void InventoryComponent::UnEquipItem(Item* item) {
|
||||
@ -909,12 +909,12 @@ void InventoryComponent::UnEquipItem(Item* item) {
|
||||
|
||||
UnequipScripts(item);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
// Trigger property event
|
||||
if (PropertyManagementComponent::Instance() != nullptr && item->GetCount() > 0 && Inventory::FindInventoryTypeForLot(item->GetLot()) == MODELS) {
|
||||
PropertyManagementComponent::Instance()->GetParent()->OnZonePropertyModelRemovedWhileEquipped(m_Parent);
|
||||
dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyModelRemovedWhileEquipped(m_Parent);
|
||||
PropertyManagementComponent::Instance()->GetOwningEntity()->OnZonePropertyModelRemovedWhileEquipped(m_OwningEntity);
|
||||
dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyModelRemovedWhileEquipped(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -926,11 +926,11 @@ void InventoryComponent::EquipScripts(Item* equippedItem) {
|
||||
if (scriptComponentID > -1) {
|
||||
CDScriptComponentTable* scriptCompTable = CDClientManager::Instance().GetTable<CDScriptComponentTable>();
|
||||
CDScriptComponent scriptCompData = scriptCompTable->GetByID(scriptComponentID);
|
||||
auto* itemScript = CppScripts::GetScript(m_Parent, scriptCompData.script_name);
|
||||
auto* itemScript = CppScripts::GetScript(m_OwningEntity, scriptCompData.script_name);
|
||||
if (!itemScript) {
|
||||
Game::logger->Log("InventoryComponent", "null script?");
|
||||
}
|
||||
itemScript->OnFactionTriggerItemEquipped(m_Parent, equippedItem->GetId());
|
||||
itemScript->OnFactionTriggerItemEquipped(m_OwningEntity, equippedItem->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -941,19 +941,19 @@ void InventoryComponent::UnequipScripts(Item* unequippedItem) {
|
||||
if (scriptComponentID > -1) {
|
||||
CDScriptComponentTable* scriptCompTable = CDClientManager::Instance().GetTable<CDScriptComponentTable>();
|
||||
CDScriptComponent scriptCompData = scriptCompTable->GetByID(scriptComponentID);
|
||||
auto* itemScript = CppScripts::GetScript(m_Parent, scriptCompData.script_name);
|
||||
auto* itemScript = CppScripts::GetScript(m_OwningEntity, scriptCompData.script_name);
|
||||
if (!itemScript) {
|
||||
Game::logger->Log("InventoryComponent", "null script?");
|
||||
}
|
||||
itemScript->OnFactionTriggerItemUnequipped(m_Parent, unequippedItem->GetId());
|
||||
itemScript->OnFactionTriggerItemUnequipped(m_OwningEntity, unequippedItem->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::HandlePossession(Item* item) {
|
||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto* characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (!characterComponent) return;
|
||||
|
||||
auto* possessorComponent = m_Parent->GetComponent<PossessorComponent>();
|
||||
auto* possessorComponent = m_OwningEntity->GetComponent<PossessorComponent>();
|
||||
if (!possessorComponent) return;
|
||||
|
||||
// Don't do anything if we are busy dismounting
|
||||
@ -968,22 +968,22 @@ void InventoryComponent::HandlePossession(Item* item) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendSetStunned(m_Parent->GetObjectID(), eStateChangeType::PUSH, m_Parent->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
||||
GameMessages::SendSetStunned(m_OwningEntity->GetObjectID(), eStateChangeType::PUSH, m_OwningEntity->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
||||
|
||||
// Set the mount Item ID so that we know what were handling
|
||||
possessorComponent->SetMountItemID(item->GetId());
|
||||
GameMessages::SendSetMountInventoryID(m_Parent, item->GetId(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendSetMountInventoryID(m_OwningEntity, item->GetId(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
// Create entity to mount
|
||||
auto startRotation = m_Parent->GetRotation();
|
||||
auto startRotation = m_OwningEntity->GetRotation();
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = item->GetLot();
|
||||
info.pos = m_Parent->GetPosition();
|
||||
info.pos = m_OwningEntity->GetPosition();
|
||||
info.rot = startRotation;
|
||||
info.spawnerID = m_Parent->GetObjectID();
|
||||
info.spawnerID = m_OwningEntity->GetObjectID();
|
||||
|
||||
auto* mount = EntityManager::Instance()->CreateEntity(info, nullptr, m_Parent);
|
||||
auto* mount = EntityManager::Instance()->CreateEntity(info, nullptr, m_OwningEntity);
|
||||
|
||||
// Check to see if the mount is a vehicle, if so, flip it
|
||||
auto* vehicleComponent = mount->GetComponent<VehiclePhysicsComponent>();
|
||||
@ -1010,29 +1010,29 @@ void InventoryComponent::HandlePossession(Item* item) {
|
||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent) {
|
||||
possessableComponent->SetIsItemSpawned(true);
|
||||
possessableComponent->SetPossessor(m_Parent->GetObjectID());
|
||||
possessableComponent->SetPossessor(m_OwningEntity->GetObjectID());
|
||||
// Possess it
|
||||
possessorComponent->SetPossessable(mount->GetObjectID());
|
||||
possessorComponent->SetPossessableType(possessableComponent->GetPossessionType());
|
||||
}
|
||||
|
||||
GameMessages::SendSetJetPackMode(m_Parent, false);
|
||||
GameMessages::SendSetJetPackMode(m_OwningEntity, false);
|
||||
|
||||
// Make it go to the client
|
||||
EntityManager::Instance()->ConstructEntity(mount);
|
||||
// Update the possessor
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
// have to unlock the input so it vehicle can be driven
|
||||
if (vehicleComponent) GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_Parent->GetObjectID(), true, eUnequippableActiveType::MOUNT, item->GetId(), m_Parent->GetSystemAddress());
|
||||
if (vehicleComponent) GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_OwningEntity->GetSystemAddress());
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_OwningEntity->GetObjectID(), true, eUnequippableActiveType::MOUNT, item->GetId(), m_OwningEntity->GetSystemAddress());
|
||||
}
|
||||
|
||||
void InventoryComponent::ApplyBuff(Item* item) const {
|
||||
const auto buffs = FindBuffs(item, true);
|
||||
|
||||
for (const auto buff : buffs) {
|
||||
SkillComponent::HandleUnmanaged(buff, m_Parent->GetObjectID());
|
||||
SkillComponent::HandleUnmanaged(buff, m_OwningEntity->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1041,7 +1041,7 @@ void InventoryComponent::RemoveBuff(Item* item) const {
|
||||
const auto buffs = FindBuffs(item, false);
|
||||
|
||||
for (const auto buff : buffs) {
|
||||
SkillComponent::HandleUnCast(buff, m_Parent->GetObjectID());
|
||||
SkillComponent::HandleUnCast(buff, m_OwningEntity->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1076,14 +1076,14 @@ void InventoryComponent::PopEquippedItems() {
|
||||
|
||||
m_Pushed.clear();
|
||||
|
||||
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
// Reset stats to full
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth()));
|
||||
destroyableComponent->SetArmor(static_cast<int32_t>(destroyableComponent->GetMaxArmor()));
|
||||
destroyableComponent->SetImagination(static_cast<int32_t>(destroyableComponent->GetMaxImagination()));
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
m_Dirty = true;
|
||||
@ -1169,10 +1169,10 @@ void InventoryComponent::AddItemSkills(const LOT lot) {
|
||||
if (index != m_Skills.end()) {
|
||||
const auto old = index->second;
|
||||
|
||||
GameMessages::SendRemoveSkill(m_Parent, old);
|
||||
GameMessages::SendRemoveSkill(m_OwningEntity, old);
|
||||
}
|
||||
|
||||
GameMessages::SendAddSkill(m_Parent, skill, static_cast<int>(slot));
|
||||
GameMessages::SendAddSkill(m_OwningEntity, skill, static_cast<int>(slot));
|
||||
|
||||
m_Skills.insert_or_assign(slot, skill);
|
||||
}
|
||||
@ -1194,14 +1194,14 @@ void InventoryComponent::RemoveItemSkills(const LOT lot) {
|
||||
|
||||
const auto old = index->second;
|
||||
|
||||
GameMessages::SendRemoveSkill(m_Parent, old);
|
||||
GameMessages::SendRemoveSkill(m_OwningEntity, old);
|
||||
|
||||
m_Skills.erase(slot);
|
||||
|
||||
if (slot == BehaviorSlot::Primary) {
|
||||
m_Skills.insert_or_assign(BehaviorSlot::Primary, 1);
|
||||
|
||||
GameMessages::SendAddSkill(m_Parent, 1, static_cast<int>(BehaviorSlot::Primary));
|
||||
GameMessages::SendAddSkill(m_OwningEntity, 1, static_cast<int>(BehaviorSlot::Primary));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1227,7 +1227,7 @@ bool InventoryComponent::HasAnyPassive(const std::vector<eItemSetPassiveAbilityI
|
||||
}
|
||||
|
||||
void InventoryComponent::DespawnPet() {
|
||||
auto* current = PetComponent::GetActivePet(m_Parent->GetObjectID());
|
||||
auto* current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
|
||||
|
||||
if (current != nullptr) {
|
||||
current->Deactivate();
|
||||
@ -1235,7 +1235,7 @@ void InventoryComponent::DespawnPet() {
|
||||
}
|
||||
|
||||
void InventoryComponent::SpawnPet(Item* item) {
|
||||
auto* current = PetComponent::GetActivePet(m_Parent->GetObjectID());
|
||||
auto* current = PetComponent::GetActivePet(m_OwningEntity->GetObjectID());
|
||||
|
||||
if (current != nullptr) {
|
||||
current->Deactivate();
|
||||
@ -1246,18 +1246,18 @@ void InventoryComponent::SpawnPet(Item* item) {
|
||||
}
|
||||
|
||||
// First check if we can summon the pet. You need 1 imagination to do so.
|
||||
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (Game::config->GetValue("pets_take_imagination") == "1" && destroyableComponent && destroyableComponent->GetImagination() <= 0) {
|
||||
GameMessages::SendUseItemRequirementsResponse(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), eUseItemResponse::NoImaginationForPet);
|
||||
GameMessages::SendUseItemRequirementsResponse(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress(), eUseItemResponse::NoImaginationForPet);
|
||||
return;
|
||||
}
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = item->GetLot();
|
||||
info.pos = m_Parent->GetPosition();
|
||||
info.pos = m_OwningEntity->GetPosition();
|
||||
info.rot = NiQuaternion::IDENTITY;
|
||||
info.spawnerID = m_Parent->GetObjectID();
|
||||
info.spawnerID = m_OwningEntity->GetObjectID();
|
||||
|
||||
auto* pet = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
@ -1339,7 +1339,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
|
||||
return entry.objectTemplate == static_cast<unsigned int>(item->GetLot());
|
||||
});
|
||||
|
||||
auto* missions = static_cast<MissionComponent*>(m_Parent->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto* missions = static_cast<MissionComponent*>(m_OwningEntity->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
for (const auto& result : results) {
|
||||
if (result.castOnType == 1) {
|
||||
@ -1356,7 +1356,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
|
||||
}
|
||||
|
||||
// If item is not a proxy, add its buff to the added buffs.
|
||||
if (item->GetParent() == LWOOBJID_EMPTY) buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
|
||||
if (item->GetOwningEntity() == LWOOBJID_EMPTY) buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1376,7 +1376,7 @@ void InventoryComponent::SetNPCItems(const std::vector<LOT>& items) {
|
||||
UpdateSlot(info.equipLocation, { id, static_cast<LOT>(item), 1, slot++ }, true);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
InventoryComponent::~InventoryComponent() {
|
||||
@ -1442,7 +1442,7 @@ std::vector<Item*> InventoryComponent::FindProxies(const LWOOBJID parent) {
|
||||
for (const auto& pair : inventory->GetItems()) {
|
||||
auto* item = pair.second;
|
||||
|
||||
if (item->GetParent() == parent) {
|
||||
if (item->GetOwningEntity() == parent) {
|
||||
proxies.push_back(item);
|
||||
}
|
||||
}
|
||||
@ -1479,7 +1479,7 @@ bool InventoryComponent::IsParentValid(Item* root) {
|
||||
for (const auto& candidate : items) {
|
||||
auto* item = candidate.second;
|
||||
|
||||
if (item->GetParent() == id) {
|
||||
if (item->GetOwningEntity() == id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1497,7 +1497,7 @@ void InventoryComponent::CheckProxyIntegrity() {
|
||||
for (const auto& candidate : items) {
|
||||
auto* item = candidate.second;
|
||||
|
||||
const auto parent = item->GetParent();
|
||||
const auto parent = item->GetOwningEntity();
|
||||
|
||||
if (parent == LWOOBJID_EMPTY) {
|
||||
continue;
|
||||
@ -1526,7 +1526,7 @@ void InventoryComponent::CheckProxyIntegrity() {
|
||||
{
|
||||
auto* item = candidate.second;
|
||||
|
||||
const auto parent = item->GetParent();
|
||||
const auto parent = item->GetOwningEntity();
|
||||
|
||||
if (parent != LWOOBJID_EMPTY)
|
||||
{
|
||||
@ -1555,7 +1555,7 @@ void InventoryComponent::CheckProxyIntegrity() {
|
||||
}
|
||||
|
||||
void InventoryComponent::PurgeProxies(Item* item) {
|
||||
const auto root = item->GetParent();
|
||||
const auto root = item->GetOwningEntity();
|
||||
|
||||
if (root != LWOOBJID_EMPTY) {
|
||||
item = FindItemById(root);
|
||||
|
@ -35,7 +35,7 @@ void LUPExhibitComponent::NextExhibit() {
|
||||
|
||||
m_Exhibit = m_Exhibits[m_ExhibitIndex];
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void LUPExhibitComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, uint32_t& flags) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "CDRewardsTable.h"
|
||||
|
||||
LevelProgressionComponent::LevelProgressionComponent(Entity* parent) : Component(parent) {
|
||||
m_Parent = parent;
|
||||
m_OwningEntity = parent;
|
||||
m_Level = 1;
|
||||
m_SpeedBase = 500.0f;
|
||||
m_CharacterVersion = eCharacterVersion::LIVE;
|
||||
@ -49,12 +49,12 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
const auto& rewards = rewardsTable->GetByLevelID(m_Level);
|
||||
bool rewardingItem = rewards.size() > 0;
|
||||
|
||||
auto* inventoryComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
auto* controllablePhysicsComponent = m_Parent->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* inventoryComponent = m_OwningEntity->GetComponent<InventoryComponent>();
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (!inventoryComponent || !controllablePhysicsComponent) return;
|
||||
// Tell the client we beginning to send level rewards.
|
||||
if (rewardingItem) GameMessages::NotifyLevelRewards(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), m_Level, rewardingItem);
|
||||
if (rewardingItem) GameMessages::NotifyLevelRewards(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress(), m_Level, rewardingItem);
|
||||
|
||||
for (auto* reward : rewards) {
|
||||
switch (reward->rewardType) {
|
||||
@ -79,11 +79,11 @@ void LevelProgressionComponent::HandleLevelUp() {
|
||||
}
|
||||
}
|
||||
// Tell the client we have finished sending level rewards.
|
||||
if (rewardingItem) GameMessages::NotifyLevelRewards(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), m_Level, !rewardingItem);
|
||||
if (rewardingItem) GameMessages::NotifyLevelRewards(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress(), m_Level, !rewardingItem);
|
||||
}
|
||||
|
||||
void LevelProgressionComponent::SetRetroactiveBaseSpeed(){
|
||||
if (m_Level >= 20) m_SpeedBase = 525.0f;
|
||||
auto* controllablePhysicsComponent = m_Parent->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) controllablePhysicsComponent->SetSpeedMultiplier(m_SpeedBase / 500.0f);
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ void MissionComponent::AcceptMission(const uint32_t missionId, const bool skipCh
|
||||
if (missionId == 1728) {
|
||||
//Needs to send a mail
|
||||
|
||||
auto address = m_Parent->GetSystemAddress();
|
||||
auto address = m_OwningEntity->GetSystemAddress();
|
||||
|
||||
Mail::HandleNotificationRequest(address, m_Parent->GetObjectID());
|
||||
Mail::HandleNotificationRequest(address, m_OwningEntity->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,14 +109,14 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
if (mission != nullptr) {
|
||||
if (specifiedMissionId <= 0) {
|
||||
// Handles the odd case where the offer object should not display the mission again
|
||||
if (!mission->IsComplete() && mission->GetClientInfo().offer_objectID == m_Parent->GetLOT() && mission->GetClientInfo().target_objectID != m_Parent->GetLOT() && mission->IsFetchMission()) {
|
||||
if (!mission->IsComplete() && mission->GetClientInfo().offer_objectID == m_OwningEntity->GetLOT() && mission->GetClientInfo().target_objectID != m_OwningEntity->GetLOT() && mission->IsFetchMission()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// We have the mission, if it is not complete, offer it
|
||||
if (mission->IsActive() || mission->IsReadyToComplete()) {
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_Parent->GetObjectID());
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_OwningEntity->GetObjectID());
|
||||
|
||||
offered.push_back(missionId);
|
||||
|
||||
@ -162,7 +162,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
const auto& iter = std::find(randomMissionPool.begin(), randomMissionPool.end(), specifiedMissionId);
|
||||
|
||||
if (iter != randomMissionPool.end() && MissionPrerequisites::CanAccept(specifiedMissionId, missionComponent->GetMissions())) {
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), specifiedMissionId, m_Parent->GetObjectID());
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), specifiedMissionId, m_OwningEntity->GetObjectID());
|
||||
|
||||
return;
|
||||
}
|
||||
@ -184,7 +184,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
continue;
|
||||
}
|
||||
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), sample, m_Parent->GetObjectID());
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), sample, m_OwningEntity->GetObjectID());
|
||||
|
||||
canAcceptPool.clear();
|
||||
|
||||
@ -202,9 +202,9 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
||||
|
||||
const auto selected = canAcceptPool[GeneralUtils::GenerateRandomNumber<int>(0, canAcceptPool.size() - 1)];
|
||||
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), selected, m_Parent->GetObjectID());
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), selected, m_OwningEntity->GetObjectID());
|
||||
} else if (std::find(offered.begin(), offered.end(), missionId) == offered.end() && offeredMission->GetOfferMission()) {
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_Parent->GetObjectID());
|
||||
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_OwningEntity->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,17 @@
|
||||
#include "Entity.h"
|
||||
|
||||
ModelComponent::ModelComponent(Entity* parent) : Component(parent) {
|
||||
m_OriginalPosition = m_Parent->GetDefaultPosition();
|
||||
m_OriginalRotation = m_Parent->GetDefaultRotation();
|
||||
m_OriginalPosition = m_OwningEntity->GetDefaultPosition();
|
||||
m_OriginalRotation = m_OwningEntity->GetDefaultRotation();
|
||||
|
||||
m_userModelID = m_Parent->GetVarAs<LWOOBJID>(u"userModelID");
|
||||
m_userModelID = m_OwningEntity->GetVarAs<LWOOBJID>(u"userModelID");
|
||||
}
|
||||
|
||||
void ModelComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||
// ItemComponent Serialization. Pets do not get this serialization.
|
||||
if (!m_Parent->HasComponent(eReplicaComponentType::PET)) {
|
||||
if (!m_OwningEntity->HasComponent(eReplicaComponentType::PET)) {
|
||||
outBitStream->Write1();
|
||||
outBitStream->Write<LWOOBJID>(m_userModelID != LWOOBJID_EMPTY ? m_userModelID : m_Parent->GetObjectID());
|
||||
outBitStream->Write<LWOOBJID>(m_userModelID != LWOOBJID_EMPTY ? m_userModelID : m_OwningEntity->GetObjectID());
|
||||
outBitStream->Write<int>(0);
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
@ -22,14 +22,14 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) :
|
||||
|
||||
m_BaseCombatAI = nullptr;
|
||||
|
||||
m_BaseCombatAI = reinterpret_cast<BaseCombatAIComponent*>(m_Parent->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
m_BaseCombatAI = reinterpret_cast<BaseCombatAIComponent*>(m_OwningEntity->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
|
||||
//Try and fix the insane values:
|
||||
if (m_Info.wanderRadius > 5.0f) m_Info.wanderRadius = m_Info.wanderRadius * 0.5f;
|
||||
if (m_Info.wanderRadius > 8.0f) m_Info.wanderRadius = 8.0f;
|
||||
if (m_Info.wanderSpeed > 0.5f) m_Info.wanderSpeed = m_Info.wanderSpeed * 0.5f;
|
||||
|
||||
m_BaseSpeed = GetBaseSpeed(m_Parent->GetLOT());
|
||||
m_BaseSpeed = GetBaseSpeed(m_OwningEntity->GetLOT());
|
||||
|
||||
m_NextWaypoint = GetCurrentPosition();
|
||||
m_Acceleration = 0.4f;
|
||||
@ -149,7 +149,7 @@ nextAction:
|
||||
|
||||
SetVelocity(velocity);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
const MovementAIInfo& MovementAIComponent::GetInfo() const {
|
||||
@ -179,7 +179,7 @@ NiPoint3 MovementAIComponent::GetNextWaypoint() const {
|
||||
}
|
||||
|
||||
NiPoint3 MovementAIComponent::GetCurrentPosition() const {
|
||||
return m_Parent->GetPosition();
|
||||
return m_OwningEntity->GetPosition();
|
||||
}
|
||||
|
||||
NiPoint3 MovementAIComponent::ApproximateLocation() const {
|
||||
@ -221,7 +221,7 @@ bool MovementAIComponent::Warp(const NiPoint3& point) {
|
||||
|
||||
SetPosition(destination);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -253,7 +253,7 @@ void MovementAIComponent::Stop() {
|
||||
|
||||
m_CurrentSpeed = 0;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void MovementAIComponent::PullToPoint(const NiPoint3& point) {
|
||||
@ -322,7 +322,7 @@ foundComponent:
|
||||
}
|
||||
|
||||
void MovementAIComponent::SetPosition(const NiPoint3& value) {
|
||||
auto* controllablePhysicsComponent = m_Parent->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
controllablePhysicsComponent->SetPosition(value);
|
||||
@ -330,7 +330,7 @@ void MovementAIComponent::SetPosition(const NiPoint3& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* simplePhysicsComponent = m_Parent->GetComponent<SimplePhysicsComponent>();
|
||||
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent != nullptr) {
|
||||
simplePhysicsComponent->SetPosition(value);
|
||||
@ -342,7 +342,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = m_Parent->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
controllablePhysicsComponent->SetRotation(value);
|
||||
@ -350,7 +350,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* simplePhysicsComponent = m_Parent->GetComponent<SimplePhysicsComponent>();
|
||||
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent != nullptr) {
|
||||
simplePhysicsComponent->SetRotation(value);
|
||||
@ -358,7 +358,7 @@ void MovementAIComponent::SetRotation(const NiQuaternion& value) {
|
||||
}
|
||||
|
||||
void MovementAIComponent::SetVelocity(const NiPoint3& value) {
|
||||
auto* controllablePhysicsComponent = m_Parent->GetComponent<ControllablePhysicsComponent>();
|
||||
auto* controllablePhysicsComponent = m_OwningEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
controllablePhysicsComponent->SetVelocity(value);
|
||||
@ -366,7 +366,7 @@ void MovementAIComponent::SetVelocity(const NiPoint3& value) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* simplePhysicsComponent = m_Parent->GetComponent<SimplePhysicsComponent>();
|
||||
auto* simplePhysicsComponent = m_OwningEntity->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent != nullptr) {
|
||||
simplePhysicsComponent->SetVelocity(value);
|
||||
|
@ -57,7 +57,7 @@ void MoverSubComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIniti
|
||||
|
||||
MovingPlatformComponent::MovingPlatformComponent(Entity* parent, const std::string& pathName) : Component(parent) {
|
||||
m_MoverSubComponentType = eMoverSubComponentType::mover;
|
||||
m_MoverSubComponent = new MoverSubComponent(m_Parent->GetDefaultPosition());
|
||||
m_MoverSubComponent = new MoverSubComponent(m_OwningEntity->GetDefaultPosition());
|
||||
m_PathName = GeneralUtils::ASCIIToUTF16(pathName);
|
||||
m_Path = dZoneManager::Instance()->GetZone()->GetPath(pathName);
|
||||
m_NoAutoStart = false;
|
||||
@ -133,7 +133,7 @@ void MovingPlatformComponent::SetMovementState(eMovementPlatformState value) {
|
||||
|
||||
subComponent->mState = value;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint) {
|
||||
@ -147,7 +147,7 @@ void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint)
|
||||
}
|
||||
|
||||
void MovingPlatformComponent::StartPathing() {
|
||||
//GameMessages::SendStartPathing(m_Parent);
|
||||
//GameMessages::SendStartPathing(m_OwningEntity);
|
||||
m_PathingStopped = false;
|
||||
|
||||
auto* subComponent = static_cast<MoverSubComponent*>(m_MoverSubComponent);
|
||||
@ -167,14 +167,14 @@ void MovingPlatformComponent::StartPathing() {
|
||||
|
||||
targetPosition = nextWaypoint.position;
|
||||
} else {
|
||||
subComponent->mPosition = m_Parent->GetPosition();
|
||||
subComponent->mPosition = m_OwningEntity->GetPosition();
|
||||
subComponent->mSpeed = 1.0f;
|
||||
subComponent->mWaitTime = 2.0f;
|
||||
|
||||
targetPosition = m_Parent->GetPosition() + NiPoint3(0.0f, 10.0f, 0.0f);
|
||||
targetPosition = m_OwningEntity->GetPosition() + NiPoint3(0.0f, 10.0f, 0.0f);
|
||||
}
|
||||
|
||||
m_Parent->AddCallbackTimer(subComponent->mWaitTime, [this] {
|
||||
m_OwningEntity->AddCallbackTimer(subComponent->mWaitTime, [this] {
|
||||
SetMovementState(eMovementPlatformState::Moving);
|
||||
});
|
||||
|
||||
@ -182,19 +182,19 @@ void MovingPlatformComponent::StartPathing() {
|
||||
|
||||
const auto travelNext = subComponent->mWaitTime + travelTime;
|
||||
|
||||
m_Parent->AddCallbackTimer(travelTime, [subComponent, this] {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnWaypointReached(m_Parent, subComponent->mNextWaypointIndex);
|
||||
m_OwningEntity->AddCallbackTimer(travelTime, [subComponent, this] {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnWaypointReached(m_OwningEntity, subComponent->mNextWaypointIndex);
|
||||
}
|
||||
});
|
||||
|
||||
m_Parent->AddCallbackTimer(travelNext, [this] {
|
||||
m_OwningEntity->AddCallbackTimer(travelNext, [this] {
|
||||
ContinuePathing();
|
||||
});
|
||||
|
||||
//GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
//GameMessages::SendPlatformResync(m_OwningEntity, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void MovingPlatformComponent::ContinuePathing() {
|
||||
@ -222,17 +222,17 @@ void MovingPlatformComponent::ContinuePathing() {
|
||||
|
||||
targetPosition = nextWaypoint.position;
|
||||
} else {
|
||||
subComponent->mPosition = m_Parent->GetPosition();
|
||||
subComponent->mPosition = m_OwningEntity->GetPosition();
|
||||
subComponent->mSpeed = 1.0f;
|
||||
subComponent->mWaitTime = 2.0f;
|
||||
|
||||
targetPosition = m_Parent->GetPosition() + NiPoint3(0.0f, 10.0f, 0.0f);
|
||||
targetPosition = m_OwningEntity->GetPosition() + NiPoint3(0.0f, 10.0f, 0.0f);
|
||||
|
||||
pathSize = 1;
|
||||
behavior = PathBehavior::Loop;
|
||||
}
|
||||
|
||||
if (m_Parent->GetLOT() == 9483) {
|
||||
if (m_OwningEntity->GetLOT() == 9483) {
|
||||
behavior = PathBehavior::Bounce;
|
||||
} else {
|
||||
return;
|
||||
@ -242,7 +242,7 @@ void MovingPlatformComponent::ContinuePathing() {
|
||||
subComponent->mCurrentWaypointIndex = pathSize;
|
||||
switch (behavior) {
|
||||
case PathBehavior::Once:
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
return;
|
||||
|
||||
case PathBehavior::Bounce:
|
||||
@ -271,7 +271,7 @@ void MovingPlatformComponent::ContinuePathing() {
|
||||
subComponent->mCurrentWaypointIndex = 1;
|
||||
*/
|
||||
|
||||
//GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
//GameMessages::SendPlatformResync(m_OwningEntity, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
if (subComponent->mCurrentWaypointIndex == subComponent->mDesiredWaypointIndex) {
|
||||
// TODO: Send event?
|
||||
@ -280,35 +280,35 @@ void MovingPlatformComponent::ContinuePathing() {
|
||||
return;
|
||||
}
|
||||
|
||||
m_Parent->CancelCallbackTimers();
|
||||
m_OwningEntity->CancelCallbackTimers();
|
||||
|
||||
m_Parent->AddCallbackTimer(subComponent->mWaitTime, [this] {
|
||||
m_OwningEntity->AddCallbackTimer(subComponent->mWaitTime, [this] {
|
||||
SetMovementState(eMovementPlatformState::Moving);
|
||||
});
|
||||
|
||||
auto travelTime = Vector3::Distance(targetPosition, subComponent->mPosition) / subComponent->mSpeed + 1.5;
|
||||
|
||||
if (m_Parent->GetLOT() == 9483) {
|
||||
if (m_OwningEntity->GetLOT() == 9483) {
|
||||
travelTime += 20;
|
||||
}
|
||||
|
||||
const auto travelNext = subComponent->mWaitTime + travelTime;
|
||||
|
||||
m_Parent->AddCallbackTimer(travelTime, [subComponent, this] {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnWaypointReached(m_Parent, subComponent->mNextWaypointIndex);
|
||||
m_OwningEntity->AddCallbackTimer(travelTime, [subComponent, this] {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnWaypointReached(m_OwningEntity, subComponent->mNextWaypointIndex);
|
||||
}
|
||||
});
|
||||
|
||||
m_Parent->AddCallbackTimer(travelNext, [this] {
|
||||
m_OwningEntity->AddCallbackTimer(travelNext, [this] {
|
||||
ContinuePathing();
|
||||
});
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void MovingPlatformComponent::StopPathing() {
|
||||
//m_Parent->CancelCallbackTimers();
|
||||
//m_OwningEntity->CancelCallbackTimers();
|
||||
|
||||
auto* subComponent = static_cast<MoverSubComponent*>(m_MoverSubComponent);
|
||||
|
||||
@ -318,9 +318,9 @@ void MovingPlatformComponent::StopPathing() {
|
||||
subComponent->mDesiredWaypointIndex = -1;
|
||||
subComponent->mShouldStopAtDesiredWaypoint = false;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
//GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
//GameMessages::SendPlatformResync(m_OwningEntity, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
void MovingPlatformComponent::SetSerialized(bool value) {
|
||||
@ -338,10 +338,10 @@ void MovingPlatformComponent::SetNoAutoStart(const bool value) {
|
||||
void MovingPlatformComponent::WarpToWaypoint(size_t index) {
|
||||
const auto& waypoint = m_Path->pathWaypoints[index];
|
||||
|
||||
m_Parent->SetPosition(waypoint.position);
|
||||
m_Parent->SetRotation(waypoint.rotation);
|
||||
m_OwningEntity->SetPosition(waypoint.position);
|
||||
m_OwningEntity->SetRotation(waypoint.rotation);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
size_t MovingPlatformComponent::GetLastWaypointIndex() const {
|
||||
|
@ -173,7 +173,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* movementAIComponent = m_Parent->GetComponent<MovementAIComponent>();
|
||||
auto* movementAIComponent = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (movementAIComponent != nullptr) {
|
||||
movementAIComponent->Stop();
|
||||
@ -181,7 +181,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
|
||||
inventoryComponent->DespawnPet();
|
||||
|
||||
const auto& cached = buildCache.find(m_Parent->GetLOT());
|
||||
const auto& cached = buildCache.find(m_OwningEntity->GetLOT());
|
||||
int32_t imaginationCost = 0;
|
||||
|
||||
std::string buildFile;
|
||||
@ -189,7 +189,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
if (cached == buildCache.end()) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT ValidPiecesLXF, PuzzleModelLot, Timelimit, NumValidPieces, imagCostPerBuild FROM TamingBuildPuzzles WHERE NPCLot = ?;");
|
||||
query.bind(1, (int)m_Parent->GetLOT());
|
||||
query.bind(1, (int)m_OwningEntity->GetLOT());
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
@ -216,7 +216,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
if (data.timeLimit <= 0) data.timeLimit = 60;
|
||||
imaginationCost = data.imaginationCost;
|
||||
|
||||
buildCache[m_Parent->GetLOT()] = data;
|
||||
buildCache[m_OwningEntity->GetLOT()] = data;
|
||||
|
||||
result.finalize();
|
||||
} else {
|
||||
@ -245,13 +245,13 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto petPosition = m_Parent->GetPosition();
|
||||
auto petPosition = m_OwningEntity->GetPosition();
|
||||
|
||||
auto originatorPosition = originator->GetPosition();
|
||||
|
||||
m_Parent->SetRotation(NiQuaternion::LookAt(petPosition, originatorPosition));
|
||||
m_OwningEntity->SetRotation(NiQuaternion::LookAt(petPosition, originatorPosition));
|
||||
|
||||
float interactionDistance = m_Parent->GetVar<float>(u"interaction_distance");
|
||||
float interactionDistance = m_OwningEntity->GetVar<float>(u"interaction_distance");
|
||||
|
||||
if (interactionDistance <= 0) {
|
||||
interactionDistance = 15;
|
||||
@ -259,7 +259,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
|
||||
auto position = originatorPosition;
|
||||
|
||||
NiPoint3 forward = NiQuaternion::LookAt(m_Parent->GetPosition(), originator->GetPosition()).GetForwardVector();
|
||||
NiPoint3 forward = NiQuaternion::LookAt(m_OwningEntity->GetPosition(), originator->GetPosition()).GetForwardVector();
|
||||
forward.y = 0;
|
||||
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
@ -268,7 +268,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
float y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(attempt);
|
||||
|
||||
while (std::abs(y - petPosition.y) > 4 && interactionDistance > 10) {
|
||||
const NiPoint3 forward = m_Parent->GetRotation().GetForwardVector();
|
||||
const NiPoint3 forward = m_OwningEntity->GetRotation().GetForwardVector();
|
||||
|
||||
attempt = originatorPosition + forward * interactionDistance;
|
||||
|
||||
@ -287,7 +287,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
|
||||
GameMessages::SendNotifyPetTamingMinigame(
|
||||
originator->GetObjectID(),
|
||||
m_Parent->GetObjectID(),
|
||||
m_OwningEntity->GetObjectID(),
|
||||
LWOOBJID_EMPTY,
|
||||
true,
|
||||
ePetTamingNotifyType::BEGIN,
|
||||
@ -298,7 +298,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
);
|
||||
|
||||
GameMessages::SendNotifyPetTamingMinigame(
|
||||
m_Parent->GetObjectID(),
|
||||
m_OwningEntity->GetObjectID(),
|
||||
LWOOBJID_EMPTY,
|
||||
originator->GetObjectID(),
|
||||
true,
|
||||
@ -314,17 +314,17 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
m_Tamer = originator->GetObjectID();
|
||||
SetStatus(5);
|
||||
|
||||
currentActivities.insert_or_assign(m_Tamer, m_Parent->GetObjectID());
|
||||
currentActivities.insert_or_assign(m_Tamer, m_OwningEntity->GetObjectID());
|
||||
|
||||
// Notify the start of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, originator, ePetTamingNotifyType::BEGIN);
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_OwningEntity, originator, ePetTamingNotifyType::BEGIN);
|
||||
}
|
||||
}
|
||||
|
||||
void PetComponent::Update(float deltaTime) {
|
||||
if (m_StartPosition == NiPoint3::ZERO) {
|
||||
m_StartPosition = m_Parent->GetPosition();
|
||||
m_StartPosition = m_OwningEntity->GetPosition();
|
||||
}
|
||||
|
||||
if (m_Owner == LWOOBJID_EMPTY) {
|
||||
@ -344,7 +344,7 @@ void PetComponent::Update(float deltaTime) {
|
||||
|
||||
if (m_Timer <= 0) {
|
||||
Wander();
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
} else {
|
||||
m_Timer = 5;
|
||||
@ -357,12 +357,12 @@ void PetComponent::Update(float deltaTime) {
|
||||
auto* owner = GetOwner();
|
||||
|
||||
if (owner == nullptr) {
|
||||
m_Parent->Kill();
|
||||
m_OwningEntity->Kill();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_MovementAI = m_Parent->GetComponent<MovementAIComponent>();
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (m_MovementAI == nullptr) {
|
||||
return;
|
||||
@ -382,9 +382,9 @@ void PetComponent::Update(float deltaTime) {
|
||||
m_MovementAI->Stop();
|
||||
|
||||
if (m_TresureTime <= 0) {
|
||||
m_Parent->SetOwnerOverride(m_Owner);
|
||||
m_OwningEntity->SetOwnerOverride(m_Owner);
|
||||
|
||||
tresure->Smash(m_Parent->GetObjectID());
|
||||
tresure->Smash(m_OwningEntity->GetObjectID());
|
||||
|
||||
m_Interaction = LWOOBJID_EMPTY;
|
||||
|
||||
@ -430,7 +430,7 @@ void PetComponent::Update(float deltaTime) {
|
||||
float distance = Vector3::DistanceSquared(position, switchPosition);
|
||||
if (distance < 3 * 3) {
|
||||
m_Interaction = closestSwitch->GetParentEntity()->GetObjectID();
|
||||
closestSwitch->EntityEnter(m_Parent);
|
||||
closestSwitch->EntityEnter(m_OwningEntity);
|
||||
} else if (distance < 20 * 20) {
|
||||
haltDistance = 1;
|
||||
|
||||
@ -443,7 +443,7 @@ void PetComponent::Update(float deltaTime) {
|
||||
|
||||
if (closestTresure != nullptr) {
|
||||
// Skeleton Dragon Pat special case for bone digging
|
||||
if (closestTresure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
|
||||
if (closestTresure->GetLOT() == 12192 && m_OwningEntity->GetLOT() != 13067) {
|
||||
goto skipTresure;
|
||||
}
|
||||
|
||||
@ -484,7 +484,7 @@ void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& cached = buildCache.find(m_Parent->GetLOT());
|
||||
const auto& cached = buildCache.find(m_OwningEntity->GetLOT());
|
||||
|
||||
if (cached == buildCache.end()) return;
|
||||
|
||||
@ -524,7 +524,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& cached = buildCache.find(m_Parent->GetLOT());
|
||||
const auto& cached = buildCache.find(m_OwningEntity->GetLOT());
|
||||
|
||||
if (cached == buildCache.end()) {
|
||||
return;
|
||||
@ -547,7 +547,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
|
||||
GameMessages::SendNotifyTamingModelLoadedOnServer(m_Tamer, tamer->GetSystemAddress());
|
||||
|
||||
GameMessages::SendPetResponse(m_Tamer, m_Parent->GetObjectID(), 0, 10, 0, tamer->GetSystemAddress());
|
||||
GameMessages::SendPetResponse(m_Tamer, m_OwningEntity->GetObjectID(), 0, 10, 0, tamer->GetSystemAddress());
|
||||
|
||||
auto* inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
||||
|
||||
@ -565,13 +565,13 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
std::string petName = tamer->GetCharacter()->GetName();
|
||||
petName += "'s Pet";
|
||||
|
||||
GameMessages::SendAddPetToPlayer(m_Tamer, 0, GeneralUtils::UTF8ToUTF16(petName), petSubKey, m_Parent->GetLOT(), tamer->GetSystemAddress());
|
||||
GameMessages::SendAddPetToPlayer(m_Tamer, 0, GeneralUtils::UTF8ToUTF16(petName), petSubKey, m_OwningEntity->GetLOT(), tamer->GetSystemAddress());
|
||||
|
||||
GameMessages::SendRegisterPetID(m_Tamer, m_Parent->GetObjectID(), tamer->GetSystemAddress());
|
||||
GameMessages::SendRegisterPetID(m_Tamer, m_OwningEntity->GetObjectID(), tamer->GetSystemAddress());
|
||||
|
||||
GameMessages::SendRegisterPetDBID(m_Tamer, petSubKey, tamer->GetSystemAddress());
|
||||
|
||||
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, eLootSourceType::ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
||||
inventoryComponent->AddItem(m_OwningEntity->GetLOT(), 1, eLootSourceType::ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
||||
auto* item = inventoryComponent->FindItemBySubKey(petSubKey, MODELS);
|
||||
|
||||
if (item == nullptr) {
|
||||
@ -580,7 +580,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
|
||||
DatabasePet databasePet{};
|
||||
|
||||
databasePet.lot = m_Parent->GetLOT();
|
||||
databasePet.lot = m_OwningEntity->GetLOT();
|
||||
databasePet.moderationState = 1;
|
||||
databasePet.name = petName;
|
||||
|
||||
@ -603,14 +603,14 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
|
||||
);
|
||||
|
||||
// Triggers the catch a pet missions
|
||||
if (petFlags.find(m_Parent->GetLOT()) != petFlags.end()) {
|
||||
tamer->GetCharacter()->SetPlayerFlag(petFlags.at(m_Parent->GetLOT()), true);
|
||||
if (petFlags.find(m_OwningEntity->GetLOT()) != petFlags.end()) {
|
||||
tamer->GetCharacter()->SetPlayerFlag(petFlags.at(m_OwningEntity->GetLOT()), true);
|
||||
}
|
||||
|
||||
auto* missionComponent = tamer->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(eMissionTaskType::PET_TAMING, m_Parent->GetLOT());
|
||||
missionComponent->Progress(eMissionTaskType::PET_TAMING, m_OwningEntity->GetLOT());
|
||||
}
|
||||
|
||||
SetStatus(1);
|
||||
@ -661,18 +661,18 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
//Save our pet's new name to the db:
|
||||
SetPetNameForModeration(GeneralUtils::UTF16ToWTF8(name));
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
std::u16string u16name = GeneralUtils::UTF8ToUTF16(m_Name);
|
||||
std::u16string u16ownerName = GeneralUtils::UTF8ToUTF16(m_OwnerName);
|
||||
GameMessages::SendSetPetName(m_Tamer, u16name, m_DatabaseId, tamer->GetSystemAddress());
|
||||
GameMessages::SendSetPetName(m_Tamer, u16name, LWOOBJID_EMPTY, tamer->GetSystemAddress());
|
||||
GameMessages::SendPetNameChanged(m_Parent->GetObjectID(), m_ModerationStatus, u16name, u16ownerName, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendPetNameChanged(m_OwningEntity->GetObjectID(), m_ModerationStatus, u16name, u16ownerName, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendSetPetNameModerated(m_Tamer, m_DatabaseId, m_ModerationStatus, tamer->GetSystemAddress());
|
||||
|
||||
GameMessages::SendNotifyPetTamingMinigame(
|
||||
m_Tamer,
|
||||
m_Parent->GetObjectID(),
|
||||
m_OwningEntity->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
ePetTamingNotifyType::SUCCESS,
|
||||
@ -682,7 +682,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
UNASSIGNED_SYSTEM_ADDRESS
|
||||
);
|
||||
|
||||
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_OwningEntity->GetObjectID());
|
||||
|
||||
auto* modelEntity = EntityManager::Instance()->GetEntity(m_ModelId);
|
||||
|
||||
@ -695,8 +695,8 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, ePetTamingNotifyType::SUCCESS);
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_OwningEntity, tamer, ePetTamingNotifyType::SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -713,7 +713,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
|
||||
GameMessages::SendNotifyPetTamingMinigame(
|
||||
m_Tamer,
|
||||
m_Parent->GetObjectID(),
|
||||
m_OwningEntity->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
ePetTamingNotifyType::QUIT,
|
||||
@ -725,7 +725,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
|
||||
GameMessages::SendNotifyTamingModelLoadedOnServer(m_Tamer, tamer->GetSystemAddress());
|
||||
|
||||
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_OwningEntity->GetObjectID());
|
||||
|
||||
currentActivities.erase(m_Tamer);
|
||||
|
||||
@ -733,16 +733,16 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
m_Timer = 0;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, ePetTamingNotifyType::QUIT);
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_OwningEntity, tamer, ePetTamingNotifyType::QUIT);
|
||||
}
|
||||
}
|
||||
|
||||
void PetComponent::StartTimer() {
|
||||
const auto& cached = buildCache.find(m_Parent->GetLOT());
|
||||
const auto& cached = buildCache.find(m_OwningEntity->GetLOT());
|
||||
|
||||
if (cached == buildCache.end()) {
|
||||
return;
|
||||
@ -764,7 +764,7 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
|
||||
GameMessages::SendNotifyPetTamingMinigame(
|
||||
m_Tamer,
|
||||
m_Parent->GetObjectID(),
|
||||
m_OwningEntity->GetObjectID(),
|
||||
m_Tamer,
|
||||
false,
|
||||
ePetTamingNotifyType::FAILED,
|
||||
@ -776,7 +776,7 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
|
||||
GameMessages::SendNotifyTamingModelLoadedOnServer(m_Tamer, tamer->GetSystemAddress());
|
||||
|
||||
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(m_Tamer, eTerminateType::FROM_INTERACTION, m_OwningEntity->GetObjectID());
|
||||
|
||||
currentActivities.erase(m_Tamer);
|
||||
|
||||
@ -784,16 +784,16 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
m_Timer = 0;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnNotifyPetTamingMinigame(m_Parent, tamer, ePetTamingNotifyType::FAILED);
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_OwningEntity, tamer, ePetTamingNotifyType::FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
void PetComponent::Wander() {
|
||||
m_MovementAI = m_Parent->GetComponent<MovementAIComponent>();
|
||||
m_MovementAI = m_OwningEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (m_MovementAI == nullptr || !m_MovementAI->AtFinalWaypoint()) {
|
||||
return;
|
||||
@ -847,7 +847,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) {
|
||||
|
||||
inventoryComponent->DespawnPet();
|
||||
|
||||
m_Owner = inventoryComponent->GetParent()->GetObjectID();
|
||||
m_Owner = inventoryComponent->GetOwningEntity()->GetObjectID();
|
||||
|
||||
auto* owner = GetOwner();
|
||||
|
||||
@ -883,18 +883,18 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) {
|
||||
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_Owner, true, eUnequippableActiveType::PET, m_ItemId, GetOwner()->GetSystemAddress());
|
||||
|
||||
activePets[m_Owner] = m_Parent->GetObjectID();
|
||||
activePets[m_Owner] = m_OwningEntity->GetObjectID();
|
||||
|
||||
m_Timer = 3;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
owner->GetCharacter()->SetPlayerFlag(ePlayerFlag::FIRST_MANUAL_PET_HIBERNATE, true);
|
||||
|
||||
if (registerPet) {
|
||||
GameMessages::SendAddPetToPlayer(m_Owner, 0, GeneralUtils::UTF8ToUTF16(m_Name), m_DatabaseId, m_Parent->GetLOT(), owner->GetSystemAddress());
|
||||
GameMessages::SendAddPetToPlayer(m_Owner, 0, GeneralUtils::UTF8ToUTF16(m_Name), m_DatabaseId, m_OwningEntity->GetLOT(), owner->GetSystemAddress());
|
||||
|
||||
GameMessages::SendRegisterPetID(m_Owner, m_Parent->GetObjectID(), owner->GetSystemAddress());
|
||||
GameMessages::SendRegisterPetID(m_Owner, m_OwningEntity->GetObjectID(), owner->GetSystemAddress());
|
||||
|
||||
GameMessages::SendRegisterPetDBID(m_Owner, m_DatabaseId, owner->GetSystemAddress());
|
||||
}
|
||||
@ -911,7 +911,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
|
||||
auto playerInventoryComponent = playerInventory->GetComponent();
|
||||
if (!playerInventoryComponent) return;
|
||||
|
||||
auto playerEntity = playerInventoryComponent->GetParent();
|
||||
auto playerEntity = playerInventoryComponent->GetOwningEntity();
|
||||
if (!playerEntity) return;
|
||||
|
||||
auto playerDestroyableComponent = playerEntity->GetComponent<DestroyableComponent>();
|
||||
@ -921,7 +921,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
|
||||
if (!fromTaming) playerDestroyableComponent->Imagine(-1);
|
||||
|
||||
// Set this to a variable so when this is called back from the player the timer doesn't fire off.
|
||||
m_Parent->AddCallbackTimer(imaginationDrainRate, [playerDestroyableComponent, this, item]() {
|
||||
m_OwningEntity->AddCallbackTimer(imaginationDrainRate, [playerDestroyableComponent, this, item]() {
|
||||
if (!playerDestroyableComponent) {
|
||||
Game::logger->Log("PetComponent", "No petComponent and/or no playerDestroyableComponent");
|
||||
return;
|
||||
@ -930,7 +930,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
|
||||
// If we are out of imagination despawn the pet.
|
||||
if (playerDestroyableComponent->GetImagination() == 0) {
|
||||
this->Deactivate();
|
||||
auto playerEntity = playerDestroyableComponent->GetParent();
|
||||
auto playerEntity = playerDestroyableComponent->GetOwningEntity();
|
||||
if (!playerEntity) return;
|
||||
|
||||
GameMessages::SendUseItemRequirementsResponse(playerEntity->GetObjectID(), playerEntity->GetSystemAddress(), eUseItemResponse::NoImaginationForPet);
|
||||
@ -941,13 +941,13 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
|
||||
}
|
||||
|
||||
void PetComponent::Deactivate() {
|
||||
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), -1, u"despawn", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
GameMessages::SendPlayFXEffect(m_OwningEntity->GetObjectID(), -1, u"despawn", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_Owner, false, eUnequippableActiveType::PET, m_ItemId, GetOwner()->GetSystemAddress());
|
||||
|
||||
activePets.erase(m_Owner);
|
||||
|
||||
m_Parent->Kill();
|
||||
m_OwningEntity->Kill();
|
||||
|
||||
auto* owner = GetOwner();
|
||||
|
||||
@ -987,7 +987,7 @@ void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandTy
|
||||
|
||||
if (commandType == 1) {
|
||||
// Emotes
|
||||
GameMessages::SendPlayEmote(m_Parent->GetObjectID(), typeId, owner->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendPlayEmote(m_OwningEntity->GetObjectID(), typeId, owner->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (commandType == 3) {
|
||||
// Follow me, ???
|
||||
} else if (commandType == 6) {
|
||||
@ -1076,7 +1076,7 @@ PetComponent* PetComponent::GetActivePet(LWOOBJID owner) {
|
||||
}
|
||||
|
||||
Entity* PetComponent::GetParentEntity() const {
|
||||
return m_Parent;
|
||||
return m_OwningEntity;
|
||||
}
|
||||
|
||||
PetComponent::~PetComponent() {
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include "dpShapeSphere.h"
|
||||
|
||||
PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(parent) {
|
||||
m_Position = m_Parent->GetDefaultPosition();
|
||||
m_Rotation = m_Parent->GetDefaultRotation();
|
||||
m_Scale = m_Parent->GetDefaultScale();
|
||||
m_Position = m_OwningEntity->GetDefaultPosition();
|
||||
m_Rotation = m_OwningEntity->GetDefaultRotation();
|
||||
m_Scale = m_OwningEntity->GetDefaultScale();
|
||||
m_dpEntity = nullptr;
|
||||
|
||||
m_EffectInfoDirty = false;
|
||||
@ -47,17 +47,17 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
m_IsDirectional = false;
|
||||
m_Direction = NiPoint3(); // * m_DirectionalMultiplier
|
||||
|
||||
if (m_Parent->GetVar<bool>(u"create_physics")) {
|
||||
if (m_OwningEntity->GetVar<bool>(u"create_physics")) {
|
||||
CreatePhysics();
|
||||
}
|
||||
|
||||
if (m_Parent->GetVar<bool>(u"respawnVol")) {
|
||||
if (m_OwningEntity->GetVar<bool>(u"respawnVol")) {
|
||||
m_IsRespawnVolume = true;
|
||||
}
|
||||
|
||||
if (m_IsRespawnVolume) {
|
||||
{
|
||||
auto respawnString = std::stringstream(m_Parent->GetVarAsString(u"rspPos"));
|
||||
auto respawnString = std::stringstream(m_OwningEntity->GetVarAsString(u"rspPos"));
|
||||
|
||||
std::string segment;
|
||||
std::vector<std::string> seglist;
|
||||
@ -70,7 +70,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
}
|
||||
|
||||
{
|
||||
auto respawnString = std::stringstream(m_Parent->GetVarAsString(u"rspRot"));
|
||||
auto respawnString = std::stringstream(m_OwningEntity->GetVarAsString(u"rspRot"));
|
||||
|
||||
std::string segment;
|
||||
std::vector<std::string> seglist;
|
||||
@ -84,7 +84,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
}
|
||||
|
||||
// HF - RespawnPoints. Legacy respawn entity.
|
||||
if (m_Parent->GetLOT() == 4945) {
|
||||
if (m_OwningEntity->GetLOT() == 4945) {
|
||||
m_IsRespawnVolume = true;
|
||||
m_RespawnPos = m_Position;
|
||||
m_RespawnRot = m_Rotation;
|
||||
@ -133,7 +133,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Parent->GetLOT() == 4945) // HF - RespawnPoints
|
||||
if (m_OwningEntity->GetLOT() == 4945) // HF - RespawnPoints
|
||||
{
|
||||
m_IsRespawnVolume = true;
|
||||
m_RespawnPos = m_Position;
|
||||
@ -145,7 +145,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
|
||||
if (!m_HasCreatedPhysics) {
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
auto componentID = compRegistryTable->GetByIDAndType(m_Parent->GetLOT(), eReplicaComponentType::PHANTOM_PHYSICS);
|
||||
auto componentID = compRegistryTable->GetByIDAndType(m_OwningEntity->GetLOT(), eReplicaComponentType::PHANTOM_PHYSICS);
|
||||
|
||||
CDPhysicsComponentTable* physComp = CDClientManager::Instance().GetTable<CDPhysicsComponentTable>();
|
||||
|
||||
@ -156,7 +156,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
|
||||
//temp test
|
||||
if (info->physicsAsset == "miscellaneous\\misc_phys_10x1x5.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 10.0f, 5.0f, 1.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 10.0f, 5.0f, 1.0f);
|
||||
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
@ -167,7 +167,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
// Move this down by 13.521004 units so it is still effectively at the same height as before
|
||||
m_Position = m_Position - NiPoint3::UNIT_Y * 13.521004f;
|
||||
// TODO Fix physics simulation to do simulation at high velocities due to bullet through paper problem...
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 1638.4f, 13.521004f * 2.0f, 1638.4f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 1638.4f, 13.521004f * 2.0f, 1638.4f);
|
||||
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
@ -175,49 +175,49 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\trigger_wall_tall.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 10.0f, 25.0f, 1.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 10.0f, 25.0f, 1.0f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\env_gen_placeholderphysics.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 20.0f, 20.0f, 20.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 20.0f, 20.0f, 20.0f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\POI_trigger_wall.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 1.0f, 12.5f, 20.0f); // Not sure what the real size is
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 1.0f, 12.5f, 20.0f); // Not sure what the real size is
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\NG_NinjaGo\\env_ng_gen_gate_chamber_puzzle_ceiling_tile_falling_phantom.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 18.0f, 5.0f, 15.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 18.0f, 5.0f, 15.0f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position + m_Rotation.GetForwardVector() * 7.5f);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\NG_NinjaGo\\ng_flamejet_brick_phantom.HKX") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 1.0f, 1.0f, 12.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 1.0f, 1.0f, 12.0f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position + m_Rotation.GetForwardVector() * 6.0f);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\Ring_Trigger.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 6.0f, 6.0f, 6.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 6.0f, 6.0f, 6.0f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\vfx_propertyImaginationBall.hkx") {
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 4.5f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 4.5f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||
} else if (info->physicsAsset == "env\\env_won_fv_gas-blocking-volume.hkx"){
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 390.496826f, 111.467964f, 600.821534f, true);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 390.496826f, 111.467964f, 600.821534f, true);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_Position.y -= (111.467964f * m_Scale) / 2;
|
||||
@ -227,7 +227,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
|
||||
//Game::logger->Log("PhantomPhysicsComponent", "This one is supposed to have %s", info->physicsAsset.c_str());
|
||||
|
||||
//add fallback cube:
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 2.0f, 2.0f, 2.0f);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), 2.0f, 2.0f, 2.0f);
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
@ -255,14 +255,14 @@ void PhantomPhysicsComponent::CreatePhysics() {
|
||||
float width = 0.0f; //aka "radius"
|
||||
float height = 0.0f;
|
||||
|
||||
if (m_Parent->HasVar(u"primitiveModelType")) {
|
||||
type = m_Parent->GetVar<int32_t>(u"primitiveModelType");
|
||||
x = m_Parent->GetVar<float>(u"primitiveModelValueX");
|
||||
y = m_Parent->GetVar<float>(u"primitiveModelValueY");
|
||||
z = m_Parent->GetVar<float>(u"primitiveModelValueZ");
|
||||
if (m_OwningEntity->HasVar(u"primitiveModelType")) {
|
||||
type = m_OwningEntity->GetVar<int32_t>(u"primitiveModelType");
|
||||
x = m_OwningEntity->GetVar<float>(u"primitiveModelValueX");
|
||||
y = m_OwningEntity->GetVar<float>(u"primitiveModelValueY");
|
||||
z = m_OwningEntity->GetVar<float>(u"primitiveModelValueZ");
|
||||
} else {
|
||||
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
auto componentID = compRegistryTable->GetByIDAndType(m_Parent->GetLOT(), eReplicaComponentType::PHANTOM_PHYSICS);
|
||||
auto componentID = compRegistryTable->GetByIDAndType(m_OwningEntity->GetLOT(), eReplicaComponentType::PHANTOM_PHYSICS);
|
||||
|
||||
CDPhysicsComponentTable* physComp = CDClientManager::Instance().GetTable<CDPhysicsComponentTable>();
|
||||
|
||||
@ -292,7 +292,7 @@ void PhantomPhysicsComponent::CreatePhysics() {
|
||||
boxSize = NiPoint3(width, height, width);
|
||||
}
|
||||
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), boxSize);
|
||||
m_dpEntity = new dpEntity(m_OwningEntity->GetObjectID(), boxSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -358,7 +358,7 @@ void PhantomPhysicsComponent::Update(float deltaTime) {
|
||||
|
||||
//Process enter events
|
||||
for (auto en : m_dpEntity->GetNewObjects()) {
|
||||
m_Parent->OnCollisionPhantom(en->GetObjectID());
|
||||
m_OwningEntity->OnCollisionPhantom(en->GetObjectID());
|
||||
|
||||
//If we are a respawn volume, inform the client:
|
||||
if (m_IsRespawnVolume) {
|
||||
@ -374,7 +374,7 @@ void PhantomPhysicsComponent::Update(float deltaTime) {
|
||||
|
||||
//Process exit events
|
||||
for (auto en : m_dpEntity->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionLeavePhantom(en->GetObjectID());
|
||||
m_OwningEntity->OnCollisionLeavePhantom(en->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,7 +391,7 @@ void PhantomPhysicsComponent::SetDirection(const NiPoint3& pos) {
|
||||
void PhantomPhysicsComponent::SpawnVertices() {
|
||||
if (!m_dpEntity) return;
|
||||
|
||||
std::cout << m_Parent->GetObjectID() << std::endl;
|
||||
std::cout << m_OwningEntity->GetObjectID() << std::endl;
|
||||
auto box = static_cast<dpShapeBox*>(m_dpEntity->GetShape());
|
||||
for (auto vert : box->GetVertices()) {
|
||||
std::cout << vert.x << ", " << vert.y << ", " << vert.z << std::endl;
|
||||
@ -400,7 +400,7 @@ void PhantomPhysicsComponent::SpawnVertices() {
|
||||
info.lot = 33;
|
||||
info.pos = vert;
|
||||
info.spawner = nullptr;
|
||||
info.spawnerID = m_Parent->GetObjectID();
|
||||
info.spawnerID = m_OwningEntity->GetObjectID();
|
||||
info.spawnerNodeID = 0;
|
||||
|
||||
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "PlayerForcedMovementComponent.h"
|
||||
|
||||
PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent) : Component(parent) {
|
||||
m_Parent = parent;
|
||||
m_OwningEntity = parent;
|
||||
}
|
||||
|
||||
PlayerForcedMovementComponent::~PlayerForcedMovementComponent() {}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
PossessableComponent::PossessableComponent(Entity* parent, uint32_t componentId) : Component(parent) {
|
||||
m_Possessor = LWOOBJID_EMPTY;
|
||||
CDItemComponent item = Inventory::FindItemComponent(m_Parent->GetLOT());
|
||||
CDItemComponent item = Inventory::FindItemComponent(m_OwningEntity->GetLOT());
|
||||
m_AnimationFlag = static_cast<eAnimationFlags>(item.animationFlag);
|
||||
|
||||
// Get the possession Type from the CDClient
|
||||
@ -44,12 +44,12 @@ void PossessableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
|
||||
|
||||
void PossessableComponent::Dismount() {
|
||||
SetPossessor(LWOOBJID_EMPTY);
|
||||
if (m_ItemSpawned) m_Parent->ScheduleKillAfterUpdate();
|
||||
if (m_ItemSpawned) m_OwningEntity->ScheduleKillAfterUpdate();
|
||||
}
|
||||
|
||||
void PossessableComponent::OnUse(Entity* originator) {
|
||||
auto* possessor = originator->GetComponent<PossessorComponent>();
|
||||
if (possessor) {
|
||||
possessor->Mount(m_Parent);
|
||||
possessor->Mount(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ PossessorComponent::~PossessorComponent() {
|
||||
auto* possessable = mount->GetComponent<PossessableComponent>();
|
||||
if (possessable) {
|
||||
if (possessable->GetIsItemSpawned()) {
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_Parent->GetObjectID(), false, eUnequippableActiveType::MOUNT, GetMountItemID(), m_Parent->GetSystemAddress());
|
||||
GameMessages::SendMarkInventoryItemAsActive(m_OwningEntity->GetObjectID(), false, eUnequippableActiveType::MOUNT, GetMountItemID(), m_OwningEntity->GetSystemAddress());
|
||||
}
|
||||
possessable->Dismount();
|
||||
}
|
||||
@ -42,23 +42,23 @@ void PossessorComponent::Mount(Entity* mount) {
|
||||
// Don't do anything if we are busy dismounting
|
||||
if (GetIsDismounting() || !mount) return;
|
||||
|
||||
GameMessages::SendSetMountInventoryID(m_Parent, mount->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendSetMountInventoryID(m_OwningEntity, mount->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent) {
|
||||
possessableComponent->SetPossessor(m_Parent->GetObjectID());
|
||||
possessableComponent->SetPossessor(m_OwningEntity->GetObjectID());
|
||||
SetPossessable(mount->GetObjectID());
|
||||
SetPossessableType(possessableComponent->GetPossessionType());
|
||||
}
|
||||
|
||||
auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SetIsRacing(true);
|
||||
|
||||
// GM's to send
|
||||
GameMessages::SendSetJetPackMode(m_Parent, false);
|
||||
GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
|
||||
GameMessages::SendSetStunned(m_Parent->GetObjectID(), eStateChangeType::PUSH, m_Parent->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
||||
GameMessages::SendSetJetPackMode(m_OwningEntity, false);
|
||||
GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_OwningEntity->GetSystemAddress());
|
||||
GameMessages::SendSetStunned(m_OwningEntity->GetObjectID(), eStateChangeType::PUSH, m_OwningEntity->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
EntityManager::Instance()->SerializeEntity(mount);
|
||||
}
|
||||
|
||||
@ -73,12 +73,12 @@ void PossessorComponent::Dismount(Entity* mount, bool forceDismount) {
|
||||
possessableComponent->SetPossessor(LWOOBJID_EMPTY);
|
||||
if (forceDismount) possessableComponent->ForceDepossess();
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
EntityManager::Instance()->SerializeEntity(mount);
|
||||
|
||||
auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||
auto characterComponent = m_OwningEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SetIsRacing(false);
|
||||
}
|
||||
// Make sure we don't have wacky controls
|
||||
GameMessages::SendSetPlayerControlScheme(m_Parent, eControlScheme::SCHEME_A);
|
||||
GameMessages::SendSetPlayerControlScheme(m_OwningEntity, eControlScheme::SCHEME_A);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ void PropertyEntranceComponent::OnUse(Entity* entity) {
|
||||
auto* rocket = entity->GetComponent<CharacterComponent>()->RocketEquip(entity);
|
||||
if (!rocket) return;
|
||||
|
||||
GameMessages::SendPropertyEntranceBegin(m_Parent->GetObjectID(), entity->GetSystemAddress());
|
||||
GameMessages::SendPropertyEntranceBegin(m_OwningEntity->GetObjectID(), entity->GetSystemAddress());
|
||||
|
||||
AMFArrayValue args;
|
||||
|
||||
@ -63,7 +63,7 @@ void PropertyEntranceComponent::OnEnterProperty(Entity* entity, uint32_t index,
|
||||
cloneId = query[index].CloneId;
|
||||
}
|
||||
|
||||
auto* launcher = m_Parent->GetComponent<RocketLaunchpadControlComponent>();
|
||||
auto* launcher = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
|
||||
if (launcher == nullptr) {
|
||||
return;
|
||||
@ -330,5 +330,5 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
|
||||
delete propertiesLeft;
|
||||
propertiesLeft = nullptr;
|
||||
|
||||
GameMessages::SendPropertySelectQuery(m_Parent->GetObjectID(), startIndex, numberOfProperties - (startIndex + numResults) > 0, character->GetPropertyCloneID(), false, true, entries, sysAddr);
|
||||
GameMessages::SendPropertySelectQuery(m_OwningEntity->GetObjectID(), startIndex, numberOfProperties - (startIndex + numResults) > 0, character->GetPropertyCloneID(), false, true, entries, sysAddr);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) {
|
||||
std::string name = zone->GetZoneName();
|
||||
std::string description = "";
|
||||
|
||||
auto prop_path = zone->GetPath(m_Parent->GetVarAsString(u"propertyName"));
|
||||
auto prop_path = zone->GetPath(m_OwningEntity->GetVarAsString(u"propertyName"));
|
||||
|
||||
if (prop_path){
|
||||
if (!prop_path->property.displayName.empty()) name = prop_path->property.displayName;
|
||||
@ -395,7 +395,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
||||
|
||||
models.insert_or_assign(model->GetObjectID(), spawnerId);
|
||||
|
||||
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), position, m_Parent->GetObjectID(), 14, originalRotation);
|
||||
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), position, m_OwningEntity->GetObjectID(), 14, originalRotation);
|
||||
|
||||
GameMessages::SendUGCEquipPreCreateBasedOnEditMode(entity->GetObjectID(), entity->GetSystemAddress(), 0, spawnerId);
|
||||
|
||||
@ -783,7 +783,7 @@ PropertyManagementComponent* PropertyManagementComponent::Instance() {
|
||||
|
||||
void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const SystemAddress& sysAddr, LWOOBJID author) {
|
||||
if (author == LWOOBJID_EMPTY) {
|
||||
author = m_Parent->GetObjectID();
|
||||
author = m_OwningEntity->GetObjectID();
|
||||
}
|
||||
|
||||
const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID();
|
||||
@ -861,7 +861,7 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const
|
||||
|
||||
void PropertyManagementComponent::OnUse(Entity* originator) {
|
||||
OnQueryPropertyData(originator, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendOpenPropertyManagment(m_Parent->GetObjectID(), originator->GetSystemAddress());
|
||||
GameMessages::SendOpenPropertyManagment(m_OwningEntity->GetObjectID(), originator->GetSystemAddress());
|
||||
}
|
||||
|
||||
void PropertyManagementComponent::SetOwnerId(const LWOOBJID value) {
|
||||
|
@ -21,7 +21,7 @@ void PropertyVendorComponent::OnUse(Entity* originator) {
|
||||
if (PropertyManagementComponent::Instance()->GetOwnerId() == LWOOBJID_EMPTY) {
|
||||
Game::logger->Log("PropertyVendorComponent", "Property vendor opening!");
|
||||
|
||||
GameMessages::SendOpenPropertyVendor(m_Parent->GetObjectID(), originator->GetSystemAddress());
|
||||
GameMessages::SendOpenPropertyVendor(m_OwningEntity->GetObjectID(), originator->GetSystemAddress());
|
||||
|
||||
return;
|
||||
}
|
||||
@ -30,7 +30,7 @@ void PropertyVendorComponent::OnUse(Entity* originator) {
|
||||
void PropertyVendorComponent::OnQueryPropertyData(Entity* originator, const SystemAddress& sysAddr) {
|
||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
||||
|
||||
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, sysAddr, m_Parent->GetObjectID());
|
||||
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, sysAddr, m_OwningEntity->GetObjectID());
|
||||
}
|
||||
|
||||
void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool confirmed, const LOT lot, const uint32_t count) {
|
||||
@ -41,11 +41,11 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPropertyRentalResponse(m_Parent->GetObjectID(), 0, 0, 0, 0, originator->GetSystemAddress());
|
||||
GameMessages::SendPropertyRentalResponse(m_OwningEntity->GetObjectID(), 0, 0, 0, 0, originator->GetSystemAddress());
|
||||
|
||||
auto* controller = dZoneManager::Instance()->GetZoneControlObject();
|
||||
|
||||
controller->OnFireEventServerSide(m_Parent, "propertyRented");
|
||||
controller->OnFireEventServerSide(m_OwningEntity, "propertyRented");
|
||||
|
||||
PropertyManagementComponent::Instance()->SetOwner(originator);
|
||||
|
||||
|
@ -25,8 +25,8 @@ ProximityMonitorComponent::~ProximityMonitorComponent() {
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::SetProximityRadius(float proxRadius, const std::string& name) {
|
||||
dpEntity* en = new dpEntity(m_Parent->GetObjectID(), proxRadius);
|
||||
en->SetPosition(m_Parent->GetPosition());
|
||||
dpEntity* en = new dpEntity(m_OwningEntity->GetObjectID(), proxRadius);
|
||||
en->SetPosition(m_OwningEntity->GetPosition());
|
||||
|
||||
dpWorld::Instance().AddEntity(en);
|
||||
m_ProximitiesData.insert(std::make_pair(name, en));
|
||||
@ -34,7 +34,7 @@ void ProximityMonitorComponent::SetProximityRadius(float proxRadius, const std::
|
||||
|
||||
void ProximityMonitorComponent::SetProximityRadius(dpEntity* entity, const std::string& name) {
|
||||
dpWorld::Instance().AddEntity(entity);
|
||||
entity->SetPosition(m_Parent->GetPosition());
|
||||
entity->SetPosition(m_OwningEntity->GetPosition());
|
||||
m_ProximitiesData.insert(std::make_pair(name, entity));
|
||||
}
|
||||
|
||||
@ -66,12 +66,12 @@ void ProximityMonitorComponent::Update(float deltaTime) {
|
||||
|
||||
//Process enter events
|
||||
for (auto* en : prox.second->GetNewObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), prox.first, "ENTER");
|
||||
m_OwningEntity->OnCollisionProximity(en->GetObjectID(), prox.first, "ENTER");
|
||||
}
|
||||
|
||||
//Process exit events
|
||||
for (auto* en : prox.second->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), prox.first, "LEAVE");
|
||||
m_OwningEntity->OnCollisionProximity(en->GetObjectID(), prox.first, "LEAVE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,13 +133,13 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
info.lot = 8092;
|
||||
info.pos = startPosition;
|
||||
info.rot = startRotation;
|
||||
info.spawnerID = m_Parent->GetObjectID();
|
||||
info.spawnerID = m_OwningEntity->GetObjectID();
|
||||
|
||||
auto* carEntity =
|
||||
EntityManager::Instance()->CreateEntity(info, nullptr, m_Parent);
|
||||
EntityManager::Instance()->CreateEntity(info, nullptr, m_OwningEntity);
|
||||
|
||||
// Make the vehicle a child of the racing controller.
|
||||
m_Parent->AddChild(carEntity);
|
||||
m_OwningEntity->AddChild(carEntity);
|
||||
|
||||
auto* destroyableComponent =
|
||||
carEntity->GetComponent<DestroyableComponent>();
|
||||
@ -209,17 +209,17 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(carEntity);
|
||||
EntityManager::Instance()->SerializeEntity(player);
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
GameMessages::SendRacingSetPlayerResetInfo(
|
||||
m_Parent->GetObjectID(), 0, 0, player->GetObjectID(), startPosition, 1,
|
||||
m_OwningEntity->GetObjectID(), 0, 0, player->GetObjectID(), startPosition, 1,
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
const auto playerID = player->GetObjectID();
|
||||
|
||||
// Reset the player to the start position during downtime, in case something
|
||||
// went wrong.
|
||||
m_Parent->AddCallbackTimer(1, [this, playerID]() {
|
||||
m_OwningEntity->AddCallbackTimer(1, [this, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
@ -227,14 +227,14 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
||||
}
|
||||
|
||||
GameMessages::SendRacingResetPlayerToLastReset(
|
||||
m_Parent->GetObjectID(), playerID, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
m_OwningEntity->GetObjectID(), playerID, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
});
|
||||
|
||||
GameMessages::SendSetJetPackMode(player, false);
|
||||
|
||||
// Set the vehicle's state.
|
||||
GameMessages::SendNotifyVehicleOfRacingObject(carEntity->GetObjectID(),
|
||||
m_Parent->GetObjectID(),
|
||||
m_OwningEntity->GetObjectID(),
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
GameMessages::SendVehicleSetWheelLockState(carEntity->GetObjectID(), false,
|
||||
@ -257,7 +257,7 @@ void RacingControlComponent::OnRacingClientReady(Entity* player) {
|
||||
if (racingPlayer.playerID != player->GetObjectID()) {
|
||||
if (racingPlayer.playerLoaded) {
|
||||
GameMessages::SendRacingPlayerLoaded(
|
||||
m_Parent->GetObjectID(), racingPlayer.playerID,
|
||||
m_OwningEntity->GetObjectID(), racingPlayer.playerID,
|
||||
racingPlayer.vehicleID, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
@ -267,11 +267,11 @@ void RacingControlComponent::OnRacingClientReady(Entity* player) {
|
||||
racingPlayer.playerLoaded = true;
|
||||
|
||||
GameMessages::SendRacingPlayerLoaded(
|
||||
m_Parent->GetObjectID(), racingPlayer.playerID,
|
||||
m_OwningEntity->GetObjectID(), racingPlayer.playerID,
|
||||
racingPlayer.vehicleID, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
@ -304,15 +304,15 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
|
||||
// Respawn the player in 2 seconds, as was done in live. Not sure if this value is in a setting somewhere else...
|
||||
vehicle->AddCallbackTimer(2.0f, [=]() {
|
||||
if (!vehicle || !this->m_Parent) return;
|
||||
if (!vehicle || !this->m_OwningEntity) return;
|
||||
GameMessages::SendRacingResetPlayerToLastReset(
|
||||
m_Parent->GetObjectID(), racingPlayer.playerID,
|
||||
m_OwningEntity->GetObjectID(), racingPlayer.playerID,
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
GameMessages::SendVehicleStopBoost(vehicle, player->GetSystemAddress(), true);
|
||||
|
||||
GameMessages::SendRacingSetPlayerResetInfo(
|
||||
m_Parent->GetObjectID(), racingPlayer.lap,
|
||||
m_OwningEntity->GetObjectID(), racingPlayer.lap,
|
||||
racingPlayer.respawnIndex, player->GetObjectID(),
|
||||
racingPlayer.respawnPosition, racingPlayer.respawnIndex + 1,
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
@ -330,12 +330,12 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
|
||||
}
|
||||
} else {
|
||||
GameMessages::SendRacingSetPlayerResetInfo(
|
||||
m_Parent->GetObjectID(), racingPlayer.lap,
|
||||
m_OwningEntity->GetObjectID(), racingPlayer.lap,
|
||||
racingPlayer.respawnIndex, player->GetObjectID(),
|
||||
racingPlayer.respawnPosition, racingPlayer.respawnIndex + 1,
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendRacingResetPlayerToLastReset(
|
||||
m_Parent->GetObjectID(), racingPlayer.playerID,
|
||||
m_OwningEntity->GetObjectID(), racingPlayer.playerID,
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
}
|
||||
@ -379,11 +379,11 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
|
||||
// Calculate the score, different loot depending on player count
|
||||
const auto score = m_LoadedPlayers * 10 + data->finished;
|
||||
|
||||
LootGenerator::Instance().GiveActivityLoot(player, m_Parent, m_ActivityID, score);
|
||||
LootGenerator::Instance().GiveActivityLoot(player, m_OwningEntity, m_ActivityID, score);
|
||||
|
||||
// Giving rewards
|
||||
GameMessages::SendNotifyRacingClient(
|
||||
m_Parent->GetObjectID(), 2, 0, LWOOBJID_EMPTY, u"",
|
||||
m_OwningEntity->GetObjectID(), 2, 0, LWOOBJID_EMPTY, u"",
|
||||
player->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
@ -413,7 +413,7 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
|
||||
|
||||
// Exiting race
|
||||
GameMessages::SendNotifyRacingClient(
|
||||
m_Parent->GetObjectID(), 3, 0, LWOOBJID_EMPTY, u"",
|
||||
m_OwningEntity->GetObjectID(), 3, 0, LWOOBJID_EMPTY, u"",
|
||||
player->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
auto* playerInstance = dynamic_cast<Player*>(player);
|
||||
@ -621,7 +621,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
// Setup for racing
|
||||
if (m_StartTimer == 0) {
|
||||
GameMessages::SendNotifyRacingClient(
|
||||
m_Parent->GetObjectID(), 1, 0, LWOOBJID_EMPTY, u"",
|
||||
m_OwningEntity->GetObjectID(), 1, 0, LWOOBJID_EMPTY, u"",
|
||||
LWOOBJID_EMPTY, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
for (const auto& player : m_RacingPlayers) {
|
||||
@ -705,14 +705,14 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
}
|
||||
|
||||
// Start the race
|
||||
GameMessages::SendActivityStart(m_Parent->GetObjectID(),
|
||||
GameMessages::SendActivityStart(m_OwningEntity->GetObjectID(),
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
m_Started = true;
|
||||
|
||||
Game::logger->Log("RacingControlComponent", "Starting race");
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
m_StartTime = std::time(nullptr);
|
||||
}
|
||||
@ -743,7 +743,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
// If the player is this far below the map, safe to assume they should
|
||||
// be smashed by death plane
|
||||
if (vehiclePosition.y < -500) {
|
||||
GameMessages::SendDie(vehicle, m_Parent->GetObjectID(),
|
||||
GameMessages::SendDie(vehicle, m_OwningEntity->GetObjectID(),
|
||||
LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0,
|
||||
true, false, 0);
|
||||
|
||||
|
@ -43,7 +43,7 @@ RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t component
|
||||
RailActivatorComponent::~RailActivatorComponent() = default;
|
||||
|
||||
void RailActivatorComponent::OnUse(Entity* originator) {
|
||||
auto* rebuildComponent = m_Parent->GetComponent<RebuildComponent>();
|
||||
auto* rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() != eRebuildState::COMPLETED)
|
||||
return;
|
||||
|
||||
@ -67,7 +67,7 @@ void RailActivatorComponent::OnUse(Entity* originator) {
|
||||
|
||||
const auto originatorID = originator->GetObjectID();
|
||||
|
||||
m_Parent->AddCallbackTimer(animationLength, [originatorID, this]() {
|
||||
m_OwningEntity->AddCallbackTimer(animationLength, [originatorID, this]() {
|
||||
auto* originator = EntityManager::Instance()->GetEntity(originatorID);
|
||||
|
||||
if (originator == nullptr) {
|
||||
@ -78,7 +78,7 @@ void RailActivatorComponent::OnUse(Entity* originator) {
|
||||
m_loopSound, m_StopSound, originator->GetSystemAddress(),
|
||||
m_PathStart, m_PathDirection, m_DamageImmune, m_NoAggro, m_NotifyArrived,
|
||||
m_ShowNameBillboard, m_CameraLocked, m_CollisionEnabled, m_UseDB, m_ComponentID,
|
||||
m_Parent->GetObjectID());
|
||||
m_OwningEntity->GetObjectID());
|
||||
});
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ void RailActivatorComponent::OnRailMovementReady(Entity* originator) const {
|
||||
|
||||
GameMessages::SendSetRailMovement(originator->GetObjectID(), m_PathDirection, m_Path, m_PathStart,
|
||||
originator->GetSystemAddress(), m_ComponentID,
|
||||
m_Parent->GetObjectID());
|
||||
m_OwningEntity->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ void RailActivatorComponent::OnCancelRailMovement(Entity* originator) {
|
||||
true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
auto* rebuildComponent = m_Parent->GetComponent<RebuildComponent>();
|
||||
auto* rebuildComponent = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent != nullptr) {
|
||||
// Set back reset time
|
||||
|
@ -33,14 +33,14 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) {
|
||||
|
||||
// Should a setting that has the build activator position exist, fetch that setting here and parse it for position.
|
||||
// It is assumed that the user who sets this setting uses the correct character delimiter (character 31 or in hex 0x1F)
|
||||
auto positionAsVector = GeneralUtils::SplitString(m_Parent->GetVarAsString(u"rebuild_activators"), 0x1F);
|
||||
auto positionAsVector = GeneralUtils::SplitString(m_OwningEntity->GetVarAsString(u"rebuild_activators"), 0x1F);
|
||||
if (positionAsVector.size() == 3 &&
|
||||
GeneralUtils::TryParse(positionAsVector[0], m_ActivatorPosition.x) &&
|
||||
GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) &&
|
||||
GeneralUtils::TryParse(positionAsVector[2], m_ActivatorPosition.z)) {
|
||||
} else {
|
||||
Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.", m_Parent->GetLOT());
|
||||
m_ActivatorPosition = m_Parent->GetPosition();
|
||||
Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.", m_OwningEntity->GetLOT());
|
||||
m_ActivatorPosition = m_OwningEntity->GetPosition();
|
||||
}
|
||||
|
||||
SpawnActivator();
|
||||
@ -58,7 +58,7 @@ RebuildComponent::~RebuildComponent() {
|
||||
}
|
||||
|
||||
void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||
if (m_Parent->GetComponent(eReplicaComponentType::DESTROYABLE) == nullptr) {
|
||||
if (m_OwningEntity->GetComponent(eReplicaComponentType::DESTROYABLE) == nullptr) {
|
||||
if (bIsInitialUpdate) {
|
||||
outBitStream->Write(false);
|
||||
}
|
||||
@ -120,7 +120,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
else {
|
||||
m_SoftTimer = 5.0f;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}*/
|
||||
|
||||
switch (m_State) {
|
||||
@ -128,7 +128,7 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
SpawnActivator();
|
||||
m_TimeBeforeDrain = 0;
|
||||
|
||||
auto* spawner = m_Parent->GetSpawner();
|
||||
auto* spawner = m_OwningEntity->GetSpawner();
|
||||
const bool isSmashGroup = spawner != nullptr ? spawner->GetIsSpawnSmashGroup() : false;
|
||||
|
||||
if (isSmashGroup) {
|
||||
@ -139,13 +139,13 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
if (m_TimerIncomplete >= m_TimeBeforeSmash - 4.0f) {
|
||||
m_ShowResetEffect = true;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
||||
m_Builder = LWOOBJID_EMPTY;
|
||||
|
||||
GameMessages::SendDieNoImplCode(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
GameMessages::SendDieNoImplCode(m_OwningEntity, LWOOBJID_EMPTY, LWOOBJID_EMPTY, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
|
||||
ResetRebuild(false);
|
||||
}
|
||||
@ -163,13 +163,13 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
if (!m_ShowResetEffect) {
|
||||
m_ShowResetEffect = true;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Timer >= m_ResetTime) {
|
||||
|
||||
GameMessages::SendDieNoImplCode(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
GameMessages::SendDieNoImplCode(m_OwningEntity, LWOOBJID_EMPTY, LWOOBJID_EMPTY, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
|
||||
ResetRebuild(false);
|
||||
}
|
||||
@ -225,13 +225,13 @@ void RebuildComponent::Update(float deltaTime) {
|
||||
if (m_TimerIncomplete >= m_TimeBeforeSmash - 4.0f) {
|
||||
m_ShowResetEffect = true;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
if (m_TimerIncomplete >= m_TimeBeforeSmash) {
|
||||
m_Builder = LWOOBJID_EMPTY;
|
||||
|
||||
GameMessages::SendDieNoImplCode(m_Parent, LWOOBJID_EMPTY, LWOOBJID_EMPTY, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
GameMessages::SendDieNoImplCode(m_OwningEntity, LWOOBJID_EMPTY, LWOOBJID_EMPTY, eKillType::VIOLENT, u"", 0.0f, 0.0f, 0.0f, false, true);
|
||||
|
||||
ResetRebuild(false);
|
||||
}
|
||||
@ -260,16 +260,16 @@ void RebuildComponent::SpawnActivator() {
|
||||
EntityInfo info;
|
||||
|
||||
info.lot = 6604;
|
||||
info.spawnerID = m_Parent->GetObjectID();
|
||||
info.pos = m_ActivatorPosition == NiPoint3::ZERO ? m_Parent->GetPosition() : m_ActivatorPosition;
|
||||
info.spawnerID = m_OwningEntity->GetObjectID();
|
||||
info.pos = m_ActivatorPosition == NiPoint3::ZERO ? m_OwningEntity->GetPosition() : m_ActivatorPosition;
|
||||
|
||||
m_Activator = EntityManager::Instance()->CreateEntity(info, nullptr, m_Parent);
|
||||
m_Activator = EntityManager::Instance()->CreateEntity(info, nullptr, m_OwningEntity);
|
||||
if (m_Activator) {
|
||||
m_ActivatorId = m_Activator->GetObjectID();
|
||||
EntityManager::Instance()->ConstructEntity(m_Activator);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -405,25 +405,25 @@ void RebuildComponent::StartRebuild(Entity* user) {
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(user);
|
||||
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::BUILDING, user->GetObjectID());
|
||||
GameMessages::SendEnableRebuild(m_Parent, true, false, false, eQuickBuildFailReason::NOT_GIVEN, 0.0f, user->GetObjectID());
|
||||
GameMessages::SendRebuildNotifyState(m_OwningEntity, m_State, eRebuildState::BUILDING, user->GetObjectID());
|
||||
GameMessages::SendEnableRebuild(m_OwningEntity, true, false, false, eQuickBuildFailReason::NOT_GIVEN, 0.0f, user->GetObjectID());
|
||||
|
||||
m_State = eRebuildState::BUILDING;
|
||||
m_StateDirty = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
auto* movingPlatform = m_Parent->GetComponent<MovingPlatformComponent>();
|
||||
auto* movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
|
||||
if (movingPlatform != nullptr) {
|
||||
movingPlatform->OnRebuildInitilized();
|
||||
}
|
||||
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnRebuildStart(m_Parent, user);
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnRebuildStart(m_OwningEntity, user);
|
||||
}
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent))
|
||||
script->OnRebuildNotifyState(m_Parent, m_State);
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_OwningEntity))
|
||||
script->OnRebuildNotifyState(m_OwningEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks)
|
||||
cb(m_State);
|
||||
}
|
||||
@ -445,10 +445,10 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(user);
|
||||
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::COMPLETED, user->GetObjectID());
|
||||
GameMessages::SendPlayFXEffect(m_Parent, 507, u"create", "BrickFadeUpVisCompleteEffect", LWOOBJID_EMPTY, 0.4f, 1.0f, true);
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, false, true, eQuickBuildFailReason::NOT_GIVEN, m_ResetTime, user->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
GameMessages::SendRebuildNotifyState(m_OwningEntity, m_State, eRebuildState::COMPLETED, user->GetObjectID());
|
||||
GameMessages::SendPlayFXEffect(m_OwningEntity, 507, u"create", "BrickFadeUpVisCompleteEffect", LWOOBJID_EMPTY, 0.4f, 1.0f, true);
|
||||
GameMessages::SendEnableRebuild(m_OwningEntity, false, false, true, eQuickBuildFailReason::NOT_GIVEN, m_ResetTime, user->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, m_OwningEntity->GetObjectID());
|
||||
|
||||
|
||||
m_State = eRebuildState::COMPLETED;
|
||||
@ -456,7 +456,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
m_Timer = 0.0f;
|
||||
m_DrainedImagination = 0;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
// Removes extra item requirements, isn't live accurate.
|
||||
// In live, all items were removed at the start of the quickbuild, then returned if it was cancelled.
|
||||
@ -468,7 +468,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
DespawnActivator();
|
||||
|
||||
// Set owner override so that entities smashed by this quickbuild will result in the builder getting rewards.
|
||||
m_Parent->SetOwnerOverride(user->GetObjectID());
|
||||
m_OwningEntity->SetOwnerOverride(user->GetObjectID());
|
||||
|
||||
auto* builder = GetBuilder();
|
||||
|
||||
@ -486,13 +486,13 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
auto* missionComponent = builder->GetComponent<MissionComponent>();
|
||||
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
|
||||
}
|
||||
LootGenerator::Instance().DropActivityLoot(builder, m_Parent, m_ActivityId, 1);
|
||||
LootGenerator::Instance().DropActivityLoot(builder, m_OwningEntity, m_ActivityId, 1);
|
||||
}
|
||||
|
||||
// Notify scripts
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnRebuildComplete(m_Parent, user);
|
||||
script->OnRebuildNotifyState(m_Parent, m_State);
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnRebuildComplete(m_OwningEntity, user);
|
||||
script->OnRebuildNotifyState(m_OwningEntity, m_State);
|
||||
}
|
||||
|
||||
// Notify subscribers
|
||||
@ -501,9 +501,9 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
for (const auto& callback : m_RebuildCompleteCallbacks)
|
||||
callback(user);
|
||||
|
||||
m_Parent->TriggerEvent(eTriggerEventType::REBUILD_COMPLETE, user);
|
||||
m_OwningEntity->TriggerEvent(eTriggerEventType::REBUILD_COMPLETE, user);
|
||||
|
||||
auto* movingPlatform = m_Parent->GetComponent<MovingPlatformComponent>();
|
||||
auto* movingPlatform = m_OwningEntity->GetComponent<MovingPlatformComponent>();
|
||||
if (movingPlatform != nullptr) {
|
||||
movingPlatform->OnCompleteRebuild();
|
||||
}
|
||||
@ -512,7 +512,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
||||
auto* character = user->GetCharacter();
|
||||
|
||||
if (character != nullptr) {
|
||||
const auto flagNumber = m_Parent->GetVar<int32_t>(u"quickbuild_single_build_player_flag");
|
||||
const auto flagNumber = m_OwningEntity->GetVar<int32_t>(u"quickbuild_single_build_player_flag");
|
||||
|
||||
if (flagNumber != 0) {
|
||||
character->SetPlayerFlag(flagNumber, true);
|
||||
@ -525,14 +525,14 @@ void RebuildComponent::ResetRebuild(bool failed) {
|
||||
Entity* builder = GetBuilder();
|
||||
|
||||
if (m_State == eRebuildState::BUILDING && builder) {
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, false, failed, eQuickBuildFailReason::NOT_GIVEN, m_ResetTime, builder->GetObjectID());
|
||||
GameMessages::SendEnableRebuild(m_OwningEntity, false, false, failed, eQuickBuildFailReason::NOT_GIVEN, m_ResetTime, builder->GetObjectID());
|
||||
|
||||
if (failed) {
|
||||
RenderComponent::PlayAnimation(builder, u"rebuild-fail");
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::RESETTING, LWOOBJID_EMPTY);
|
||||
GameMessages::SendRebuildNotifyState(m_OwningEntity, m_State, eRebuildState::RESETTING, LWOOBJID_EMPTY);
|
||||
|
||||
m_State = eRebuildState::RESETTING;
|
||||
m_StateDirty = true;
|
||||
@ -541,15 +541,15 @@ void RebuildComponent::ResetRebuild(bool failed) {
|
||||
m_ShowResetEffect = false;
|
||||
m_DrainedImagination = 0;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent))
|
||||
script->OnRebuildNotifyState(m_Parent, m_State);
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_OwningEntity))
|
||||
script->OnRebuildNotifyState(m_OwningEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks)
|
||||
cb(m_State);
|
||||
|
||||
m_Parent->ScheduleKillAfterUpdate();
|
||||
m_OwningEntity->ScheduleKillAfterUpdate();
|
||||
|
||||
if (m_Activator) {
|
||||
m_Activator->ScheduleKillAfterUpdate();
|
||||
@ -564,24 +564,24 @@ void RebuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason failR
|
||||
const auto entityID = entity != nullptr ? entity->GetObjectID() : LWOOBJID_EMPTY;
|
||||
|
||||
// Notify the client that a state has changed
|
||||
GameMessages::SendRebuildNotifyState(m_Parent, m_State, eRebuildState::INCOMPLETE, entityID);
|
||||
GameMessages::SendEnableRebuild(m_Parent, false, true, false, failReason, m_Timer, entityID);
|
||||
GameMessages::SendRebuildNotifyState(m_OwningEntity, m_State, eRebuildState::INCOMPLETE, entityID);
|
||||
GameMessages::SendEnableRebuild(m_OwningEntity, false, true, false, failReason, m_Timer, entityID);
|
||||
|
||||
// Now terminate any interaction with the rebuild
|
||||
GameMessages::SendTerminateInteraction(entityID, eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(m_Parent->GetObjectID(), eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(entityID, eTerminateType::FROM_INTERACTION, m_OwningEntity->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(m_OwningEntity->GetObjectID(), eTerminateType::FROM_INTERACTION, m_OwningEntity->GetObjectID());
|
||||
|
||||
// Now update the component itself
|
||||
m_State = eRebuildState::INCOMPLETE;
|
||||
m_StateDirty = true;
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent))
|
||||
script->OnRebuildNotifyState(m_Parent, m_State);
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_OwningEntity))
|
||||
script->OnRebuildNotifyState(m_OwningEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks)
|
||||
cb(m_State);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
if (entity == nullptr) {
|
||||
|
@ -141,7 +141,7 @@ void RenderComponent::Update(const float deltaTime) {
|
||||
void RenderComponent::PlayEffect(const int32_t effectId, const std::u16string& effectType, const std::string& name, const LWOOBJID secondary, const float priority, const float scale, const bool serialize) {
|
||||
RemoveEffect(name);
|
||||
|
||||
GameMessages::SendPlayFXEffect(m_Parent, effectId, effectType, name, secondary, priority, scale, serialize);
|
||||
GameMessages::SendPlayFXEffect(m_OwningEntity, effectId, effectType, name, secondary, priority, scale, serialize);
|
||||
|
||||
auto* effect = AddEffect(effectId, name, effectType);
|
||||
|
||||
@ -180,7 +180,7 @@ void RenderComponent::PlayEffect(const int32_t effectId, const std::u16string& e
|
||||
}
|
||||
|
||||
void RenderComponent::StopEffect(const std::string& name, const bool killImmediate) {
|
||||
GameMessages::SendStopFXEffect(m_Parent, killImmediate, name);
|
||||
GameMessages::SendStopFXEffect(m_OwningEntity, killImmediate, name);
|
||||
|
||||
RemoveEffect(name);
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "Entity.h"
|
||||
|
||||
RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* parent) : Component(parent) {
|
||||
m_Position = m_Parent->GetDefaultPosition();
|
||||
m_Rotation = m_Parent->GetDefaultRotation();
|
||||
m_Position = m_OwningEntity->GetDefaultPosition();
|
||||
m_Rotation = m_OwningEntity->GetDefaultRotation();
|
||||
m_IsDirty = true;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "CharacterComponent.h"
|
||||
|
||||
RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(parent) {
|
||||
m_Parent = parent;
|
||||
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_Parent->GetVar<std::u16string>(u"MultiZoneIDs"));
|
||||
m_OwningEntity = parent;
|
||||
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_OwningEntity->GetVar<std::u16string>(u"MultiZoneIDs"));
|
||||
std::stringstream ss(zoneString);
|
||||
for (int i; ss >> i;) {
|
||||
m_LUPWorlds.push_back(i);
|
||||
@ -21,11 +21,11 @@ void RocketLaunchLupComponent::OnUse(Entity* originator) {
|
||||
if (!rocket) return;
|
||||
|
||||
// the LUP world menu is just the property menu, the client knows how to handle it
|
||||
GameMessages::SendPropertyEntranceBegin(m_Parent->GetObjectID(), m_Parent->GetSystemAddress());
|
||||
GameMessages::SendPropertyEntranceBegin(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress());
|
||||
}
|
||||
|
||||
void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index) {
|
||||
auto* rocketLaunchpadControlComponent = m_Parent->GetComponent<RocketLaunchpadControlComponent>();
|
||||
auto* rocketLaunchpadControlComponent = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
|
||||
if (!rocketLaunchpadControlComponent) return;
|
||||
|
||||
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);
|
||||
|
@ -77,7 +77,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
|
||||
|
||||
SetSelectedMapId(originator->GetObjectID(), zone);
|
||||
|
||||
GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
|
||||
GameMessages::SendFireEventClientSide(m_OwningEntity->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
|
||||
|
||||
GameMessages::SendChangeObjectWorldState(rocket->GetId(), eObjectWorldState::ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
@ -89,12 +89,12 @@ void RocketLaunchpadControlComponent::OnUse(Entity* originator) {
|
||||
// instead we let their OnUse handlers do their things
|
||||
// which components of an Object have their OnUse called when using them
|
||||
// so we don't need to call it here
|
||||
auto* propertyEntrance = m_Parent->GetComponent<PropertyEntranceComponent>();
|
||||
auto* propertyEntrance = m_OwningEntity->GetComponent<PropertyEntranceComponent>();
|
||||
if (propertyEntrance) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* rocketLaunchLUP = m_Parent->GetComponent<RocketLaunchLupComponent>();
|
||||
auto* rocketLaunchLUP = m_OwningEntity->GetComponent<RocketLaunchLupComponent>();
|
||||
if (rocketLaunchLUP) {
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
|
||||
}
|
||||
}
|
||||
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* destroyableComponent = m_OwningEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent) {
|
||||
// check for LMIs and set the loot LMIs
|
||||
@ -137,11 +137,11 @@ void ScriptedActivityComponent::PlayerJoin(Entity* player) {
|
||||
instance->AddParticipant(player);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void ScriptedActivityComponent::PlayerJoinLobby(Entity* player) {
|
||||
if (!m_Parent->HasComponent(eReplicaComponentType::QUICK_BUILD))
|
||||
if (!m_OwningEntity->HasComponent(eReplicaComponentType::QUICK_BUILD))
|
||||
GameMessages::SendMatchResponse(player, player->GetSystemAddress(), 0); // tell the client they joined a lobby
|
||||
LobbyPlayer* newLobbyPlayer = new LobbyPlayer();
|
||||
newLobbyPlayer->entityID = player->GetObjectID();
|
||||
@ -304,7 +304,7 @@ bool ScriptedActivityComponent::HasLobby() const {
|
||||
bool ScriptedActivityComponent::IsValidActivity(Entity* player) {
|
||||
// Makes it so that scripted activities with an unimplemented map cannot be joined
|
||||
/*if (player->GetGMLevel() < eGameMasterLevel::DEVELOPER && (m_ActivityInfo.instanceMapID == 1302 || m_ActivityInfo.instanceMapID == 1301)) {
|
||||
if (m_Parent->GetLOT() == 4860) {
|
||||
if (m_OwningEntity->GetLOT() == 4860) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
missionComponent->CompleteMission(229);
|
||||
}
|
||||
@ -390,7 +390,7 @@ void ScriptedActivityComponent::PlayerReady(Entity* player, bool bReady) {
|
||||
}
|
||||
|
||||
ActivityInstance* ScriptedActivityComponent::NewInstance() {
|
||||
auto* instance = new ActivityInstance(m_Parent, m_ActivityInfo);
|
||||
auto* instance = new ActivityInstance(m_OwningEntity, m_ActivityInfo);
|
||||
m_Instances.push_back(instance);
|
||||
return instance;
|
||||
}
|
||||
@ -445,7 +445,7 @@ void ScriptedActivityComponent::RemoveActivityPlayerData(LWOOBJID playerID) {
|
||||
m_ActivityPlayers[i] = nullptr;
|
||||
|
||||
m_ActivityPlayers.erase(m_ActivityPlayers.begin() + i);
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -458,7 +458,7 @@ ActivityPlayer* ScriptedActivityComponent::AddActivityPlayerData(LWOOBJID player
|
||||
return data;
|
||||
|
||||
m_ActivityPlayers.push_back(new ActivityPlayer{ playerID, {} });
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
return GetActivityPlayerData(playerID);
|
||||
}
|
||||
@ -480,7 +480,7 @@ void ScriptedActivityComponent::SetActivityValue(LWOOBJID playerID, uint32_t ind
|
||||
data->values[std::min(index, (uint32_t)9)] = value;
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void ScriptedActivityComponent::PlayerRemove(LWOOBJID playerID) {
|
||||
@ -576,7 +576,7 @@ void ActivityInstance::RewardParticipant(Entity* participant) {
|
||||
maxCoins = currencyTable[0].maxvalue;
|
||||
}
|
||||
|
||||
LootGenerator::Instance().DropLoot(participant, m_Parent, activityRewards[0].LootMatrixIndex, minCoins, maxCoins);
|
||||
LootGenerator::Instance().DropLoot(participant, m_OwningEntity, activityRewards[0].LootMatrixIndex, minCoins, maxCoins);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
class ActivityInstance {
|
||||
public:
|
||||
ActivityInstance(Entity* parent, CDActivities activityInfo) { m_Parent = parent; m_ActivityInfo = activityInfo; };
|
||||
ActivityInstance(Entity* parent, CDActivities activityInfo) { m_OwningEntity = parent; m_ActivityInfo = activityInfo; };
|
||||
//~ActivityInstance();
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ private:
|
||||
/**
|
||||
* The entity that owns this activity (the entity that has the ScriptedActivityComponent)
|
||||
*/
|
||||
Entity* m_Parent;
|
||||
Entity* m_OwningEntity;
|
||||
|
||||
/**
|
||||
* All the participants of this activity
|
||||
|
@ -14,7 +14,7 @@ void ShootingGalleryComponent::SetStaticParams(const StaticShootingGalleryParams
|
||||
void ShootingGalleryComponent::SetDynamicParams(const DynamicShootingGalleryParams& params) {
|
||||
m_DynamicParams = params;
|
||||
m_Dirty = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const {
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include "Entity.h"
|
||||
|
||||
SimplePhysicsComponent::SimplePhysicsComponent(uint32_t componentID, Entity* parent) : Component(parent) {
|
||||
m_Position = m_Parent->GetDefaultPosition();
|
||||
m_Rotation = m_Parent->GetDefaultRotation();
|
||||
m_Position = m_OwningEntity->GetDefaultPosition();
|
||||
m_Rotation = m_OwningEntity->GetDefaultRotation();
|
||||
m_IsDirty = true;
|
||||
|
||||
const auto& climbable_type = m_Parent->GetVar<std::u16string>(u"climbable");
|
||||
const auto& climbable_type = m_OwningEntity->GetVar<std::u16string>(u"climbable");
|
||||
if (climbable_type == u"wall") {
|
||||
SetClimbableType(eClimbableType::CLIMBABLE_TYPE_WALL);
|
||||
} else if (climbable_type == u"ladder") {
|
||||
|
@ -32,9 +32,9 @@ ProjectileSyncEntry::ProjectileSyncEntry() {
|
||||
std::unordered_map<uint32_t, uint32_t> SkillComponent::m_skillBehaviorCache = {};
|
||||
|
||||
bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t skillUid, RakNet::BitStream* bitStream, const LWOOBJID target, uint32_t skillID) {
|
||||
auto* context = new BehaviorContext(this->m_Parent->GetObjectID());
|
||||
auto* context = new BehaviorContext(this->m_OwningEntity->GetObjectID());
|
||||
|
||||
context->caster = m_Parent->GetObjectID();
|
||||
context->caster = m_OwningEntity->GetObjectID();
|
||||
|
||||
context->skillID = skillID;
|
||||
|
||||
@ -130,11 +130,11 @@ void SkillComponent::RegisterPlayerProjectile(const LWOOBJID projectileId, Behav
|
||||
}
|
||||
|
||||
void SkillComponent::Update(const float deltaTime) {
|
||||
if (!m_Parent->HasComponent(eReplicaComponentType::BASE_COMBAT_AI) && m_Parent->GetLOT() != 1) {
|
||||
if (!m_OwningEntity->HasComponent(eReplicaComponentType::BASE_COMBAT_AI) && m_OwningEntity->GetLOT() != 1) {
|
||||
CalculateUpdate(deltaTime);
|
||||
}
|
||||
|
||||
if (m_Parent->IsPlayer()) {
|
||||
if (m_OwningEntity->IsPlayer()) {
|
||||
for (const auto& pair : this->m_managedBehaviors) pair.second->UpdatePlayerSyncs(deltaTime);
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ void SkillComponent::Reset() {
|
||||
|
||||
void SkillComponent::Interrupt() {
|
||||
// TODO: need to check immunities on the destroyable component, but they aren't implemented
|
||||
auto* combat = m_Parent->GetComponent<BaseCombatAIComponent>();
|
||||
auto* combat = m_OwningEntity->GetComponent<BaseCombatAIComponent>();
|
||||
if (combat != nullptr && combat->GetStunImmune()) return;
|
||||
|
||||
for (const auto& behavior : this->m_managedBehaviors) {
|
||||
@ -201,7 +201,7 @@ void SkillComponent::Interrupt() {
|
||||
behaviorEndEntry.behavior->End(behavior.second, behaviorEndEntry.branchContext, behaviorEndEntry.second);
|
||||
}
|
||||
behavior.second->endEntries.clear();
|
||||
if (m_Parent->IsPlayer()) continue;
|
||||
if (m_OwningEntity->IsPlayer()) continue;
|
||||
behavior.second->Interrupt();
|
||||
}
|
||||
|
||||
@ -256,9 +256,9 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
|
||||
auto* behavior = Behavior::CreateBehavior(behaviorId);
|
||||
|
||||
auto* context = new BehaviorContext(originatorOverride != LWOOBJID_EMPTY ? originatorOverride : this->m_Parent->GetObjectID(), true);
|
||||
auto* context = new BehaviorContext(originatorOverride != LWOOBJID_EMPTY ? originatorOverride : this->m_OwningEntity->GetObjectID(), true);
|
||||
|
||||
context->caster = m_Parent->GetObjectID();
|
||||
context->caster = m_OwningEntity->GetObjectID();
|
||||
|
||||
context->skillID = skillId;
|
||||
|
||||
@ -268,8 +268,8 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
|
||||
behavior->Calculate(context, bitStream, { target, 0 });
|
||||
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
script->OnSkillCast(m_Parent, skillId);
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_OwningEntity)) {
|
||||
script->OnSkillCast(m_OwningEntity, skillId);
|
||||
}
|
||||
|
||||
if (!context->foundTarget) {
|
||||
@ -305,7 +305,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
RakNet::BitStream message;
|
||||
|
||||
PacketUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
message.Write(this->m_Parent->GetObjectID());
|
||||
message.Write(this->m_OwningEntity->GetObjectID());
|
||||
start.Serialize(&message);
|
||||
|
||||
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||
@ -431,14 +431,14 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
||||
DoClientProjectileImpact projectileImpact;
|
||||
|
||||
projectileImpact.sBitStream.assign((char*)bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
|
||||
projectileImpact.i64OwnerID = this->m_Parent->GetObjectID();
|
||||
projectileImpact.i64OwnerID = this->m_OwningEntity->GetObjectID();
|
||||
projectileImpact.i64OrgID = entry.id;
|
||||
projectileImpact.i64TargetID = entry.branchContext.target;
|
||||
|
||||
RakNet::BitStream message;
|
||||
|
||||
PacketUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
message.Write(this->m_Parent->GetObjectID());
|
||||
message.Write(this->m_OwningEntity->GetObjectID());
|
||||
projectileImpact.Serialize(&message);
|
||||
|
||||
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||
|
@ -76,7 +76,7 @@ void SoundTriggerComponent::ActivateMusicCue(const std::string& name) {
|
||||
-1.0f
|
||||
});
|
||||
dirty = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +88,6 @@ void SoundTriggerComponent::DeactivateMusicCue(const std::string& name) {
|
||||
if (musicCue != this->musicCues.end()) {
|
||||
this->musicCues.erase(musicCue);
|
||||
dirty = true;
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ std::vector<SwitchComponent*> SwitchComponent::petSwitches;
|
||||
SwitchComponent::SwitchComponent(Entity* parent) : Component(parent) {
|
||||
m_Active = false;
|
||||
|
||||
m_ResetTime = m_Parent->GetVarAs<int32_t>(u"switch_reset_time");
|
||||
m_ResetTime = m_OwningEntity->GetVarAs<int32_t>(u"switch_reset_time");
|
||||
|
||||
m_Rebuild = m_Parent->GetComponent<RebuildComponent>();
|
||||
m_Rebuild = m_OwningEntity->GetComponent<RebuildComponent>();
|
||||
}
|
||||
|
||||
SwitchComponent::~SwitchComponent() {
|
||||
@ -43,10 +43,10 @@ void SwitchComponent::EntityEnter(Entity* entity) {
|
||||
if (m_Rebuild->GetState() != eRebuildState::COMPLETED) return;
|
||||
}
|
||||
m_Active = true;
|
||||
if (!m_Parent) return;
|
||||
m_Parent->TriggerEvent(eTriggerEventType::ACTIVATED, entity);
|
||||
if (!m_OwningEntity) return;
|
||||
m_OwningEntity->TriggerEvent(eTriggerEventType::ACTIVATED, entity);
|
||||
|
||||
const auto grpName = m_Parent->GetVarAsString(u"grp_name");
|
||||
const auto grpName = m_OwningEntity->GetVarAsString(u"grp_name");
|
||||
|
||||
if (!grpName.empty()) {
|
||||
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(grpName);
|
||||
@ -59,11 +59,11 @@ void SwitchComponent::EntityEnter(Entity* entity) {
|
||||
m_Timer = m_ResetTime;
|
||||
|
||||
if (m_PetBouncer != nullptr) {
|
||||
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 2602, u"pettriggeractive", "BounceEffect", LWOOBJID_EMPTY, 1, 1, true);
|
||||
RenderComponent::PlayAnimation(m_Parent, u"engaged");
|
||||
GameMessages::SendPlayFXEffect(m_OwningEntity->GetObjectID(), 2602, u"pettriggeractive", "BounceEffect", LWOOBJID_EMPTY, 1, 1, true);
|
||||
RenderComponent::PlayAnimation(m_OwningEntity, u"engaged");
|
||||
m_PetBouncer->SetPetBouncerEnabled(true);
|
||||
} else {
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
}
|
||||
@ -79,10 +79,10 @@ void SwitchComponent::Update(float deltaTime) {
|
||||
|
||||
if (m_Timer <= 0.0f) {
|
||||
m_Active = false;
|
||||
if (!m_Parent) return;
|
||||
m_Parent->TriggerEvent(eTriggerEventType::DEACTIVATED, m_Parent);
|
||||
if (!m_OwningEntity) return;
|
||||
m_OwningEntity->TriggerEvent(eTriggerEventType::DEACTIVATED, m_OwningEntity);
|
||||
|
||||
const auto grpName = m_Parent->GetVarAsString(u"grp_name");
|
||||
const auto grpName = m_OwningEntity->GetVarAsString(u"grp_name");
|
||||
|
||||
if (!grpName.empty()) {
|
||||
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(grpName);
|
||||
@ -95,14 +95,14 @@ void SwitchComponent::Update(float deltaTime) {
|
||||
if (m_PetBouncer != nullptr) {
|
||||
m_PetBouncer->SetPetBouncerEnabled(false);
|
||||
} else {
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Entity* SwitchComponent::GetParentEntity() const {
|
||||
return m_Parent;
|
||||
return m_OwningEntity;
|
||||
}
|
||||
|
||||
SwitchComponent* SwitchComponent::GetClosestSwitch(NiPoint3 position) {
|
||||
@ -110,7 +110,7 @@ SwitchComponent* SwitchComponent::GetClosestSwitch(NiPoint3 position) {
|
||||
SwitchComponent* closest = nullptr;
|
||||
|
||||
for (SwitchComponent* petSwitch : petSwitches) {
|
||||
float distance = Vector3::DistanceSquared(petSwitch->m_Parent->GetPosition(), position);
|
||||
float distance = Vector3::DistanceSquared(petSwitch->m_OwningEntity->GetPosition(), position);
|
||||
|
||||
if (closest == nullptr || distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
TriggerComponent::TriggerComponent(Entity* parent, const std::string triggerInfo): Component(parent) {
|
||||
m_Parent = parent;
|
||||
m_OwningEntity = parent;
|
||||
m_Trigger = nullptr;
|
||||
|
||||
std::vector<std::string> tokens = GeneralUtils::SplitString(triggerInfo, ':');
|
||||
@ -116,7 +116,7 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
|
||||
HandleCastSkill(targetEntity, command->args);
|
||||
break;
|
||||
case eTriggerCommandType::DISPLAY_ZONE_SUMMARY:
|
||||
GameMessages::SendDisplayZoneSummary(targetEntity->GetObjectID(), targetEntity->GetSystemAddress(), false, command->args == "1", m_Parent->GetObjectID());
|
||||
GameMessages::SendDisplayZoneSummary(targetEntity->GetObjectID(), targetEntity->GetSystemAddress(), false, command->args == "1", m_OwningEntity->GetObjectID());
|
||||
break;
|
||||
case eTriggerCommandType::SET_PHYSICS_VOLUME_EFFECT:
|
||||
HandleSetPhysicsVolumeEffect(targetEntity, argArray);
|
||||
@ -164,7 +164,7 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
|
||||
std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* command, Entity* optionalTarget) {
|
||||
std::vector<Entity*> entities = {};
|
||||
|
||||
if (command->target == "self") entities.push_back(m_Parent);
|
||||
if (command->target == "self") entities.push_back(m_OwningEntity);
|
||||
else if (command->target == "zone") { /*TODO*/ }
|
||||
else if (command->target == "target" && optionalTarget) entities.push_back(optionalTarget);
|
||||
else if (command->target == "targetTeam" && optionalTarget) {
|
||||
@ -185,14 +185,14 @@ std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* comman
|
||||
|
||||
void TriggerComponent::HandleFireEvent(Entity* targetEntity, std::string args) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(targetEntity)) {
|
||||
script->OnFireEventServerSide(targetEntity, m_Parent, args, 0, 0, 0);
|
||||
script->OnFireEventServerSide(targetEntity, m_OwningEntity, args, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string args){
|
||||
uint32_t killType;
|
||||
GeneralUtils::TryParse<uint32_t>(args, killType);
|
||||
targetEntity->Smash(m_Parent->GetObjectID(), static_cast<eKillType>(killType));
|
||||
targetEntity->Smash(m_OwningEntity->GetObjectID(), static_cast<eKillType>(killType));
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
|
||||
@ -237,7 +237,7 @@ void TriggerComponent::HandleRotateObject(Entity* targetEntity, std::vector<std:
|
||||
void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::string> argArray){
|
||||
if (argArray.size() < 3) return;
|
||||
|
||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
|
||||
return;
|
||||
@ -249,12 +249,12 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
||||
GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), direction);
|
||||
phantomPhysicsComponent->SetDirection(direction);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
|
||||
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
|
||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
|
||||
return;
|
||||
@ -265,7 +265,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
|
||||
phantomPhysicsComponent->SetDirectionalMultiplier(forceMultiplier);
|
||||
|
||||
auto triggerPos = m_Parent->GetPosition();
|
||||
auto triggerPos = m_OwningEntity->GetPosition();
|
||||
auto targetPos = targetEntity->GetPosition();
|
||||
|
||||
// normalize the vectors to get the direction
|
||||
@ -274,7 +274,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
|
||||
NiPoint3 direction = delta / length;
|
||||
phantomPhysicsComponent->SetDirection(direction);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
|
||||
@ -284,11 +284,11 @@ void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::str
|
||||
}
|
||||
float time = 0.0;
|
||||
GeneralUtils::TryParse<float>(argArray.at(1), time);
|
||||
m_Parent->AddTimer(argArray.at(0), time);
|
||||
m_OwningEntity->AddTimer(argArray.at(0), time);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleCancelTimer(Entity* targetEntity, std::string args){
|
||||
m_Parent->CancelTimer(args);
|
||||
m_OwningEntity->CancelTimer(args);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandlePlayCinematic(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||
|
@ -103,7 +103,7 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
|
||||
|
||||
void VehiclePhysicsComponent::Update(float deltaTime) {
|
||||
if (m_SoftUpdate > 5) {
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
|
||||
|
||||
m_SoftUpdate = 0;
|
||||
} else {
|
||||
|
@ -24,8 +24,8 @@ void VendorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitial
|
||||
}
|
||||
|
||||
void VendorComponent::OnUse(Entity* originator) {
|
||||
GameMessages::SendVendorOpenWindow(m_Parent, originator->GetSystemAddress());
|
||||
GameMessages::SendVendorStatusUpdate(m_Parent, originator->GetSystemAddress());
|
||||
GameMessages::SendVendorOpenWindow(m_OwningEntity, originator->GetSystemAddress());
|
||||
GameMessages::SendVendorStatusUpdate(m_OwningEntity, originator->GetSystemAddress());
|
||||
}
|
||||
|
||||
float VendorComponent::GetBuyScalar() const {
|
||||
@ -50,12 +50,12 @@ std::map<LOT, int>& VendorComponent::GetInventory() {
|
||||
|
||||
bool VendorComponent::HasCraftingStation() {
|
||||
// As far as we know, only Umami has a crafting station
|
||||
return m_Parent->GetLOT() == 13800;
|
||||
return m_OwningEntity->GetLOT() == 13800;
|
||||
}
|
||||
|
||||
void VendorComponent::RefreshInventory(bool isCreation) {
|
||||
//Custom code for Max vanity NPC
|
||||
if (m_Parent->GetLOT() == 9749 && Game::server->GetZoneID() == 1201) {
|
||||
if (m_OwningEntity->GetLOT() == 9749 && Game::server->GetZoneID() == 1201) {
|
||||
if (!isCreation) return;
|
||||
m_Inventory.insert({ 11909, 0 }); //Top hat w frog
|
||||
m_Inventory.insert({ 7785, 0 }); //Flash bulb
|
||||
@ -97,7 +97,7 @@ void VendorComponent::RefreshInventory(bool isCreation) {
|
||||
}
|
||||
|
||||
//Because I want a vendor to sell these cameras
|
||||
if (m_Parent->GetLOT() == 13569) {
|
||||
if (m_OwningEntity->GetLOT() == 13569) {
|
||||
auto randomCamera = GeneralUtils::GenerateRandomNumber<int32_t>(0, 2);
|
||||
|
||||
switch (randomCamera) {
|
||||
@ -116,15 +116,15 @@ void VendorComponent::RefreshInventory(bool isCreation) {
|
||||
}
|
||||
|
||||
// Callback timer to refresh this inventory.
|
||||
m_Parent->AddCallbackTimer(m_RefreshTimeSeconds, [this]() {
|
||||
m_OwningEntity->AddCallbackTimer(m_RefreshTimeSeconds, [this]() {
|
||||
RefreshInventory();
|
||||
});
|
||||
GameMessages::SendVendorStatusUpdate(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendVendorStatusUpdate(m_OwningEntity, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
void VendorComponent::SetupConstants() {
|
||||
auto* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
int componentID = compRegistryTable->GetByIDAndType(m_Parent->GetLOT(), eReplicaComponentType::VENDOR);
|
||||
int componentID = compRegistryTable->GetByIDAndType(m_OwningEntity->GetLOT(), eReplicaComponentType::VENDOR);
|
||||
|
||||
auto* vendorComponentTable = CDClientManager::Instance().GetTable<CDVendorComponentTable>();
|
||||
std::vector<CDVendorComponent> vendorComps = vendorComponentTable->Query([=](CDVendorComponent entry) { return (entry.id == componentID); });
|
||||
|
@ -1986,7 +1986,7 @@ void GameMessages::SendOpenPropertyManagment(const LWOOBJID objectId, const Syst
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(PropertyManagementComponent::Instance()->GetParent()->GetObjectID());
|
||||
bitStream.Write(PropertyManagementComponent::Instance()->GetOwningEntity()->GetObjectID());
|
||||
bitStream.Write(eGameMessageType::OPEN_PROPERTY_MANAGEMENT);
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
||||
|
@ -76,7 +76,7 @@ void Inventory::SetSize(const uint32_t value) {
|
||||
|
||||
size = value;
|
||||
|
||||
GameMessages::SendSetInventorySize(component->GetParent(), type, static_cast<int>(size));
|
||||
GameMessages::SendSetInventorySize(component->GetOwningEntity(), type, static_cast<int>(size));
|
||||
}
|
||||
|
||||
int32_t Inventory::FindEmptySlot() {
|
||||
|
@ -92,7 +92,7 @@ Item::Item(
|
||||
|
||||
inventory->AddManagedItem(this);
|
||||
|
||||
auto* entity = inventory->GetComponent()->GetParent();
|
||||
auto* entity = inventory->GetComponent()->GetOwningEntity();
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, static_cast<int>(this->count), subKey, lootSourceType);
|
||||
|
||||
if (isModMoveAndEquip) {
|
||||
@ -100,7 +100,7 @@ Item::Item(
|
||||
|
||||
Game::logger->Log("Item", "Move and equipped (%i) from (%i)", this->lot, this->inventory->GetType());
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(inventory->GetComponent()->GetParent());
|
||||
EntityManager::Instance()->SerializeEntity(inventory->GetComponent()->GetOwningEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ Inventory* Item::GetInventory() const {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
LWOOBJID Item::GetParent() const {
|
||||
LWOOBJID Item::GetOwningEntity() const {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
auto* entity = inventory->GetComponent()->GetParent();
|
||||
auto* entity = inventory->GetComponent()->GetOwningEntity();
|
||||
|
||||
if (value > count) {
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
|
||||
@ -262,7 +262,7 @@ bool Item::Consume() {
|
||||
|
||||
Game::logger->LogDebug("Item", "Consumed LOT (%i) itemID (%llu). Success=(%d)", lot, id, success);
|
||||
|
||||
GameMessages::SendUseItemResult(inventory->GetComponent()->GetParent(), lot, success);
|
||||
GameMessages::SendUseItemResult(inventory->GetComponent()->GetOwningEntity(), lot, success);
|
||||
|
||||
if (success) {
|
||||
inventory->GetComponent()->RemoveItem(lot, 1);
|
||||
@ -284,7 +284,7 @@ void Item::UseNonEquip(Item* item) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* playerEntity = playerInventoryComponent->GetParent();
|
||||
auto* playerEntity = playerInventoryComponent->GetOwningEntity();
|
||||
if (!playerEntity) {
|
||||
Game::logger->LogDebug("Item", "no player entity attached to inventory? item id is %llu", this->GetId());
|
||||
return;
|
||||
@ -314,8 +314,8 @@ void Item::UseNonEquip(Item* item) {
|
||||
|
||||
auto success = !packages.empty();
|
||||
if (success) {
|
||||
if (this->GetPreconditionExpression()->Check(playerInventoryComponent->GetParent())) {
|
||||
auto* entityParent = playerInventoryComponent->GetParent();
|
||||
if (this->GetPreconditionExpression()->Check(playerInventoryComponent->GetOwningEntity())) {
|
||||
auto* entityParent = playerInventoryComponent->GetOwningEntity();
|
||||
// Roll the loot for all the packages then see if it all fits. If it fits, give it to the player, otherwise don't.
|
||||
std::unordered_map<LOT, int32_t> rolledLoot{};
|
||||
for (auto& pack : packages) {
|
||||
@ -331,15 +331,15 @@ void Item::UseNonEquip(Item* item) {
|
||||
}
|
||||
}
|
||||
if (playerInventoryComponent->HasSpaceForLoot(rolledLoot)) {
|
||||
LootGenerator::Instance().GiveLoot(playerInventoryComponent->GetParent(), rolledLoot, eLootSourceType::CONSUMPTION);
|
||||
LootGenerator::Instance().GiveLoot(playerInventoryComponent->GetOwningEntity(), rolledLoot, eLootSourceType::CONSUMPTION);
|
||||
item->SetCount(item->GetCount() - 1);
|
||||
} else {
|
||||
success = false;
|
||||
}
|
||||
} else {
|
||||
GameMessages::SendUseItemRequirementsResponse(
|
||||
playerInventoryComponent->GetParent()->GetObjectID(),
|
||||
playerInventoryComponent->GetParent()->GetSystemAddress(),
|
||||
playerInventoryComponent->GetOwningEntity()->GetObjectID(),
|
||||
playerInventoryComponent->GetOwningEntity()->GetSystemAddress(),
|
||||
eUseItemResponse::FailedPrecondition
|
||||
);
|
||||
success = false;
|
||||
@ -347,7 +347,7 @@ void Item::UseNonEquip(Item* item) {
|
||||
}
|
||||
}
|
||||
Game::logger->LogDebug("Item", "Player %llu %s used item %i", playerEntity->GetObjectID(), success ? "successfully" : "unsuccessfully", thisLot);
|
||||
GameMessages::SendUseItemResult(playerInventoryComponent->GetParent(), thisLot, success);
|
||||
GameMessages::SendUseItemResult(playerInventoryComponent->GetOwningEntity(), thisLot, success);
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ void Item::Disassemble(const eInventoryType inventoryType) {
|
||||
if (GetInventory()) {
|
||||
auto inventoryComponent = GetInventory()->GetComponent();
|
||||
if (inventoryComponent) {
|
||||
auto entity = inventoryComponent->GetParent();
|
||||
auto entity = inventoryComponent->GetOwningEntity();
|
||||
if (entity) entity->SetVar<std::string>(u"currentModifiedBuild", modStr);
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public:
|
||||
* Returns the parent of this item, e.g. for proxy items
|
||||
* @return the parent of this item
|
||||
*/
|
||||
LWOOBJID GetParent() const;
|
||||
LWOOBJID GetOwningEntity() const;
|
||||
|
||||
/**
|
||||
* Sets the subkey for this item, e.g. for pets
|
||||
|
@ -15,7 +15,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent) {
|
||||
this->m_ID = id;
|
||||
this->m_InventoryComponent = inventoryComponent;
|
||||
|
||||
this->m_PassiveAbilities = ItemSetPassiveAbility::FindAbilities(id, m_InventoryComponent->GetParent(), this);
|
||||
this->m_PassiveAbilities = ItemSetPassiveAbility::FindAbilities(id, m_InventoryComponent->GetOwningEntity(), this);
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT skillSetWith2, skillSetWith3, skillSetWith4, skillSetWith5, skillSetWith6, itemIDs FROM ItemSets WHERE setID = ?;");
|
||||
@ -125,8 +125,8 @@ void ItemSet::OnEquip(const LOT lot) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>();
|
||||
auto* missionComponent = m_InventoryComponent->GetParent()->GetComponent<MissionComponent>();
|
||||
auto* skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<SkillComponent>();
|
||||
auto* missionComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<MissionComponent>();
|
||||
|
||||
for (const auto skill : skillSet) {
|
||||
auto* skillTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
|
||||
@ -135,7 +135,7 @@ void ItemSet::OnEquip(const LOT lot) {
|
||||
|
||||
missionComponent->Progress(eMissionTaskType::USE_SKILL, skill);
|
||||
|
||||
skillComponent->HandleUnmanaged(behaviorId, m_InventoryComponent->GetParent()->GetObjectID());
|
||||
skillComponent->HandleUnmanaged(behaviorId, m_InventoryComponent->GetOwningEntity()->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,14 +158,14 @@ void ItemSet::OnUnEquip(const LOT lot) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>();
|
||||
const auto& skillComponent = m_InventoryComponent->GetOwningEntity()->GetComponent<SkillComponent>();
|
||||
|
||||
for (const auto skill : skillSet) {
|
||||
auto* skillTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
|
||||
|
||||
const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID;
|
||||
|
||||
skillComponent->HandleUnCast(behaviorId, m_InventoryComponent->GetParent()->GetObjectID());
|
||||
skillComponent->HandleUnCast(behaviorId, m_InventoryComponent->GetOwningEntity()->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ bool Mission::IsValidMission(const uint32_t missionId, CDMissions& info) {
|
||||
}
|
||||
|
||||
Entity* Mission::GetAssociate() const {
|
||||
return m_MissionComponent->GetParent();
|
||||
return m_MissionComponent->GetOwningEntity();
|
||||
}
|
||||
|
||||
User* Mission::GetUser() const {
|
||||
|
@ -47,11 +47,11 @@ void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelComponent* mode
|
||||
// args.InsertValue("behaviorID", behaviorIDString);
|
||||
|
||||
// AMFStringValue* objectIDAsString = new AMFStringValue();
|
||||
// objectIDAsString->SetValue(std::to_string(modelComponent->GetParent()->GetObjectID()));
|
||||
// objectIDAsString->SetValue(std::to_string(modelComponent->GetOwningEntity()->GetObjectID()));
|
||||
// args.InsertValue("objectID", objectIDAsString);
|
||||
|
||||
// GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorID", &args);
|
||||
// ControlBehaviors::SendBehaviorListToClient(modelComponent->GetParent(), sysAddr, modelOwner);
|
||||
// ControlBehaviors::SendBehaviorListToClient(modelComponent->GetOwningEntity(), sysAddr, modelOwner);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
@ -74,7 +74,7 @@ void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const Syste
|
||||
*/
|
||||
|
||||
behaviorsToSerialize.Insert("behaviors");
|
||||
behaviorsToSerialize.Insert("objectID", std::to_string(modelComponent->GetParent()->GetObjectID()));
|
||||
behaviorsToSerialize.Insert("objectID", std::to_string(modelComponent->GetOwningEntity()->GetObjectID()));
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorList", behaviorsToSerialize);
|
||||
}
|
||||
@ -197,7 +197,7 @@ void ControlBehaviors::SendBehaviorBlocksToClient(ModelComponent* modelComponent
|
||||
// uiArray->InsertValue("x", xPosition);
|
||||
|
||||
// thisStrip->InsertValue("ui", uiArray);
|
||||
// targetObjectID = modelComponent->GetParent()->GetObjectID();
|
||||
// targetObjectID = modelComponent->GetOwningEntity()->GetObjectID();
|
||||
// behaviorID = modelBehavior->GetBehaviorID();
|
||||
|
||||
// AMFArrayValue* stripSerialize = new AMFArrayValue();
|
||||
@ -276,7 +276,7 @@ void ControlBehaviors::MoveToInventory(ModelComponent* modelComponent, const Sys
|
||||
|
||||
MoveToInventoryMessage moveToInventoryMessage(arguments);
|
||||
|
||||
SendBehaviorListToClient(modelComponent->GetParent(), sysAddr, modelOwner);
|
||||
SendBehaviorListToClient(modelComponent->GetOwningEntity(), sysAddr, modelOwner);
|
||||
}
|
||||
|
||||
void ControlBehaviors::ProcessCommand(Entity* modelEntity, const SystemAddress& sysAddr, AMFArrayValue* arguments, std::string command, Entity* modelOwner) {
|
||||
|
@ -19,7 +19,7 @@ ScriptComponent::~ScriptComponent() {
|
||||
|
||||
void ScriptComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||
if (bIsInitialUpdate) {
|
||||
const auto& networkSettings = m_Parent->GetNetworkSettings();
|
||||
const auto& networkSettings = m_OwningEntity->GetNetworkSettings();
|
||||
auto hasNetworkSettings = !networkSettings.empty();
|
||||
outBitStream->Write(hasNetworkSettings);
|
||||
|
||||
@ -52,5 +52,5 @@ void ScriptComponent::SetScript(const std::string& scriptName) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
m_Script = CppScripts::GetScript(m_Parent, scriptName);
|
||||
m_Script = CppScripts::GetScript(m_OwningEntity, scriptName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user