2021-12-05 17:54:36 +00:00
|
|
|
#include "NtSleepingGuard.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "MissionComponent.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "RenderComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void NtSleepingGuard::OnStartup(Entity* self) {
|
|
|
|
self->SetNetworkVar<bool>(u"asleep", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NtSleepingGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
|
|
|
|
if (!self->GetNetworkVar<bool>(u"asleep"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Check if emote is in m_ValidEmotes
|
|
|
|
if (std::find(m_ValidEmotes.begin(), m_ValidEmotes.end(), emote) == m_ValidEmotes.end())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Set asleep to false
|
|
|
|
self->SetNetworkVar<bool>(u"asleep", false);
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
RenderComponent::PlayAnimation(self, u"greet");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* missionComponent = target->GetComponent<MissionComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (missionComponent != nullptr) {
|
|
|
|
missionComponent->CompleteMission(1346);
|
|
|
|
}
|
|
|
|
|
|
|
|
self->AddTimer("AsleepAgain", 5.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NtSleepingGuard::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "AsleepAgain") {
|
|
|
|
self->SetNetworkVar<bool>(u"asleep", true);
|
|
|
|
}
|
|
|
|
}
|