From b3762dac057312e973d5da08bab9a5ed4993816d Mon Sep 17 00:00:00 2001 From: jadebenn Date: Sat, 18 Nov 2023 20:11:28 -0600 Subject: [PATCH] added imagination cost to digs --- dGame/dComponents/PetComponent.h | 2 +- dScripts/02_server/Map/General/PetDigServer.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/PetComponent.h b/dGame/dComponents/PetComponent.h index 341e592b..60038cb7 100644 --- a/dGame/dComponents/PetComponent.h +++ b/dGame/dComponents/PetComponent.h @@ -372,7 +372,7 @@ private: /** * Boolean that sets if a pet is in an interaction */ - float m_InInteract; + bool m_InInteract; /** * The position that this pet was spawned at diff --git a/dScripts/02_server/Map/General/PetDigServer.cpp b/dScripts/02_server/Map/General/PetDigServer.cpp index 5e67368e..3aa62fce 100644 --- a/dScripts/02_server/Map/General/PetDigServer.cpp +++ b/dScripts/02_server/Map/General/PetDigServer.cpp @@ -1,5 +1,6 @@ #include "dZoneManager.h" #include "PetDigServer.h" +#include "DestroyableComponent.h" #include "MissionComponent.h" #include "EntityManager.h" #include "Character.h" @@ -107,8 +108,16 @@ void PetDigServer::OnUse(Entity* self, Entity* user) { auto* petComponent = PetComponent::GetActivePet(user->GetObjectID()); if (!petComponent) return; - if(petComponent->GetIsReadyToDig()) { + if(petComponent->GetIsReadyToDig()) { // TODO: Add handling of the "first time" dig message petComponent->SetTreasureTime(2.0f); + + auto* destroyableComponent = user->GetComponent(); + if (!destroyableComponent) return; + + auto imagination = destroyableComponent->GetImagination(); + imagination -= 1; // TODO: Get rid of this magic number + destroyableComponent->SetImagination(imagination); + Game::entityManager->SerializeEntity(user); } }