mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
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:
@@ -1,3 +1,6 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING
|
||||
"RaceFireballs.cpp"
|
||||
"RaceMaelstromGeiser.cpp"
|
||||
"RaceShipLapColumnsServer.cpp"
|
||||
"FvRacingColumns.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
15
dScripts/02_server/Map/FV/Racing/FvRacingColumns.cpp
Normal file
15
dScripts/02_server/Map/FV/Racing/FvRacingColumns.cpp
Normal 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);
|
||||
}
|
6
dScripts/02_server/Map/FV/Racing/FvRacingColumns.h
Normal file
6
dScripts/02_server/Map/FV/Racing/FvRacingColumns.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRacingColumns : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
15
dScripts/02_server/Map/FV/Racing/RaceFireballs.cpp
Normal file
15
dScripts/02_server/Map/FV/Racing/RaceFireballs.cpp
Normal 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));
|
||||
|
||||
}
|
||||
}
|
9
dScripts/02_server/Map/FV/Racing/RaceFireballs.h
Normal file
9
dScripts/02_server/Map/FV/Racing/RaceFireballs.h
Normal 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;
|
||||
};
|
@@ -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");
|
||||
}
|
||||
}
|
@@ -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;
|
||||
};
|
Reference in New Issue
Block a user