2021-12-05 17:54:36 +00:00
|
|
|
#include "PropertyDevice.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "EntityManager.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "eMissionState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void PropertyDevice::OnStartup(Entity* self) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* zoneControl = Game::entityManager->GetZoneControlEntity();
|
2021-12-05 17:54:36 +00:00
|
|
|
if (zoneControl != nullptr) {
|
|
|
|
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-29 04:24:30 +00:00
|
|
|
void PropertyDevice::OnQuickBuildComplete(Entity* self, Entity* target) {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto propertyOwnerID = self->GetNetworkVar<std::string>(m_PropertyOwnerVariable);
|
|
|
|
if (propertyOwnerID == std::to_string(LWOOBJID_EMPTY))
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto* missionComponent = target->GetComponent<MissionComponent>();
|
|
|
|
if (missionComponent != nullptr) {
|
|
|
|
if (missionComponent->GetMissionState(m_PropertyMissionID) == eMissionState::ACTIVE) {
|
|
|
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 641, u"create", "callhome");
|
|
|
|
missionComponent->ForceProgress(m_PropertyMissionID, 1793, self->GetLOT());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|