2021-12-05 17:54:36 +00:00
|
|
|
#include "MaestromExtracticatorServer.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "eMissionTaskType.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "RenderComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void MaestromExtracticatorServer::OnStartup(Entity* self) {
|
2023-03-26 10:09:04 +00:00
|
|
|
float animTime = RenderComponent::PlayAnimation(self, failAnim);
|
|
|
|
if (animTime == 0.0f) animTime = defaultTime;
|
|
|
|
|
|
|
|
self->AddTimer("PlayFail", animTime);
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
|
|
|
|
}
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
|
|
|
if (sender == nullptr) return;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (args == "attemptCollection") {
|
2023-07-15 20:56:33 +00:00
|
|
|
Entity* player = Game::entityManager->GetEntity(self->GetSpawnerID());
|
2021-12-05 17:54:36 +00:00
|
|
|
if (!player) return;
|
|
|
|
|
|
|
|
auto missionComponent = player->GetComponent<MissionComponent>();
|
|
|
|
if (missionComponent == nullptr) return;
|
|
|
|
|
|
|
|
missionComponent->Progress(eMissionTaskType::SMASH, 14718);
|
|
|
|
CollectSample(self, sender->GetObjectID());
|
|
|
|
sender->ScheduleKillAfterUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MaestromExtracticatorServer::CollectSample(Entity* self, LWOOBJID sampleObj) {
|
2023-03-20 13:10:52 +00:00
|
|
|
self->AddTimer("RemoveSample", PlayAnimAndReturnTime(self, collectAnim));
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
float MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
|
|
|
|
return RenderComponent::PlayAnimation(self, animID);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "RemoveSample") {
|
|
|
|
self->ScheduleKillAfterUpdate();
|
2023-03-20 13:10:52 +00:00
|
|
|
} else if (timerName == "PlayFail") {
|
|
|
|
RenderComponent::PlayAnimation(self, failAnim);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|