DarkflameServer/dGame/dComponents/RocketLaunchLupComponent.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
1.2 KiB
C++
Raw Normal View History

2022-05-03 20:05:29 +00:00
#include "RocketLaunchLupComponent.h"
#include "RocketLaunchpadControlComponent.h"
#include "InventoryComponent.h"
2022-05-03 20:05:29 +00:00
#include "CharacterComponent.h"
RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(parent) {
m_OwningEntity = parent;
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_OwningEntity->GetVar<std::u16string>(u"MultiZoneIDs"));
2022-05-17 15:18:50 +00:00
std::stringstream ss(zoneString);
for (int i; ss >> i;) {
m_LUPWorlds.push_back(i);
if (ss.peek() == ';')
ss.ignore();
2022-05-03 20:05:29 +00:00
}
}
RocketLaunchLupComponent::~RocketLaunchLupComponent() {}
2022-05-03 20:05:29 +00:00
void RocketLaunchLupComponent::OnUse(Entity* originator) {
2023-06-07 07:23:50 +00:00
auto rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
if (!rocket) return;
2022-05-03 20:05:29 +00:00
// the LUP world menu is just the property menu, the client knows how to handle it
GameMessages::SendPropertyEntranceBegin(m_OwningEntity->GetObjectID(), m_OwningEntity->GetSystemAddress());
2022-05-03 20:05:29 +00:00
}
void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index) {
2023-06-07 07:23:50 +00:00
auto rocketLaunchpadControlComponent = m_OwningEntity->GetComponent<RocketLaunchpadControlComponent>();
2022-05-03 20:05:29 +00:00
if (!rocketLaunchpadControlComponent) return;
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);
2022-05-03 20:05:29 +00:00
}