2022-05-01 13:54:45 +00:00
|
|
|
#include "Darkitect.h"
|
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "DestroyableComponent.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "Character.h"
|
2023-01-22 23:38:47 +00:00
|
|
|
#include "eMissionState.h"
|
2022-05-01 13:54:45 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void Darkitect::Reveal(Entity* self, Entity* player) {
|
2022-05-01 13:54:45 +00:00
|
|
|
const auto playerID = player->GetObjectID();
|
|
|
|
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"reveal", 0, 0, playerID, "", player->GetSystemAddress());
|
|
|
|
|
|
|
|
self->AddCallbackTimer(20, [this, self, playerID]() {
|
|
|
|
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
|
|
|
|
|
|
|
if (!player) return;
|
|
|
|
|
|
|
|
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
|
|
|
|
auto* missionComponent = player->GetComponent<MissionComponent>();
|
|
|
|
auto* character = player->GetCharacter();
|
|
|
|
|
|
|
|
if (destroyableComponent != nullptr && missionComponent != nullptr && character != nullptr) {
|
|
|
|
destroyableComponent->SetArmor(0);
|
|
|
|
destroyableComponent->SetHealth(1);
|
|
|
|
destroyableComponent->SetImagination(0);
|
|
|
|
|
2023-01-22 23:38:47 +00:00
|
|
|
if (missionComponent->GetMissionState(1295) == eMissionState::ACTIVE) {
|
2022-05-01 13:54:45 +00:00
|
|
|
character->SetPlayerFlag(1911, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
EntityManager::Instance()->SerializeEntity(player);
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
});
|
2022-05-01 13:54:45 +00:00
|
|
|
}
|