feat: Dragonmaw (#1562)

* rigid as heck

* abstract physics creation to separate function

* loading

Update FvRacePillarDServer.cpp

consolidate abcd pillar logic

modularization

Update SimplePhysicsComponent.cpp

Update EntityManager.cpp

Update MovingPlatformComponent.cpp

still need another pass

* geiser works

* columns working finally

* consolidate logic

* constiness

* Update PhantomPhysicsComponent.cpp

* Update PhysicsComponent.cpp

* revert testing code

* add versions info

---------

Co-authored-by: Aaron Kimbre <aronwk.aaron@gmail.com>
This commit is contained in:
David Markowitz
2024-05-10 07:22:26 -07:00
committed by GitHub
parent 07cb19cc30
commit 2ca61c3e57
29 changed files with 611 additions and 214 deletions

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;
};