mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-23 15:11:19 +00:00
Move to shared pointer
This commit is contained in:
@@ -24,7 +24,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
if (en->GetObjectID() == attacker->GetObjectID()) {
|
||||
if (Vector3::DistanceSquared(en->GetPosition(), self->GetPosition()) > 10 * 10) continue;
|
||||
|
||||
auto* destroyable = en->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = en->GetComponent<DestroyableComponent>();
|
||||
if (destroyable == nullptr) {
|
||||
continue;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
|
||||
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16);
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(147, 4721, LWOOBJID_EMPTY, true);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
auto achievementIDs = self->GetVar<std::u16string>(u"achieveID");
|
||||
|
||||
// Progress all scripted missions related to this asset
|
||||
auto* missionComponent = attacker->GetComponent<MissionComponent>();
|
||||
auto missionComponent = attacker->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
if (missionID != 0) {
|
||||
missionComponent->ForceProgressValue(missionID,
|
||||
@@ -70,7 +70,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
}
|
||||
|
||||
void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destuctableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
auto destuctableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destuctableComponent == nullptr) return;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "ePhysicsEffectType.h"
|
||||
|
||||
void ForceVolumeServer::OnStartup(Entity* self) {
|
||||
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
|
||||
auto phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
|
||||
|
||||
if (phantomPhysicsComponent == nullptr) return;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s
|
||||
|
||||
LootGenerator::Instance().DropActivityLoot(target, self, self->GetLOT(), 0);
|
||||
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
auto missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
for (const auto mission : achievementIDs)
|
||||
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
|
||||
|
||||
@@ -12,7 +12,7 @@ void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* cast
|
||||
if (healMission == 0)
|
||||
return;
|
||||
|
||||
auto* missionComponent = caster->GetComponent<MissionComponent>();
|
||||
auto missionComponent = caster->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == eMissionState::ACTIVE) {
|
||||
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ClearMaelstrom", 0, 0,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
void NjRailActivatorsServer::OnUse(Entity* self, Entity* user) {
|
||||
const auto flag = self->GetVar<int32_t>(u"RailFlagNum");
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
// Only allow use if this is not a quick build or the quick build is built
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
void NjRailPostServer::OnStartup(Entity* self) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr) {
|
||||
self->SetNetworkVar<bool>(NetworkNotActiveVariable, true);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
|
||||
|
||||
// If the player doesn't have the flag yet
|
||||
if (playerFlag != 0 && !player->GetPlayerFlag(playerFlag)) {
|
||||
auto* petComponent = pet->GetComponent<PetComponent>();
|
||||
auto petComponent = pet->GetComponent<PetComponent>();
|
||||
if (petComponent != nullptr) {
|
||||
// TODO: Pet state = 9 ??
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void PetDigServer::HandleBouncerDig(const Entity* self, const Entity* owner) {
|
||||
* \param owner the owner that just made a pet dig something up
|
||||
*/
|
||||
void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* chest) {
|
||||
auto* missionComponent = owner->GetComponent<MissionComponent>();
|
||||
auto missionComponent = owner->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
// Can You Dig It progress
|
||||
@@ -193,7 +193,7 @@ void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* che
|
||||
void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo digInfo) {
|
||||
// Some treasures require a mission to be active
|
||||
if (digInfo.requiredMission >= 0) {
|
||||
auto* missionComponent = owner->GetComponent<MissionComponent>();
|
||||
auto missionComponent = owner->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < eMissionState::ACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ void PropertyDevice::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (propertyOwnerID == std::to_string(LWOOBJID_EMPTY))
|
||||
return;
|
||||
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
auto missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
if (missionComponent->GetMissionState(m_PropertyMissionID) == eMissionState::ACTIVE) {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 641, u"create", "callhome");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
|
||||
// auto movingPlatform = self->GetComponent<MovingPlatformComponent>();
|
||||
// if (movingPlatform != nullptr) {
|
||||
// movingPlatform->StopPathing();
|
||||
// movingPlatform->SetNoAutoStart(true);
|
||||
@@ -14,9 +14,9 @@ void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void PropertyPlatform::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
|
||||
// auto movingPlatform = self->GetComponent<MovingPlatformComponent>();
|
||||
// if (movingPlatform != nullptr) {
|
||||
// movingPlatform->GotoWaypoint(1);
|
||||
// }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
|
||||
void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
auto* destroyable = self->GetComponent<DestroyableComponent>();
|
||||
auto destroyable = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable != nullptr) {
|
||||
destroyable->SetFaction(115);
|
||||
@@ -51,7 +51,7 @@ void QbEnemyStunner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
self->AddTimer("DieTime", 5.0f);
|
||||
} else if (timerName == "TickTime") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent != nullptr) {
|
||||
auto skillBehaviorMap = self->GetVar<std::map<uint32_t, uint32_t>>(u"skillBehaviorMap");
|
||||
|
||||
@@ -115,14 +115,14 @@ void QbSpawner::OnChildRemoved(Entity* self, Entity* child) {
|
||||
}
|
||||
|
||||
void QbSpawner::AggroTargetObject(Entity* self, Entity* enemy) {
|
||||
auto* baseCombatAIComponent = enemy->GetComponent<BaseCombatAIComponent>();
|
||||
auto baseCombatAIComponent = enemy->GetComponent<BaseCombatAIComponent>();
|
||||
if (!baseCombatAIComponent) return;
|
||||
|
||||
auto gateObjID = self->GetVar<LWOOBJID>(u"gateObj");
|
||||
if (gateObjID) {
|
||||
auto* gate = EntityManager::Instance()->GetEntity(gateObjID);
|
||||
if (gate) {
|
||||
auto* movementAIComponent = enemy->GetComponent<MovementAIComponent>();
|
||||
auto movementAIComponent = enemy->GetComponent<MovementAIComponent>();
|
||||
if (movementAIComponent) movementAIComponent->SetDestination(gate->GetPosition());
|
||||
baseCombatAIComponent->Taunt(gateObjID, 1000);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//2021-05-03 - max - added script, omitted some parts related to inheritance in lua which we don't need
|
||||
|
||||
void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
|
||||
auto* inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
|
||||
auto inv = user->GetComponent<InventoryComponent>();
|
||||
|
||||
//make sure the user has the required amount of infected bricks
|
||||
if (inv && inv->GetLotCount(6194) >= bricksToTake) {
|
||||
|
||||
@@ -17,7 +17,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target)
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
|
||||
auto missionComponent = target->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -9,7 +9,7 @@ void WishingWellServer::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void WishingWellServer::OnUse(Entity* self, Entity* user) {
|
||||
auto* scriptedActivity = self->GetComponent<ScriptedActivityComponent>();
|
||||
auto scriptedActivity = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (!scriptedActivity->TakeCost(user)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user