mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 18:54:13 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
35
dScripts/02_server/Map/NT/NtSleepingGuard.cpp
Normal file
35
dScripts/02_server/Map/NT/NtSleepingGuard.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "NtSleepingGuard.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.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);
|
||||
|
||||
GameMessages::SendPlayAnimation(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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user