From e81acb4c67765ba5c0cf48e4c3da85441cec17dc Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Wed, 4 May 2022 07:50:05 -0500 Subject: [PATCH] Client handles rocket being unequiped when closing the dialog and when launching --- dGame/dComponents/RocketLaunchLupComponent.cpp | 16 +++++----------- dGame/dComponents/RocketLaunchLupComponent.h | 2 -- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/dGame/dComponents/RocketLaunchLupComponent.cpp b/dGame/dComponents/RocketLaunchLupComponent.cpp index 5e5db538..7864e0e8 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.cpp +++ b/dGame/dComponents/RocketLaunchLupComponent.cpp @@ -18,11 +18,7 @@ RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(p results.finalize(); } -RocketLaunchLupComponent::~RocketLaunchLupComponent() { - if (!m_rocket) return; - // when we exit the ui we need to unequip the rocket - m_rocket->UnEquip(); -} +RocketLaunchLupComponent::~RocketLaunchLupComponent() {} void RocketLaunchLupComponent::OnUse(Entity* originator) { // the LUP world menu is just the property menu, the client knows how to handle it @@ -34,16 +30,14 @@ void RocketLaunchLupComponent::OnUse(Entity* originator) { auto* characterComponent = originator->GetComponent(); if (!inventoryComponent || !characterComponent) return; + Item* rocket = nullptr; + rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID()); + if (!rocket) return; - m_rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID()); - if (!m_rocket) return; - - m_rocket->Equip(true); + rocket->Equip(true); } void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index, const SystemAddress& sysAddr) { - if (m_rocket) m_rocket->UnEquip(); - // Add one to index because the actual LUP worlds start at index 1. index++; diff --git a/dGame/dComponents/RocketLaunchLupComponent.h b/dGame/dComponents/RocketLaunchLupComponent.h index 621a80cf..8b21735a 100644 --- a/dGame/dComponents/RocketLaunchLupComponent.h +++ b/dGame/dComponents/RocketLaunchLupComponent.h @@ -3,7 +3,6 @@ #include "Entity.h" #include "GameMessages.h" #include "Component.h" -#include "Item.h" /** * Component that handles the LUP/WBL rocket launchpad that can be interacted with to travel to WBL worlds. @@ -21,5 +20,4 @@ public: void OnSelectWorld(Entity* originator, uint32_t index, const SystemAddress& sysAddr); private: std::vector m_LUPWorlds {}; - Item* m_rocket = nullptr; };