mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-25 00:38:08 +00:00
Move to shared pointer
This commit is contained in:
@@ -42,7 +42,7 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,7 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
@@ -40,7 +40,7 @@ void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchCont
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -14,7 +14,7 @@ void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
@@ -34,7 +34,7 @@ void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStr
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -11,7 +11,7 @@ void FallSpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
controllablePhysicsComponent->SetGravityScale(m_PercentSlowed);
|
||||
EntityManager::Instance()->SerializeEntity(target);
|
||||
@@ -39,7 +39,7 @@ void FallSpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext bran
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
controllablePhysicsComponent->SetGravityScale(1);
|
||||
EntityManager::Instance()->SerializeEntity(target);
|
||||
|
||||
@@ -44,7 +44,7 @@ void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStrea
|
||||
|
||||
auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster);
|
||||
if (casterEntity != nullptr) {
|
||||
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
|
||||
if (m_Forward == 1) {
|
||||
@@ -74,7 +74,7 @@ void ForceMovementBehavior::Load() {
|
||||
void ForceMovementBehavior::SyncCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
auto* casterEntity = EntityManager::Instance()->GetEntity(context->caster);
|
||||
if (casterEntity != nullptr) {
|
||||
auto* controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = casterEntity->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent != nullptr) {
|
||||
|
||||
controllablePhysicsComponent->SetPosition(controllablePhysicsComponent->GetPosition() + controllablePhysicsComponent->GetVelocity() * m_Duration);
|
||||
|
||||
@@ -16,7 +16,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
|
||||
|
||||
@@ -13,7 +13,7 @@ void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -17,7 +17,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetStatusImmunity(
|
||||
eStateChangeType::PUSH,
|
||||
@@ -33,7 +33,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
);
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) {
|
||||
controllablePhysicsComponent->SetStunImmunity(
|
||||
eStateChangeType::PUSH,
|
||||
@@ -63,7 +63,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetStatusImmunity(
|
||||
eStateChangeType::POP,
|
||||
@@ -79,7 +79,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra
|
||||
);
|
||||
}
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (controllablePhysicsComponent) {
|
||||
controllablePhysicsComponent->SetStunImmunity(
|
||||
eStateChangeType::POP,
|
||||
|
||||
@@ -46,7 +46,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
|
||||
if (target == nullptr) return;
|
||||
|
||||
auto* skillComponent = target->GetComponent<SkillComponent>();
|
||||
auto skillComponent = target->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
@@ -71,7 +71,7 @@ void InterruptBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
|
||||
|
||||
if (target == nullptr) return;
|
||||
|
||||
auto* skillComponent = target->GetComponent<SkillComponent>();
|
||||
auto skillComponent = target->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void KnockbackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (target != nullptr) {
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
blocked = destroyableComponent->IsKnockbackImmune();
|
||||
|
||||
@@ -24,7 +24,7 @@ void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
|
||||
if (entity == nullptr) return;
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", -context->originator);
|
||||
@@ -69,7 +69,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
auto skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", context->originator);
|
||||
|
||||
@@ -14,7 +14,7 @@ void PullToPointBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
return;
|
||||
}
|
||||
|
||||
auto* movement = target->GetComponent<MovementAIComponent>();
|
||||
auto movement = target->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (movement == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -9,7 +9,7 @@ void RemoveBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit
|
||||
auto* entity = EntityManager::Instance()->GetEntity(context->caster);
|
||||
if (!entity) return;
|
||||
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
if (!buffComponent) return;
|
||||
|
||||
buffComponent->RemoveBuff(m_BuffId, false, m_RemoveImmunity);
|
||||
|
||||
@@ -16,7 +16,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
|
||||
|
||||
@@ -53,7 +53,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
entity->SetOwnerOverride(context->originator);
|
||||
|
||||
// Unset the flag to reposition the player, this makes it harder to glitch out of the map
|
||||
auto* rebuildComponent = entity->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = entity->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent != nullptr) {
|
||||
rebuildComponent->SetRepositionPlayer(false);
|
||||
@@ -87,9 +87,9 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
auto destroyable = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable == nullptr) {
|
||||
if (!destroyable) {
|
||||
entity->Smash(context->originator);
|
||||
|
||||
return;
|
||||
|
||||
@@ -12,7 +12,7 @@ void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
|
||||
controllablePhysicsComponent->AddSpeedboost(m_RunSpeed);
|
||||
@@ -41,7 +41,7 @@ void SpeedBehavior::End(BehaviorContext* context, BehaviorBranchContext branch,
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!target) return;
|
||||
|
||||
auto* controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
auto controllablePhysicsComponent = target->GetComponent<ControllablePhysicsComponent>();
|
||||
if (!controllablePhysicsComponent) return;
|
||||
|
||||
controllablePhysicsComponent->RemoveSpeedboost(m_RunSpeed);
|
||||
|
||||
@@ -33,7 +33,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
* If our target is an enemy we can go ahead and stun it.
|
||||
*/
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto combatAiComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
@@ -56,7 +56,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
* See if we can stun ourselves
|
||||
*/
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto combatAiComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (target != nullptr) {
|
||||
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = target->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
blocked = destroyableComponent->IsKnockbackImmune();
|
||||
@@ -91,7 +91,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
||||
* If our target is an enemy we can go ahead and stun it.
|
||||
*/
|
||||
|
||||
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
||||
auto combatAiComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatAiComponent == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -22,7 +22,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr) {
|
||||
return;
|
||||
@@ -46,7 +46,7 @@ void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
state = entity != nullptr;
|
||||
|
||||
if (state && m_targetHasBuff != 0) {
|
||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||
auto buffComponent = entity->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr && !buffComponent->HasBuff(m_targetHasBuff)) {
|
||||
state = false;
|
||||
|
||||
@@ -82,7 +82,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
return;
|
||||
}
|
||||
|
||||
const auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
const auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if ((this->m_usePickedTarget || context->clientInitalized) && branch.target > 0) {
|
||||
const auto* target = EntityManager::Instance()->GetEntity(branch.target);
|
||||
@@ -101,7 +101,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
||||
return;
|
||||
}
|
||||
|
||||
auto* combatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatAi = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
const auto casterPosition = self->GetPosition();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
||||
return;
|
||||
}
|
||||
|
||||
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatComponent != nullptr) {
|
||||
combatComponent->Taunt(context->originator, m_threatToAdd);
|
||||
@@ -31,7 +31,7 @@ void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
|
||||
return;
|
||||
}
|
||||
|
||||
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
auto combatComponent = target->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (combatComponent != nullptr) {
|
||||
combatComponent->Taunt(context->originator, m_threatToAdd);
|
||||
|
||||
Reference in New Issue
Block a user