2021-12-05 17:54:36 +00:00
|
|
|
#include "CharacterComponent.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "PossessableComponent.h"
|
2022-02-05 11:28:17 +00:00
|
|
|
#include "RaceSmashServer.h"
|
|
|
|
#include "eRacingTaskParam.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "eMissionTaskType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void RaceSmashServer::OnDie(Entity* self, Entity* killer) {
|
|
|
|
// Crate is smashed by the car
|
|
|
|
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
|
|
|
if (possessableComponent != nullptr) {
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
2021-12-05 17:54:36 +00:00
|
|
|
if (possessor != nullptr) {
|
|
|
|
|
2022-02-05 11:28:17 +00:00
|
|
|
auto* missionComponent = possessor->GetComponent<MissionComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
|
2022-02-05 11:28:17 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (characterComponent != nullptr) {
|
|
|
|
characterComponent->UpdatePlayerStatistic(RacingSmashablesSmashed);
|
|
|
|
}
|
2022-02-05 11:28:17 +00:00
|
|
|
|
|
|
|
// Progress racing smashable missions
|
|
|
|
if (missionComponent == nullptr) return;
|
|
|
|
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
|
2022-02-06 22:28:37 +00:00
|
|
|
// Progress missions that ask us to smash a specific smashable.
|
|
|
|
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|