mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-09 08:58:04 +00:00
Move to shared pointer
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "Character.h"
|
||||
|
||||
void AmBlueX::OnUse(Entity* self, Entity* user) {
|
||||
auto* skillComponent = user->GetComponent<SkillComponent>();
|
||||
auto skillComponent = user->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_SwordSkill, m_SwordBehavior, self->GetObjectID());
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string&
|
||||
self->AddCallbackTimer(m_BombTime, [this, self, fxObjectID, playerID]() {
|
||||
auto* fxObject = EntityManager::Instance()->GetEntity(fxObjectID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
return;
|
||||
|
@@ -60,7 +60,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
self->SetNetworkVar(u"BridgeLeaving", false);
|
||||
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
@@ -87,7 +87,7 @@ void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::strin
|
||||
}
|
||||
|
||||
void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
auto simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
|
@@ -10,14 +10,14 @@ void AmDropshipComputer::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
auto missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr) {
|
||||
return;
|
||||
@@ -70,7 +70,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr) {
|
||||
return;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
void AmScrollReaderServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
if (identifier == u"story_end") {
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
auto missionComponent = sender->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
|
@@ -15,7 +15,7 @@ void AmShieldGenerator::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (status == "ENTER" && name == "shield") {
|
||||
if (destroyableComponent->HasFaction(4)) {
|
||||
@@ -102,7 +102,7 @@ void AmShieldGenerator::StartShield(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
@@ -122,8 +122,8 @@ void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
auto baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
|
@@ -15,7 +15,7 @@ void AmShieldGeneratorQuickbuild::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (name == "shield") {
|
||||
if (!destroyableComponent->HasFaction(4) || entering->IsPlayer()) {
|
||||
@@ -122,7 +122,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
@@ -154,7 +154,7 @@ void AmShieldGeneratorQuickbuild::StartShield(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
@@ -174,14 +174,14 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
auto baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
|
@@ -14,7 +14,7 @@ void AmSkullkinDrill::OnStartup(Entity* self) {
|
||||
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std:
|
||||
return;
|
||||
}
|
||||
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
auto proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
|
||||
if (proximityMonitorComponent == nullptr || !proximityMonitorComponent->IsInProximity("spin_distance", caster->GetObjectID())) {
|
||||
return;
|
||||
@@ -82,7 +82,7 @@ void AmSkullkinDrill::TriggerDrill(Entity* self) {
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
@@ -223,7 +223,7 @@ void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string&
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || !attacker->IsPlayer()) {
|
||||
return;
|
||||
@@ -239,7 +239,7 @@ void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
|
||||
|
||||
// TODO: Missions
|
||||
if (activator != nullptr) {
|
||||
auto* missionComponent = activator->GetComponent<MissionComponent>();
|
||||
auto missionComponent = activator->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
for (const auto missionID : m_MissionsToUpdate) {
|
||||
@@ -279,7 +279,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
|
@@ -12,7 +12,7 @@ void AmSkullkinTower::OnStartup(Entity* self) {
|
||||
|
||||
// onPhysicsComponentReady
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent != nullptr) {
|
||||
movingPlatformComponent->StopPathing();
|
||||
@@ -82,7 +82,7 @@ void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child) {
|
||||
|
||||
child->AddDieCallback([this, selfID, child]() {
|
||||
auto* self = EntityManager::Instance()->GetEntity(selfID);
|
||||
auto* destroyableComponent = child->GetComponent<DestroyableComponent>();
|
||||
auto destroyableComponent = child->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || self == nullptr) {
|
||||
return;
|
||||
@@ -163,7 +163,7 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
continue;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void AmTeapotServer::OnUse(Entity* self, Entity* user) {
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
auto inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
if (!inventoryComponent) return;
|
||||
|
||||
auto* blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::ITEMS);
|
||||
|
@@ -6,7 +6,7 @@ void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, cons
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = caster->GetComponent<MissionComponent>();
|
||||
auto missionComponent = caster->GetComponent<MissionComponent>();
|
||||
|
||||
const auto missionIDsVariable = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"missions"));
|
||||
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
|
||||
|
Reference in New Issue
Block a user