mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 04:08:20 +00:00
b432a3f5da
Clean up macros more tomorrow Cleanup and optimize CDActivities table Remove unused include Further work on CDActivityRewards Update MasterServer.cpp Further animations work Activities still needs work for a better PK. fix type All of these replacements worked Create internal interface for animations Allows for user to just call GetAnimationTIme or PlayAnimation rather than passing in arbitrary true false statements
37 lines
970 B
C++
37 lines
970 B
C++
#include "NtSleepingGuard.h"
|
|
#include "GameMessages.h"
|
|
#include "MissionComponent.h"
|
|
#include "RenderComponent.h"
|
|
|
|
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);
|
|
|
|
RenderComponent::PlayAnimation(self, u"greet");
|
|
|
|
auto* missionComponent = target->GetComponent<MissionComponent>();
|
|
|
|
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);
|
|
}
|
|
}
|