Fixed Misspelling of Tresure variable for petcomponent

This commit is contained in:
dinomking33 2024-06-17 22:37:55 -05:00
parent 9400ee1dc0
commit 40aa925a56
4 changed files with 27 additions and 27 deletions

View File

@ -88,7 +88,7 @@ PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Compone
m_Ability = ePetAbilityType::Invalid;
m_StartPosition = NiPoint3Constant::ZERO;
m_MovementAI = nullptr;
m_TresureTime = 0;
m_TreasureTime = 0;
std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar<std::u16string>(u"CheckPrecondition"));
@ -319,27 +319,27 @@ void PetComponent::Update(float deltaTime) {
return;
}
if (m_TresureTime > 0) {
auto* tresure = Game::entityManager->GetEntity(m_Interaction);
if (m_TreasureTime > 0) {
auto* treasure = Game::entityManager->GetEntity(m_Interaction);
if (tresure == nullptr) {
m_TresureTime = 0;
if (treasure == nullptr) {
m_TreasureTime = 0;
return;
}
m_TresureTime -= deltaTime;
m_TreasureTime -= deltaTime;
m_MovementAI->Stop();
if (m_TresureTime <= 0) {
if (m_TreasureTime <= 0) {
m_Parent->SetOwnerOverride(m_Owner);
tresure->Smash(m_Parent->GetObjectID());
treasure->Smash(m_Parent->GetObjectID());
m_Interaction = LWOOBJID_EMPTY;
m_TresureTime = 0;
m_TreasureTime = 0;
}
return;
@ -396,30 +396,30 @@ void PetComponent::Update(float deltaTime) {
// Determine if the "Lost Tags" mission has been completed and digging has been unlocked
const bool digUnlocked = missionComponent->GetMissionState(842) == eMissionState::COMPLETE;
Entity* closestTresure = PetDigServer::GetClosestTresure(position);
Entity* closestTreasure = PetDigServer::GetClosestTreasure(position);
if (closestTresure != nullptr && digUnlocked) {
if (closestTreasure != nullptr && digUnlocked) {
// Skeleton Dragon Pat special case for bone digging
if (closestTresure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
goto skipTresure;
if (closestTreasure->GetLOT() == 12192 && m_Parent->GetLOT() != 13067) {
goto skipTreasure;
}
NiPoint3 tresurePosition = closestTresure->GetPosition();
float distance = Vector3::DistanceSquared(position, tresurePosition);
NiPoint3 treasurePosition = closestTreasure->GetPosition();
float distance = Vector3::DistanceSquared(position, treasurePosition);
if (distance < 5 * 5) {
m_Interaction = closestTresure->GetObjectID();
m_Interaction = closestTreasure->GetObjectID();
Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 1, 202, true);
m_TresureTime = 2;
m_TreasureTime = 2;
} else if (distance < 10 * 10) {
haltDistance = 1;
destination = tresurePosition;
destination = treasurePosition;
}
}
skipTresure:
skipTreasure:
m_MovementAI->SetHaltDistance(haltDistance);

View File

@ -329,7 +329,7 @@ private:
* Timer that tracks how long a pet has been digging up some treasure, required to spawn the treasure contents
* on time
*/
float m_TresureTime;
float m_TreasureTime;
/**
* The position that this pet was spawned at

View File

@ -215,20 +215,20 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
Game::entityManager->ConstructEntity(spawnedPet);
}
Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
Entity* PetDigServer::GetClosestTreasure(NiPoint3 position) {
float closestDistance = 0;
Entity* closest = nullptr;
for (const auto tresureId : treasures) {
auto* tresure = Game::entityManager->GetEntity(tresureId);
for (const auto treasureId : treasures) {
auto* treasure = Game::entityManager->GetEntity(treasureId);
if (tresure == nullptr) continue;
if (treasure == nullptr) continue;
float distance = Vector3::DistanceSquared(tresure->GetPosition(), position);
float distance = Vector3::DistanceSquared(treasure->GetPosition(), position);
if (closest == nullptr || distance < closestDistance) {
closestDistance = distance;
closest = tresure;
closest = treasure;
}
}

View File

@ -17,7 +17,7 @@ public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;
static Entity* GetClosestTresure(NiPoint3 position);
static Entity* GetClosestTreasure(NiPoint3 position);
private:
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);