Qb team credit (#912)

* give credit to whole team for qb's

* fix compiling
This commit is contained in:
Aaron Kimbrell 2022-12-22 07:24:59 -06:00 committed by GitHub
parent 96313ecd69
commit 9ebb06ba24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@
#include "Spawner.h"
#include "MovingPlatformComponent.h"
#include "Preconditions.h"
#include "TeamManager.h"
#include "CppScripts.h"
@ -464,12 +465,20 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
auto* builder = GetBuilder();
if (builder != nullptr) {
auto* missionComponent = builder->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityId);
if (builder) {
auto* team = TeamManager::Instance()->GetTeam(builder->GetObjectID());
if (team) {
for (const auto memberId : team->members) { // progress missions for all team members
auto* member = EntityManager::Instance()->GetEntity(memberId);
if (member) {
auto* missionComponent = member->GetComponent<MissionComponent>();
if (missionComponent) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityId);
}
}
} else{
auto* missionComponent = builder->GetComponent<MissionComponent>();
if (missionComponent) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityId);
}
LootGenerator::Instance().DropActivityLoot(builder, m_Parent, m_ActivityId, 1);
}