mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-23 14:07:20 +00:00
6f057204be
- Add order for loading Components - Enforce all components have Entity* in the first argument
33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
#include "MultiZoneEntranceComponent.h"
|
|
#include "RocketLaunchpadControlComponent.h"
|
|
#include "InventoryComponent.h"
|
|
#include "CharacterComponent.h"
|
|
|
|
MultiZoneEntranceComponent::MultiZoneEntranceComponent(Entity* parent) : Component(parent) {
|
|
m_ParentEntity = parent;
|
|
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_ParentEntity->GetVar<std::u16string>(u"MultiZoneIDs"));
|
|
std::stringstream ss(zoneString);
|
|
for (int i; ss >> i;) {
|
|
m_LUPWorlds.push_back(i);
|
|
if (ss.peek() == ';')
|
|
ss.ignore();
|
|
}
|
|
}
|
|
|
|
MultiZoneEntranceComponent::~MultiZoneEntranceComponent() {}
|
|
|
|
void MultiZoneEntranceComponent::OnUse(Entity* originator) {
|
|
auto* rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
|
|
if (!rocket) return;
|
|
|
|
// the LUP world menu is just the property menu, the client knows how to handle it
|
|
GameMessages::SendPropertyEntranceBegin(m_ParentEntity->GetObjectID(), m_ParentEntity->GetSystemAddress());
|
|
}
|
|
|
|
void MultiZoneEntranceComponent::OnSelectWorld(Entity* originator, uint32_t index) {
|
|
auto* rocketLaunchpadControlComponent = m_ParentEntity->GetComponent<RocketLaunchpadControlComponent>();
|
|
if (!rocketLaunchpadControlComponent) return;
|
|
|
|
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);
|
|
}
|