mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-09 00:48:04 +00:00
Replace all auto with auto*
For components
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
void DamagingPets::OnStartup(Entity* self) {
|
||||
|
||||
// Make the pet hostile or non-hostile based on whether or not it is tamed
|
||||
const auto petComponent = self->GetComponent<PetComponent>();
|
||||
const auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent != nullptr && petComponent->GetOwner() == nullptr) {
|
||||
self->AddTimer("GoEvil", 0.5f);
|
||||
}
|
||||
@@ -19,9 +19,9 @@ void DamagingPets::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
// Makes it so that new players also see the effect
|
||||
self->AddCallbackTimer(2.5f, [self]() {
|
||||
if (self != nullptr) {
|
||||
const auto petComponent = self->GetComponent<PetComponent>();
|
||||
const auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent != nullptr && petComponent->GetOwner() == nullptr && self->GetVar<bool>(u"IsEvil")) {
|
||||
auto renderComponent = self->GetComponent<RenderComponent>();
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
auto counter = 1;
|
||||
for (const auto petEffect : GetPetInfo(self).effect) {
|
||||
@@ -58,7 +58,7 @@ void DamagingPets::OnSkillEventFired(Entity* self, Entity* caster, const std::st
|
||||
if (infoForPet.skill == message) {
|
||||
|
||||
// Only make pets tamable that aren't tamed yet
|
||||
const auto petComponent = self->GetComponent<PetComponent>();
|
||||
const auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent != nullptr && petComponent->GetOwner() == nullptr && self->GetVar<bool>(u"IsEvil")) {
|
||||
ClearEffects(self);
|
||||
self->AddTimer("GoEvil", 30.0f);
|
||||
@@ -74,7 +74,7 @@ void DamagingPets::OnTimerDone(Entity* self, std::string message) {
|
||||
}
|
||||
|
||||
void DamagingPets::MakeUntamable(Entity* self) {
|
||||
auto petComponent = self->GetComponent<PetComponent>();
|
||||
auto* petComponent = self->GetComponent<PetComponent>();
|
||||
|
||||
// If the pet is currently not being tamed, make it hostile
|
||||
if (petComponent != nullptr && petComponent->GetStatus() != 5) {
|
||||
@@ -82,19 +82,19 @@ void DamagingPets::MakeUntamable(Entity* self) {
|
||||
self->SetVar<bool>(u"IsEvil", true);
|
||||
petComponent->SetStatus(1);
|
||||
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(false);
|
||||
}
|
||||
|
||||
// Special faction that can attack the player but the player can't attack
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetFaction(114);
|
||||
destroyableComponent->SetHealth(5);
|
||||
}
|
||||
|
||||
auto renderComponent = self->GetComponent<RenderComponent>();
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
auto counter = 1;
|
||||
for (const auto petEffect : GetPetInfo(self).effect) {
|
||||
@@ -108,22 +108,22 @@ void DamagingPets::MakeUntamable(Entity* self) {
|
||||
void DamagingPets::ClearEffects(Entity* self) {
|
||||
self->SetVar<bool>(u"IsEvil", false);
|
||||
|
||||
auto petComponent = self->GetComponent<PetComponent>();
|
||||
auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent != nullptr) {
|
||||
petComponent->SetStatus(67108866);
|
||||
}
|
||||
|
||||
auto combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(true);
|
||||
}
|
||||
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetFaction(99);
|
||||
}
|
||||
|
||||
auto renderComponent = self->GetComponent<RenderComponent>();
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
auto counter = 1;
|
||||
for (const auto petEffect : GetPetInfo(self).effect) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "ePetTamingNotifyType.h"
|
||||
|
||||
void PetFromDigServer::OnStartup(Entity* self) {
|
||||
auto petComponent = self->GetComponent<PetComponent>();
|
||||
auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent == nullptr || petComponent->GetOwner() != nullptr)
|
||||
return;
|
||||
|
||||
@@ -21,7 +21,7 @@ void PetFromDigServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "killself") {
|
||||
|
||||
// Don't accidentally kill a pet that is already owned
|
||||
auto petComponent = self->GetComponent<PetComponent>();
|
||||
auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent == nullptr || petComponent->GetOwner() != nullptr)
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ void PetFromDigServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eP
|
||||
} else if (type == ePetTamingNotifyType::QUIT || type == ePetTamingNotifyType::FAILED) {
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
} else if (type == ePetTamingNotifyType::SUCCESS) {
|
||||
auto petComponent = self->GetComponent<PetComponent>();
|
||||
auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent == nullptr)
|
||||
return;
|
||||
// TODO: Remove custom group?
|
||||
|
@@ -9,7 +9,7 @@ void PetFromObjectServer::OnStartup(Entity* self) {
|
||||
|
||||
void PetFromObjectServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "killSelf") {
|
||||
const auto petComponent = self->GetComponent<PetComponent>();
|
||||
const auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent == nullptr || petComponent->GetOwner() != nullptr)
|
||||
return;
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
|
Reference in New Issue
Block a user