Merge branch 'main' into npc-pathing

This commit is contained in:
Aaron Kimbre
2023-04-10 22:19:41 -05:00
612 changed files with 12044 additions and 7169 deletions

View File

@@ -1,5 +1,7 @@
#include "ActPlayerDeathTrigger.h"
#include "Entity.h"
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready

View File

@@ -1,6 +1,6 @@
#include "ActSharkPlayerDeathTrigger.h"
#include "MissionComponent.h"
#include "MissionTaskType.h"
#include "eMissionTaskType.h"
#include "Entity.h"
void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
@@ -9,7 +9,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen
auto missionComponent = sender->GetComponent<MissionComponent>();
if (!missionComponent) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, 8419);
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419);
if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready

View File

@@ -4,6 +4,7 @@
#include "GameMessages.h"
#include "PhantomPhysicsComponent.h"
#include "RenderComponent.h"
#include "eReplicaComponentType.h"
void AgFans::OnStartup(Entity* self) {
self->SetVar<bool>(u"alive", true);
@@ -11,7 +12,7 @@ void AgFans::OnStartup(Entity* self) {
ToggleFX(self, false);
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (renderComponent == nullptr) {
return;
@@ -24,7 +25,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
std::string fanGroup = self->GetGroups()[0];
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (renderComponent == nullptr) {
return;
@@ -39,7 +40,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
self->SetVar<bool>(u"on", false);
for (Entity* volume : fanVolumes) {
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
if (!volumePhys) continue;
volumePhys->SetPhysicsEffectActive(false);
EntityManager::Instance()->SerializeEntity(volume);
@@ -55,7 +56,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
self->SetVar<bool>(u"on", true);
for (Entity* volume : fanVolumes) {
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
if (!volumePhys) continue;
volumePhys->SetPhysicsEffectActive(true);
EntityManager::Instance()->SerializeEntity(volume);

View File

@@ -2,13 +2,15 @@
#include "EntityManager.h"
#include "GeneralUtils.h"
#include "GameMessages.h"
#include "EntityInfo.h"
#include "DestroyableComponent.h"
#include "eReplicaComponentType.h"
void AgImagSmashable::OnDie(Entity* self, Entity* killer) {
bool maxImagGreaterThanZero = false;
if (killer) {
DestroyableComponent* dest = static_cast<DestroyableComponent*>(killer->GetComponent(COMPONENT_TYPE_DESTROYABLE));
DestroyableComponent* dest = static_cast<DestroyableComponent*>(killer->GetComponent(eReplicaComponentType::DESTROYABLE));
if (dest) {
maxImagGreaterThanZero = dest->GetMaxImagination() > 0;
}

View File

@@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "SkillComponent.h"
#include "eReplicaComponentType.h"
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
if (inUse) {
@@ -86,12 +87,12 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) {
auto* mortar = entities[selected];
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(COMPONENT_TYPE_SKILL));
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(eReplicaComponentType::SKILL));
mortar->SetOwnerOverride(builder);
SkillComponent* skillComponent;
if (!mortar->TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent)) {
if (!mortar->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
return;
}

View File

@@ -1,5 +1,7 @@
#include "AgPicnicBlanket.h"
#include "Loot.h"
#include "GameMessages.h"
#include "Entity.h"
void AgPicnicBlanket::OnUse(Entity* self, Entity* user) {
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());

View File

@@ -15,7 +15,7 @@ void AgQbElevator::OnRebuildComplete(Entity* self, Entity* target) {
if (delayTime < 1) delayTime = 1;
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
0, 0, MovementPlatformState::Stationary);
0, 0, eMovementPlatformState::Stationary);
//add a timer that will kill the QB if no players get on in the killTime
self->AddTimer("startKillTimer", killTime);
@@ -33,7 +33,7 @@ void AgQbElevator::OnProximityUpdate(Entity* self, Entity* entering, std::string
self->CancelTimer("StartElevator");
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
1, 1, MovementPlatformState::Moving);
1, 1, eMovementPlatformState::Moving);
} else if (!self->GetBoolean(u"StartTimer")) {
self->SetBoolean(u"StartTimer", true);
self->AddTimer("StartElevator", startTime);
@@ -45,7 +45,7 @@ void AgQbElevator::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "StartElevator") {
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
1, 1, MovementPlatformState::Moving);
1, 1, eMovementPlatformState::Moving);
} else if (timerName == "startKillTimer") {
killTimerStartup(self);
} else if (timerName == "KillTimer") {

View File

@@ -1,4 +1,5 @@
#include "AgSpaceStuff.h"
#include "EntityInfo.h"
#include "GeneralUtils.h"
#include "GameMessages.h"
#include "EntityManager.h"

View File

@@ -1,5 +1,6 @@
#include "AgStromlingProperty.h"
#include "MovementAIComponent.h"
#include "eReplicaComponentType.h"
void AgStromlingProperty::OnStartup(Entity* self) {
auto movementInfo = MovementAIInfo{
@@ -12,5 +13,5 @@ void AgStromlingProperty::OnStartup(Entity* self) {
};
auto* movementAIComponent = new MovementAIComponent(self, movementInfo);
self->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAIComponent);
self->AddComponent(eReplicaComponentType::MOVEMENT_AI, movementAIComponent);
}

View File

@@ -3,6 +3,7 @@
#include "RebuildComponent.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eEndBehavior.h"
void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
const auto myGroup = "AllPipes";
@@ -42,7 +43,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
missionComponent->ForceProgressTaskType(769, 1, 1, false);
}
GameMessages::SendPlayCinematic(player->GetObjectID(), u"ParadoxPipeFinish", player->GetSystemAddress(), true, true, false, false, 0, false, 2.0f);
GameMessages::SendPlayCinematic(player->GetObjectID(), u"ParadoxPipeFinish", player->GetSystemAddress(), true, true, false, false, eEndBehavior::RETURN, false, 2.0f);
}
object->SetVar(u"PlayerID", LWOOBJID_EMPTY);

View File

@@ -1,9 +1,10 @@
#include "FvFreeGfNinjas.h"
#include "Character.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
if (missionID == 705 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID == 705 && missionState == eMissionState::AVAILABLE) {
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;
@@ -29,7 +30,7 @@ void FvFreeGfNinjas::OnUse(Entity* self, Entity* user) {
if (missionComponent == nullptr)
return;
if (missionComponent->GetMissionState(705) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(705) == eMissionState::ACTIVE) {
auto* character = user->GetCharacter();
if (character != nullptr)
character->SetPlayerFlag(68, true);

View File

@@ -3,6 +3,6 @@
class FvFreeGfNinjas : public CppScripts::Script {
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
void OnUse(Entity* self, Entity* user) override;
};

View File

@@ -19,12 +19,6 @@ void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* ta
GameMessages::SendPlayAnimation(self, u"scared");
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->HasMission(737)) {
missionComponent->ForceProgressTaskType(737, 5, 1, false);
}
if (self->GetLOT() == 7412) {
auto* rightGuard = EntityManager::Instance()->GetEntity(m_RightGuard);
@@ -39,4 +33,3 @@ void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* ta
}
}
}

View File

@@ -2,6 +2,7 @@
#include "Character.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "EntityInfo.h"
#include "ScriptedActivityComponent.h"
void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {

View File

@@ -2,6 +2,7 @@
#include "Entity.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void LegoDieRoll::OnStartup(Entity* self) {
self->AddTimer("DoneRolling", 10.0f);
@@ -39,7 +40,7 @@ void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) {
if (missionComponent != nullptr) {
const auto rollMissionState = missionComponent->GetMissionState(756);
if (rollMissionState == MissionState::MISSION_STATE_ACTIVE) {
if (rollMissionState == eMissionState::ACTIVE) {
missionComponent->ForceProgress(756, 1103, 1);
}
}

View File

@@ -2,6 +2,7 @@
#include "Entity.h"
#include "DestroyableComponent.h"
#include "EntityInfo.h"
#include "EntityManager.h"
void GfBanana::SpawnBanana(Entity* self) {

View File

@@ -4,13 +4,14 @@
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "EntityManager.h"
#include "eReplicaComponentType.h"
void GfCampfire::OnStartup(Entity* self) {
self->SetI32(u"counter", static_cast<int32_t>(0));
self->SetProximityRadius(2.0f, "placeholder");
self->SetBoolean(u"isBurning", true);
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;
@@ -20,7 +21,7 @@ void GfCampfire::OnStartup(Entity* self) {
void GfCampfire::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) {
if (args == "physicsReady") {
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
render->PlayEffect(295, u"running", "Burn");
}

View File

@@ -1,18 +1,19 @@
#include "GfJailkeepMission.h"
#include "MissionComponent.h"
#include "Character.h"
#include "eMissionState.h"
void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;
if (missionID == 385 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
if (missionID == 385 && missionState == eMissionState::AVAILABLE) {
missionComponent->AcceptMission(386, true);
missionComponent->AcceptMission(387, true);
missionComponent->AcceptMission(388, true);
missionComponent->AcceptMission(390, true);
} else if (missionID == 385 && missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
} else if (missionID == 385 && missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
auto* character = target->GetCharacter();
if (character != nullptr && character->GetPlayerFlag(68)) {
missionComponent->AcceptMission(701);
@@ -28,7 +29,7 @@ void GfJailkeepMission::OnUse(Entity* self, Entity* user) {
if (missionComponent == nullptr)
return;
if (missionComponent->GetMissionState(385) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(385) == eMissionState::ACTIVE) {
missionComponent->AcceptMission(386, true);
missionComponent->AcceptMission(387, true);
missionComponent->AcceptMission(388, true);

View File

@@ -5,5 +5,5 @@ class GfJailkeepMission final : public CppScripts::Script
{
public:
void OnUse(Entity* self, Entity* user) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -1,6 +1,8 @@
#include "PetDigBuild.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) {
auto flagNumber = self->GetVar<std::u16string>(u"flagNum");
@@ -21,7 +23,7 @@ void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) {
info.settings.push_back(new LDFData<std::u16string>(u"groupID", u"Flag" + flagNumber));
} else {
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(746) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent != nullptr && missionComponent->GetMissionState(746) == eMissionState::ACTIVE) {
info.lot = 9307; // Special Captain Jack treasure that drops a mission item
} else {
info.lot = 3495; // Normal AG treasure

View File

@@ -1,8 +1,10 @@
#include "PirateRep.h"
#include "Character.h"
#include "eMissionState.h"
#include "Entity.h"
void PirateRep::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
if (missionID == m_PirateRepMissionID && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
void PirateRep::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID == m_PirateRepMissionID && missionState >= eMissionState::READY_TO_COMPLETE) {
auto* character = target->GetCharacter();
if (character) {
character->SetPlayerFlag(ePlayerFlags::GF_PIRATE_REP, true);

View File

@@ -3,7 +3,7 @@
class PirateRep : public CppScripts::Script {
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
private:
const int m_PirateRepMissionID = 301;
};

View File

@@ -11,6 +11,10 @@
#include "MovementAIComponent.h"
#include "../dWorldServer/ObjectIDManager.h"
#include "MissionComponent.h"
#include "Loot.h"
#include "InventoryComponent.h"
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
void SGCannon::OnStartup(Entity* self) {
Game::logger->Log("SGCannon", "OnStartup");
@@ -75,7 +79,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
Game::logger->Log("SGCannon", "Player is ready");
/*GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
/*GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true);*/
Game::logger->Log("SGCannon", "Sending ActivityEnter");
@@ -290,7 +294,6 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
if (enemy) {
EntityManager::Instance()->ConstructEntity(enemy);
auto* movementAI = enemy->GetComponent<MovementAIComponent>();
if (!movementAI) return;
movementAI->SetSpeed(toSpawn.initialSpeed);
@@ -541,9 +544,9 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(MaxStreakVariable), self->GetObjectID(), "performact_streak");
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_CannonLot, 0, "", self->GetVar<uint32_t>(TotalScoreVariable));
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar<uint32_t>(MaxStreakVariable), self->GetObjectID(), "performact_streak");
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_CannonLot, 0, "", self->GetVar<uint32_t>(TotalScoreVariable));
}
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
@@ -653,7 +656,7 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
auto missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, spawnInfo.lot, self->GetObjectID());
missionComponent->Progress(eMissionTaskType::SMASH, spawnInfo.lot, self->GetObjectID());
}
void SGCannon::UpdateStreak(Entity* self) {
@@ -711,7 +714,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
Game::logger->Log("SGCannon", "Player has %d equipped items", equippedItems.size());
auto skillID = constants.cannonSkill;
auto coolDown = constants.cannonRefireRate;
auto cooldown = constants.cannonRefireRate;
auto* selfInventoryComponent = self->GetComponent<InventoryComponent>();
@@ -727,7 +730,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
// TODO: Equip items
skillID = constants.cannonSuperChargeSkill;
coolDown = 400;
cooldown = 400;
} else {
selfInventoryComponent->UpdateSlot("greeble_r", { ObjectIDManager::GenerateRandomObjectID(), 0, 0, 0 });
selfInventoryComponent->UpdateSlot("greeble_l", { ObjectIDManager::GenerateRandomObjectID(), 0, 0, 0 });
@@ -750,7 +753,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
}
}
}
cooldown = 800;
self->SetVar<uint32_t>(NumberOfChargesVariable, 0);
}
@@ -766,7 +769,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
properties.cannonFOV = 58.6f;
properties.cannonVelocity = 129.0;
properties.cannonRefireRate = 800;
properties.cannonRefireRate = cooldown;
properties.cannonMinDistance = 30;
properties.cannonTimeout = -1;

View File

@@ -1,12 +1,14 @@
#include "NpcNpSpacemanBob.h"
#include "DestroyableComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE && missionID == 173) {
DestroyableComponent* destroyable = static_cast<DestroyableComponent*>(target->GetComponent(COMPONENT_TYPE_DESTROYABLE));
void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionState == eMissionState::READY_TO_COMPLETE && missionID == 173) {
DestroyableComponent* destroyable = static_cast<DestroyableComponent*>(target->GetComponent(eReplicaComponentType::DESTROYABLE));
destroyable->SetImagination(6);
MissionComponent* mission = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
MissionComponent* mission = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
mission->CompleteMission(664);
}

View File

@@ -4,6 +4,6 @@
class NpcNpSpacemanBob : public CppScripts::Script
{
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
};

View File

@@ -5,7 +5,10 @@
#include "EntityManager.h"
#include "RebuildComponent.h"
#include "SoundTriggerComponent.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eMissionTaskType.h"
// Constants are at the bottom
@@ -145,8 +148,8 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) {
// Player might be null if they left
if (player != nullptr) {
auto* missions = player->GetComponent<MissionComponent>();
if (missions != nullptr && missions->GetMissionState(176) == MissionState::MISSION_STATE_ACTIVE) {
missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
if (missions != nullptr && missions->GetMissionState(176) == eMissionState::ACTIVE) {
missions->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
GameMessages::SendEndCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS, 1.0f);

View File

@@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "MissionComponent.h"
#include "Character.h"
#include "eReplicaComponentType.h"
void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID, Entity* player, int reward) {
if (missionID != 474) return;
@@ -44,7 +45,7 @@ void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID,
player->GetCharacter()->SetPlayerFlag(flagID, true);
}
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
for (int mission : factionMissions) {
mis->AcceptMission(mission);

View File

@@ -1,8 +1,9 @@
#include "NsJohnnyMissionServer.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
if (missionID == 773 && missionState <= MissionState::MISSION_STATE_ACTIVE) {
void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID == 773 && missionState <= eMissionState::ACTIVE) {
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->AcceptMission(774);

View File

@@ -2,5 +2,5 @@
#include "CppScripts.h"
class NsJohnnyMissionServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -1,11 +1,13 @@
#include "NsModularBuild.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void NsModularBuild::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector<LOT> modules) {
if (bCompleted) {
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
if (mission->GetMissionState(m_MissionNum) == MissionState::MISSION_STATE_ACTIVE) {
if (mission->GetMissionState(m_MissionNum) == eMissionState::ACTIVE) {
for (LOT mod : modules) {
if (mod == 9516 || mod == 9517 || mod == 9518) {
mission->ForceProgress(m_MissionNum, 1178, 1);

View File

@@ -1,5 +1,6 @@
#include "RockHydrantSmashable.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "GeneralUtils.h"
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {

View File

@@ -1,5 +1,6 @@
#include "HydrantSmashable.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "GeneralUtils.h"
void HydrantSmashable::OnDie(Entity* self, Entity* killer) {

View File

@@ -5,18 +5,19 @@
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "Item.h"
#include "eMissionState.h"
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* character = target->GetCharacter();
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
const auto state = missionComponent->GetMissionState(320);
if (missionID == 768 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
if (missionID == 768 && missionState == eMissionState::AVAILABLE) {
if (!character->GetPlayerFlag(71)) {
// TODO: Cinematic "MissionCam"
}
} else if (missionID == 768 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
} else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) {
//remove the inventory items
for (int item : gearSets) {
auto* id = inventoryComponent->FindItemByLot(item);
@@ -27,8 +28,8 @@ void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionI
}
}
} else if (
(missionID == 320 && state == MissionState::MISSION_STATE_AVAILABLE) /*||
(state == MissionState::MISSION_STATE_COMPLETE && missionID == 891 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE)*/
(missionID == 320 && state == eMissionState::AVAILABLE) /*||
(state == eMissionState::COMPLETE && missionID == 891 && missionState == eMissionState::READY_TO_COMPLETE)*/
) {
//GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());

View File

@@ -4,7 +4,7 @@
class AgPropGuard final : public CppScripts::Script
{
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
private:
std::vector<int> gearSets = { 14359,14321,14353,14315 };

View File

@@ -3,8 +3,9 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "dZoneManager.h"
#include "eMissionState.h"
void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* character = target->GetCharacter();
if (character == nullptr)
return;
@@ -13,11 +14,11 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
if (flag == 0)
return;
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_ACTIVE)
if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::ACTIVE)
&& !character->GetPlayerFlag(flag)) {
// If the player just started the mission, play a cinematic highlighting the target
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
} else if (missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
} else if (missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
// Makes the guard disappear once the mission has been completed
const auto zoneControlID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(),

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
class AgPropguards : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
private:
static uint32_t GetFlagForMission(uint32_t missionID);
};

View File

@@ -12,7 +12,7 @@ void PropertyFXDamage::OnCollisionPhantom(Entity* self, Entity* target) {
if (skills != nullptr && targetStats != nullptr) {
auto targetFactions = targetStats->GetFactionIDs();
if (std::find(targetFactions.begin(), targetFactions.end(), 1) != targetFactions.end()) {
skills->CalculateBehavior(11386, 692, target->GetObjectID());
skills->CalculateBehavior(692, 11386, target->GetObjectID());
}
}
}

View File

@@ -3,8 +3,9 @@
#include "DestroyableComponent.h"
#include "EntityManager.h"
#include "PossessableComponent.h"
#include "RacingTaskParam.h"
#include "eRacingTaskParam.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) {
if (killer != nullptr) {
@@ -29,8 +30,8 @@ void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) {
}
if (missionComponent == nullptr) return;
// Dragon eggs have their own smash server so we handle mission progression for them here.
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES);
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE);
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE);
}
}

View File

@@ -3,9 +3,10 @@
#include "EntityManager.h"
#include "PossessableComponent.h"
#include "RaceImagineCrateServer.h"
#include "RacingTaskParam.h"
#include "eRacingTaskParam.h"
#include "MissionComponent.h"
#include "SkillComponent.h"
#include "eMissionTaskType.h"
void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) {
if (self->GetVar<bool>(u"bIsDead")) {
@@ -49,7 +50,7 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) {
// Progress racing smashable missions
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES);
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
}
}
}

View File

@@ -2,8 +2,9 @@
#include "EntityManager.h"
#include "PossessorComponent.h"
#include "RaceImaginePowerup.h"
#include "RacingTaskParam.h"
#include "eRacingTaskParam.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
@@ -31,6 +32,6 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std
auto* missionComponent = sender->GetComponent<MissionComponent>();
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COLLECT_IMAGINATION);
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::COLLECT_IMAGINATION);
}
}

View File

@@ -2,8 +2,9 @@
#include "EntityManager.h"
#include "PossessableComponent.h"
#include "RaceSmashServer.h"
#include "RacingTaskParam.h"
#include "eRacingTaskParam.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
void RaceSmashServer::OnDie(Entity* self, Entity* killer) {
// Crate is smashed by the car
@@ -22,9 +23,9 @@ void RaceSmashServer::OnDie(Entity* self, Entity* killer) {
// Progress racing smashable missions
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES);
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
// Progress missions that ask us to smash a specific smashable.
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE);
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE);
}
}
}

View File

@@ -4,6 +4,7 @@
#include "SkillComponent.h"
#include "DestroyableComponent.h"
#include "EntityManager.h"
#include "eReplicaComponentType.h"
void SpecialImaginePowerupSpawner::OnStartup(Entity* self) {
self->SetProximityRadius(1.5f, "powerupEnter");
@@ -26,7 +27,7 @@ void SpecialImaginePowerupSpawner::OnProximityUpdate(Entity* self, Entity* enter
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
SkillComponent* skillComponent;
if (!self->TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent)) {
if (!self->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
return;
}
@@ -35,7 +36,7 @@ void SpecialImaginePowerupSpawner::OnProximityUpdate(Entity* self, Entity* enter
skillComponent->CalculateBehavior(13, 20, source);
DestroyableComponent* destroyableComponent;
if (!self->TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent)) {
if (!self->TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) {
return;
}

View File

@@ -1,4 +1,8 @@
set(DSCRIPTS_SOURCES_AI_WILD
set(DSCRIPTS_SOURCES_AI_WILD
"AllCrateChicken.cpp"
"WildAmbients.cpp"
"WildAmbientCrab.cpp"
"WildAndScared.cpp"
"WildGfGlowbug.cpp"
"WildPants.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,27 @@
#include "WildAmbientCrab.h"
#include "GameMessages.h"
void WildAmbientCrab::OnStartup(Entity* self){
self->SetVar(u"flipped", true);
GameMessages::SendPlayAnimation(self, u"idle");
}
void WildAmbientCrab::OnUse(Entity* self, Entity* user) {
auto flipped = self->GetVar<bool>(u"flipped");
if (flipped) {
self->AddTimer("Flipping", 0.6f);
GameMessages::SendPlayAnimation(self, u"flip-over");
self->SetVar(u"flipped", false);
} else if (!flipped) {
self->AddTimer("Flipback", 0.8f);
GameMessages::SendPlayAnimation(self, u"flip-back");
self->SetVar(u"flipped", true);
}
}
void WildAmbientCrab::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "Flipping") GameMessages::SendPlayAnimation(self, u"over-idle");
else if (timerName == "Flipback") GameMessages::SendPlayAnimation(self, u"idle");
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "CppScripts.h"
class WildAmbientCrab final : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnTimerDone(Entity* self, std::string timerName) override;
void OnUse(Entity* self, Entity* user) override;
};

View File

@@ -0,0 +1,6 @@
#include "WildAndScared.h"
#include "GameMessages.h"
void WildAndScared::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayAnimation(self, u"scared");
}

View File

@@ -0,0 +1,7 @@
#pragma once
#include "CppScripts.h"
class WildAndScared : public CppScripts::Script {
public:
void OnUse(Entity* self, Entity* user) override;
};

View File

@@ -0,0 +1,28 @@
#include "WildGfGlowbug.h"
#include "GameMessages.h"
void WildGfGlowbug::OnStartup(Entity* self){
self->SetVar(u"switch", false);
}
void WildGfGlowbug::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (args == "physicsReady") {
auto switchState = self->GetVar<bool>(u"switch");
if (!switchState) {
GameMessages::SendStopFXEffect(self, true, "glowlight");
} else if (switchState) {
GameMessages::SendPlayFXEffect(self, -1, u"light", "glowlight", LWOOBJID_EMPTY);
}
}
}
void WildGfGlowbug::OnUse(Entity* self, Entity* user) {
auto switchState = self->GetVar<bool>(u"switch");
if (switchState) {
GameMessages::SendStopFXEffect(self, true, "glowlight");
self->SetVar(u"switch", false);
} else if (!switchState) {
GameMessages::SendPlayFXEffect(self, -1, u"light", "glowlight", LWOOBJID_EMPTY);
self->SetVar(u"switch", true);
}
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "CppScripts.h"
class WildGfGlowbug : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
void OnUse(Entity* self, Entity* user) override;
};

View File

@@ -0,0 +1,10 @@
#include "WildPants.h"
#include "GameMessages.h"
void WildPants::OnStartup(Entity* self) {
self->SetProximityRadius(5, "scardyPants");
}
void WildPants::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (status == "ENTER") GameMessages::SendPlayAnimation(self, u"scared");
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "CppScripts.h"
class WildPants : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
};