2022-07-05 04:48:56 +00:00
|
|
|
#include "VentureVisionBehavior.h"
|
|
|
|
#include "BehaviorBranchContext.h"
|
|
|
|
#include "CharacterComponent.h"
|
|
|
|
#include "BehaviorContext.h"
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2024-02-27 07:25:44 +00:00
|
|
|
void VentureVisionBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
2022-07-05 04:48:56 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto targetEntity = Game::entityManager->GetEntity(branch.target);
|
2022-07-05 04:48:56 +00:00
|
|
|
|
|
|
|
if (targetEntity) {
|
|
|
|
auto characterComponent = targetEntity->GetComponent<CharacterComponent>();
|
|
|
|
|
|
|
|
if (characterComponent) {
|
|
|
|
if (m_show_collectibles) characterComponent->AddVentureVisionEffect(m_ShowCollectibles);
|
|
|
|
if (m_show_minibosses) characterComponent->AddVentureVisionEffect(m_ShowMiniBosses);
|
|
|
|
if (m_show_pet_digs) characterComponent->AddVentureVisionEffect(m_ShowPetDigs);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (branch.duration > 0) context->RegisterTimerBehavior(this, branch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VentureVisionBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto targetEntity = Game::entityManager->GetEntity(branch.target);
|
2022-07-05 04:48:56 +00:00
|
|
|
|
|
|
|
if (targetEntity) {
|
|
|
|
auto characterComponent = targetEntity->GetComponent<CharacterComponent>();
|
|
|
|
|
|
|
|
if (characterComponent) {
|
|
|
|
if (m_show_collectibles) characterComponent->RemoveVentureVisionEffect(m_ShowCollectibles);
|
|
|
|
if (m_show_minibosses) characterComponent->RemoveVentureVisionEffect(m_ShowMiniBosses);
|
|
|
|
if (m_show_pet_digs) characterComponent->RemoveVentureVisionEffect(m_ShowPetDigs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VentureVisionBehavior::Timer(BehaviorContext* context, BehaviorBranchContext branch, LWOOBJID second) {
|
|
|
|
UnCast(context, branch);
|
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void VentureVisionBehavior::Load() {
|
2022-07-05 04:48:56 +00:00
|
|
|
this->m_show_pet_digs = GetBoolean("show_pet_digs");
|
|
|
|
|
|
|
|
this->m_show_minibosses = GetBoolean("show_minibosses");
|
|
|
|
|
|
|
|
this->m_show_collectibles = GetBoolean("show_collectibles");
|
|
|
|
}
|