Merge branch 'main' into PetFixes

This commit is contained in:
jadebenn
2024-12-14 17:30:21 -06:00
239 changed files with 124030 additions and 46555 deletions

View File

@@ -15,6 +15,7 @@
#include "SkillComponent.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "PlayerManager.h"
#include <vector>
@@ -53,11 +54,13 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID && killer) {
auto* missionComponent = killer->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;
for (const auto& player : PlayerManager::GetAllPlayers()) {
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;
missionComponent->CompleteMission(instanceMissionID);
missionComponent->CompleteMission(instanceMissionID);
}
}
// There is suppose to be a 0.1 second delay here but that may be admitted?

View File

@@ -6,7 +6,7 @@
#include "SkillComponent.h"
#include "BaseCombatAIComponent.h"
#include "EntityInfo.h"
#include "eAninmationFlags.h"
#include "eAnimationFlags.h"
#include "RenderComponent.h"
void AmDarklingDragon::OnStartup(Entity* self) {

View File

@@ -3,7 +3,7 @@
#include "SkillComponent.h"
#include "BaseCombatAIComponent.h"
#include "DestroyableComponent.h"
#include "eAninmationFlags.h"
#include "eAnimationFlags.h"
#include "EntityInfo.h"
#include "RenderComponent.h"

View File

@@ -5,7 +5,7 @@
#include "EntityManager.h"
#include "EntityInfo.h"
#include "SkillComponent.h"
#include "eAninmationFlags.h"
#include "eAnimationFlags.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"

View File

@@ -1,3 +1,6 @@
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING
"RaceFireballs.cpp"
"RaceMaelstromGeiser.cpp"
"RaceShipLapColumnsServer.cpp"
"FvRacingColumns.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,15 @@
#include "FvRacingColumns.h"
#include "MovingPlatformComponent.h"
void FvRacingColumns::OnStartup(Entity* self) {
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
if (!movingPlatformComponent) return;
movingPlatformComponent->StopPathing();
movingPlatformComponent->SetSerialized(true);
int32_t pathStart = 0;
if (self->HasVar(u"attached_path_start")) {
pathStart = self->GetVar<uint32_t>(u"attached_path_start");
}
movingPlatformComponent->WarpToWaypoint(pathStart);
}

View File

@@ -0,0 +1,6 @@
#include "CppScripts.h"
class FvRacingColumns : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
};

View File

@@ -0,0 +1,15 @@
#include "RaceFireballs.h"
#include "SkillComponent.h"
void RaceFireballs::OnStartup(Entity* self) {
self->AddTimer("fire", GeneralUtils::GenerateRandomNumber<float>(3.0f, 10.0f));
}
void RaceFireballs::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "fire") {
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent) skillComponent->CastSkill(894);
self->AddTimer("fire", GeneralUtils::GenerateRandomNumber<float>(3.0f, 10.0f));
}
}

View File

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

View File

@@ -0,0 +1,47 @@
#include "RaceShipLapColumnsServer.h"
#include "RacingControlComponent.h"
#include "MovingPlatformComponent.h"
void RaceShipLapColumnsServer::OnStartup(Entity* self) {
self->SetVar(u"Lap2Complete", false);
self->SetVar(u"Lap3Complete", false);
}
void SetMovingToWaypoint(const int32_t waypointIndex, const std::string group) {
const auto entities = Game::entityManager->GetEntitiesInGroup(group);
if (entities.empty()) return;
auto* entity = entities[0];
entity->SetIsGhostingCandidate(false);
auto* movingPlatfromComponent = entity->GetComponent<MovingPlatformComponent>();
if (!movingPlatfromComponent) return;
movingPlatfromComponent->SetSerialized(true);
movingPlatfromComponent->GotoWaypoint(waypointIndex);
Game::entityManager->SerializeEntity(entity);
}
void RaceShipLapColumnsServer::OnCollisionPhantom(Entity* self, Entity* target) {
if (!target) return;
const auto racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
if (racingControllers.empty()) return;
auto* racingControlComponent = racingControllers[0]->GetComponent<RacingControlComponent>();
if (!racingControlComponent) return;
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
if (!player) return;
if (player->lap == 1 && !self->GetVar<bool>(u"Lap2Complete")) {
self->SetVar(u"Lap2Complete", true);
SetMovingToWaypoint(1, "Lap2Column");
SetMovingToWaypoint(0, "Lap2Ramp");
} else if (player->lap == 2 && !self->GetVar<bool>(u"Lap3Complete")) {
self->SetVar(u"Lap3Complete", true);
SetMovingToWaypoint(1, "Lap3Column");
SetMovingToWaypoint(0, "Lap3Ramp");
}
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class RaceShipLapColumnsServer : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnCollisionPhantom(Entity* self, Entity* target) override;
};

View File

@@ -227,20 +227,20 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
Game::entityManager->ConstructEntity(spawnedPet);
}
Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
Entity* PetDigServer::GetClosestTreasure(NiPoint3 position) {
float closestDistance = 0;
Entity* closest = nullptr;
for (const auto tresureId : treasures) {
auto* tresure = Game::entityManager->GetEntity(tresureId);
for (const auto treasureId : treasures) {
auto* treasure = Game::entityManager->GetEntity(treasureId);
if (tresure == nullptr) continue;
if (treasure == nullptr) continue;
float distance = Vector3::DistanceSquared(tresure->GetPosition(), position);
float distance = Vector3::DistanceSquared(treasure->GetPosition(), position);
if (closest == nullptr || distance < closestDistance) {
closestDistance = distance;
closest = tresure;
closest = treasure;
}
}

View File

@@ -24,7 +24,7 @@ public:
*/
void OnUse(Entity* self, Entity* user) override;
static Entity* GetClosestTresure(NiPoint3 position);
static Entity* GetClosestTreasure(NiPoint3 position);
private:
static void ProgressPetDigMissions(const Entity* owner, const Entity* chest);

View File

@@ -56,10 +56,6 @@ void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
auto member = Game::entityManager->GetEntity(memberID);
if (member != nullptr && !member->GetIsDead()) {
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
} else {
// If player left the team or left early erase them from the team variable.
team.erase(std::find(team.begin(), team.end(), memberID));
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", team);
}
}
}