mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-26 23:47:21 +00:00
92006123b8
- change NotifyObject to use u16 string - move stuff to header that is inline - use u16strings instead of converting to u16 string - move entity to dEntity
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#include "FvConsoleRightQuickbuild.h"
|
|
#include "EntityManager.h"
|
|
#include "GameMessages.h"
|
|
#include "eTerminateType.h"
|
|
#include "eRebuildState.h"
|
|
#include "Entity.h"
|
|
|
|
void FvConsoleRightQuickbuild::OnStartup(Entity* self) {
|
|
self->SetVar(u"IAmBuilt", false);
|
|
self->SetVar(u"AmActive", false);
|
|
}
|
|
|
|
void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
|
if (state == eRebuildState::COMPLETED) {
|
|
self->SetVar(u"IAmBuilt", true);
|
|
|
|
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
|
|
|
if (!objects.empty()) {
|
|
objects[0]->NotifyObject(self, u"ConsoleRightUp");
|
|
}
|
|
} else if (state == eRebuildState::RESETTING) {
|
|
self->SetVar(u"IAmBuilt", false);
|
|
self->SetVar(u"AmActive", false);
|
|
|
|
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
|
|
|
if (!objects.empty()) {
|
|
objects[0]->NotifyObject(self, u"ConsoleRightDown");
|
|
}
|
|
}
|
|
}
|
|
|
|
void FvConsoleRightQuickbuild::OnUse(Entity* self, Entity* user) {
|
|
if (self->GetVar<bool>(u"AmActive")) {
|
|
return;
|
|
}
|
|
|
|
if (self->GetVar<bool>(u"IAmBuilt")) {
|
|
self->SetVar(u"AmActive", true);
|
|
|
|
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
|
|
|
if (!objects.empty()) {
|
|
objects[0]->NotifyObject(self, u"ConsoleRightActive");
|
|
}
|
|
}
|
|
|
|
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
|
}
|