Move to shared pointer

This commit is contained in:
David Markowitz
2023-06-07 00:23:50 -07:00
parent ea9d0d8592
commit 9e9e4dc087
219 changed files with 743 additions and 748 deletions

View File

@@ -29,9 +29,9 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
//self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true }
//Get our components:
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(eReplicaComponentType::DESTROYABLE));
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
auto destroyable = self->GetComponent<DestroyableComponent>();
auto controllable = self->GetComponent<ControllablePhysicsComponent>();
auto combat = self->GetComponent<BaseCombatAIComponent>();
if (!destroyable || !controllable) return;
@@ -53,7 +53,7 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
if (dZoneManager::Instance()->GetZoneID().GetMapID() == instanceZoneID) {
auto* missionComponent = killer->GetComponent<MissionComponent>();
auto missionComponent = killer->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;
@@ -99,7 +99,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
EntityManager::Instance()->SerializeEntity(self);
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
auto baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
baseCombatAi->SetDisabled(true);
@@ -123,7 +123,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
//Cancel all remaining timers for say idle anims:
self->CancelAllTimers();
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
auto baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
baseCombatAi->SetDisabled(false);
@@ -314,7 +314,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
return;
}
auto* skillComponent = entity->GetComponent<SkillComponent>();
auto skillComponent = entity->GetComponent<SkillComponent>();
if (skillComponent == nullptr) {
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!");
@@ -347,7 +347,7 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) {
const auto target = attackTargetTable[0];
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
skillComponent->CalculateBehavior(1394, 32612, target, true);
@@ -381,7 +381,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
attackTargetTable.push_back(attackFocus);
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
skillComponent->CalculateBehavior(1480, 36652, attackFocus, true);
@@ -493,14 +493,14 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
auto landingTarget = self->GetI64(u"LandingTarget");
auto landingEntity = EntityManager::Instance()->GetEntity(landingTarget);
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {
skillComponent->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY);
}
if (landingEntity) {
auto* landingSkill = landingEntity->GetComponent<SkillComponent>();
auto landingSkill = landingEntity->GetComponent<SkillComponent>();
if (landingSkill != nullptr) {
landingSkill->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY, true);

View File

@@ -12,7 +12,7 @@
void AmDarklingDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0);
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (baseCombatAIComponent != nullptr) {
baseCombatAIComponent->SetStunImmune(true);
@@ -46,7 +46,7 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
}
}
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
if (destroyableComponent->GetArmor() > 0) return;
@@ -56,8 +56,8 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
if (weakpoint == 0) {
self->AddTimer("ReviveTimer", 12);
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (baseCombatAIComponent != nullptr) {
baseCombatAIComponent->SetDisabled(true);
@@ -127,8 +127,8 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1);
} else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (baseCombatAIComponent != nullptr) {
baseCombatAIComponent->SetDisabled(false);
baseCombatAIComponent->SetStunned(false);

View File

@@ -3,8 +3,8 @@
#include "SkillComponent.h"
void AmSkeletonEngineer::OnHit(Entity* self, Entity* attacker) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (destroyableComponent == nullptr || skillComponent == nullptr) {
return;

View File

@@ -10,7 +10,7 @@
void FvMaelstromDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0);
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (baseCombatAIComponent != nullptr) {
baseCombatAIComponent->SetStunImmune(true);
@@ -59,7 +59,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
}
}
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
if (destroyableComponent->GetArmor() > 0) return;
@@ -71,8 +71,8 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
self->AddTimer("ReviveTimer", 12);
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (baseCombatAIComponent != nullptr) {
baseCombatAIComponent->SetDisabled(true);
@@ -143,8 +143,8 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1.0f);
} else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
auto baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (baseCombatAIComponent != nullptr) {
baseCombatAIComponent->SetDisabled(false);

View File

@@ -31,11 +31,11 @@ void BaseEnemyApe::OnSkillCast(Entity* self, uint32_t skillID) {
}
void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
StunApe(self, true);
self->CancelTimer("spawnQBTime");
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent) {
skillComponent->Reset();
}
@@ -52,7 +52,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
// Revives the ape, giving it back some armor
const auto timesStunned = self->GetVar<uint32_t>(u"timesStunned");
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
}
@@ -104,7 +104,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
return;
}
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {
skillComponent->CalculateBehavior(1273, 29446, self->GetObjectID(), true, false, player->GetObjectID());
}
@@ -123,12 +123,12 @@ void BaseEnemyApe::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
}
void BaseEnemyApe::StunApe(Entity* self, bool stunState) {
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(stunState);
combatAIComponent->SetStunned(stunState);
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {
skillComponent->Interrupt();
}

View File

@@ -9,14 +9,14 @@
#include "eReplicaComponentType.h"
void BaseEnemyMech::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetFaction(4);
}
}
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
auto controlPhys = self->GetComponent<ControllablePhysicsComponent>();
if (!controlPhys) return;
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };

View File

@@ -2,7 +2,7 @@
#include "SkillComponent.h"
void EnemyNjBuff::OnStartup(Entity* self) {
auto* skillComponent = self->GetComponent<SkillComponent>();
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent == nullptr) {
return;

View File

@@ -15,7 +15,7 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
self->SetVar<bool>(u"bUsed", true);
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
auto scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
if (scriptedActivityComponent == nullptr) {
return;

View File

@@ -4,7 +4,7 @@
void AgSurvivalMech::OnStartup(Entity* self) {
BaseWavesGenericEnemy::OnStartup(self);
auto* destroyable = self->GetComponent<DestroyableComponent>();
auto destroyable = self->GetComponent<DestroyableComponent>();
if (destroyable != nullptr) {
destroyable->SetFaction(4);
}

View File

@@ -4,7 +4,7 @@
void AgSurvivalSpiderling::OnStartup(Entity* self) {
BaseWavesGenericEnemy::OnStartup(self);
auto* combatAI = self->GetComponent<BaseCombatAIComponent>();
auto combatAI = self->GetComponent<BaseCombatAIComponent>();
if (combatAI != nullptr) {
combatAI->SetStunImmune(true);
}

View File

@@ -11,7 +11,7 @@ void WaveBossApe::OnStartup(Entity* self) {
self->SetVar<float_t>(u"AnchorDamageDelayTime", 0.5f);
self->SetVar<float_t>(u"spawnQBTime", 5.0f);
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(true);
combatAIComponent->SetStunImmune(true);
@@ -30,7 +30,7 @@ void WaveBossApe::OnDie(Entity* self, Entity* killer) {
void WaveBossApe::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) {
if (args == "startAI") {
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(false);
combatAIComponent->SetStunImmune(false);

View File

@@ -5,7 +5,7 @@
void WaveBossHammerling::OnStartup(Entity* self) {
BaseWavesGenericEnemy::OnStartup(self);
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(true);
combatAIComponent->SetStunImmune(true);
@@ -17,7 +17,7 @@ void WaveBossHammerling::OnStartup(Entity* self) {
void WaveBossHammerling::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
if (args == "startAI") {
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(false);
}

View File

@@ -5,7 +5,7 @@
void WaveBossHorsemen::OnStartup(Entity* self) {
BaseWavesGenericEnemy::OnStartup(self);
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(true);
combatAIComponent->SetStunImmune(true);
@@ -18,7 +18,7 @@ void
WaveBossHorsemen::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) {
if (args == "startAI") {
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(false);
}

View File

@@ -5,7 +5,7 @@
void WaveBossSpiderling::OnStartup(Entity* self) {
BaseWavesGenericEnemy::OnStartup(self);
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(true);
combatAIComponent->SetStunImmune(true);
@@ -17,7 +17,7 @@ void WaveBossSpiderling::OnStartup(Entity* self) {
void WaveBossSpiderling::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
if (args == "startAI") {
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
if (combatAIComponent != nullptr) {
combatAIComponent->SetDisabled(false);
combatAIComponent->SetStunImmune(false);