mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +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;
|
||||
};
|
@@ -154,6 +154,11 @@
|
||||
#include "FvBounceOverWall.h"
|
||||
#include "FvFong.h"
|
||||
#include "FvMaelstromGeyser.h"
|
||||
#include "FvRaceDragon.h"
|
||||
#include "FvRacePillarABCServer.h"
|
||||
#include "FvRacePillarDServer.h"
|
||||
#include "RaceFireballs.h"
|
||||
#include "RaceShipLapColumnsServer.h"
|
||||
|
||||
// FB Scripts
|
||||
#include "AgJetEffectServer.h"
|
||||
@@ -179,6 +184,7 @@
|
||||
#include "RaceMaelstromGeiser.h"
|
||||
#include "FvRaceSmashEggImagineServer.h"
|
||||
#include "RaceSmashServer.h"
|
||||
#include "FvRacingColumns.h"
|
||||
|
||||
// NT Scripts
|
||||
#include "NtSentinelWalkwayServer.h"
|
||||
@@ -622,9 +628,25 @@ CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::strin
|
||||
script = new FvBounceOverWall();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\FV\\L_NPC_FONG.lua")
|
||||
script = new FvFong();
|
||||
else if (scriptName == "scripts\\ai\\FV\\L_FV_MAELSTROM_GEYSER.lua") {
|
||||
else if (scriptName == "scripts\\ai\\FV\\L_FV_MAELSTROM_GEYSER.lua")
|
||||
script = new FvMaelstromGeyser();
|
||||
}
|
||||
else if (scriptName == "scripts\\02_server\\Map\\FV\\Racing\\RACE_SHIP_LAP_COLUMNS_SERVER.lua")
|
||||
script = new RaceShipLapColumnsServer();
|
||||
|
||||
// yes we know the lap numbers dont match the file name or anim. thats what they desgined it as.
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_DRAGON_LAP1_SERVER.lua")
|
||||
script = new FvRaceDragon("lap_01", 2);
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_DRAGON_LAP2_SERVER.lua")
|
||||
script = new FvRaceDragon("lap_02", 0);
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_DRAGON_LAP3_SERVER.lua")
|
||||
script = new FvRaceDragon("lap_03", 1);
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_PILLAR_ABC_SERVER.lua")
|
||||
script = new FvRacePillarABCServer();
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_PILLAR_D_SERVER.lua")
|
||||
script = new FvRacePillarDServer();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\FV\\Racing\\RACE_FIREBALLS.lua")
|
||||
script = new RaceFireballs();
|
||||
|
||||
|
||||
//Misc:
|
||||
if (scriptName == "scripts\\02_server\\Map\\General\\L_EXPLODING_ASSET.lua")
|
||||
@@ -661,6 +683,8 @@ CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::strin
|
||||
script = new RaceMaelstromGeiser();
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_SMASH_EGG_IMAGINE_SERVER.lua")
|
||||
script = new FvRaceSmashEggImagineServer();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\FV\\Racing\\FV_RACING_COLUMNS.lua")
|
||||
script = new FvRacingColumns();
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\RACE_SMASH_SERVER.lua")
|
||||
script = new RaceSmashServer();
|
||||
|
||||
|
@@ -1,6 +1,10 @@
|
||||
set(DSCRIPTS_SOURCES_AI_RACING_OBJECTS
|
||||
"RaceImagineCrateServer.cpp"
|
||||
"RaceImaginePowerup.cpp"
|
||||
"FvRaceDragon.cpp"
|
||||
"FvRacePillarServer.cpp"
|
||||
"FvRacePillarABCServer.cpp"
|
||||
"FvRacePillarDServer.cpp"
|
||||
"FvRaceSmashEggImagineServer.cpp"
|
||||
"RaceSmashServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
30
dScripts/ai/RACING/OBJECTS/FvRaceDragon.cpp
Normal file
30
dScripts/ai/RACING/OBJECTS/FvRaceDragon.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "FvRaceDragon.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "RacingControlComponent.h"
|
||||
|
||||
void FvRaceDragon::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 != m_Lap) return;
|
||||
|
||||
const auto dragons = Game::entityManager->GetEntitiesInGroup("dragon");
|
||||
for (const auto& dragon : dragons) {
|
||||
if (!dragon || dragon->GetLOT() != this->m_Dragon) continue;
|
||||
|
||||
auto* renderComponent = dragon->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) continue;
|
||||
|
||||
renderComponent->PlayAnimation(dragon, m_LapAnimName);
|
||||
|
||||
}
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
15
dScripts/ai/RACING/OBJECTS/FvRaceDragon.h
Normal file
15
dScripts/ai/RACING/OBJECTS/FvRaceDragon.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
class FvRaceDragon : public CppScripts::Script {
|
||||
public:
|
||||
FvRaceDragon(const std::string_view lapAnimName, const int32_t lap) : m_LapAnimName(lapAnimName), m_Lap(lap) {}
|
||||
private:
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
const std::string m_LapAnimName;
|
||||
const int32_t m_Lap;
|
||||
const LOT m_Dragon = 11898;
|
||||
};
|
34
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.cpp
Normal file
34
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "FvRacePillarABCServer.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "RacingControlComponent.h"
|
||||
|
||||
void FvRacePillarABCServer::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 || player->lap != 1) return;
|
||||
|
||||
PlayAnimation("crumble", "pillars", m_PillarA);
|
||||
PlayAnimation("roar", "dragon", m_Dragon);
|
||||
|
||||
self->AddTimer("PillarBFall", 2.5f);
|
||||
self->AddTimer("PillarCFall", 3.7f);
|
||||
self->AddTimer("DeleteObject", 3.8f);
|
||||
}
|
||||
|
||||
void FvRacePillarABCServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "PillarBFall") {
|
||||
PlayAnimation("crumble", "pillars", m_PillarB);
|
||||
} else if (timerName == "PillarCFall") {
|
||||
PlayAnimation("crumble", "pillars", m_PillarC);
|
||||
} else if (timerName == "DeleteObject") {
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
13
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.h
Normal file
13
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "FvRacePillarServer.h"
|
||||
|
||||
class FvRacePillarABCServer : public FvRacePillarServer {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
const LOT m_PillarA = 11946;
|
||||
const LOT m_PillarB = 11947;
|
||||
const LOT m_PillarC = 11948;
|
||||
const LOT m_Dragon = 11898;
|
||||
};
|
21
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.cpp
Normal file
21
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "FvRacePillarDServer.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "RacingControlComponent.h"
|
||||
|
||||
void FvRacePillarDServer::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 == 2) {
|
||||
PlayAnimation("crumble", "pillars", m_PillarD);
|
||||
PlayAnimation("roar", "dragon", m_Dragon);
|
||||
}
|
||||
}
|
10
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.h
Normal file
10
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "FvRacePillarServer.h"
|
||||
|
||||
class FvRacePillarDServer : public FvRacePillarServer {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
private:
|
||||
const LOT m_PillarD = 11949;
|
||||
const LOT m_Dragon = 11898;
|
||||
};
|
15
dScripts/ai/RACING/OBJECTS/FvRacePillarServer.cpp
Normal file
15
dScripts/ai/RACING/OBJECTS/FvRacePillarServer.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "FvRacePillarServer.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void FvRacePillarServer::PlayAnimation(const std::string animName, const std::string group, const LOT lot) {
|
||||
const auto entities = Game::entityManager->GetEntitiesInGroup(group);
|
||||
for (const auto& entity : entities) {
|
||||
if (!entity || entity->GetLOT() != lot) continue;
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) continue;
|
||||
renderComponent->PlayAnimation(entity, animName);
|
||||
}
|
||||
}
|
12
dScripts/ai/RACING/OBJECTS/FvRacePillarServer.h
Normal file
12
dScripts/ai/RACING/OBJECTS/FvRacePillarServer.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef FVRACEPILLARSERVER__H
|
||||
#define FVRACEPILLARSERVER__H
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRacePillarServer : public virtual CppScripts::Script {
|
||||
protected:
|
||||
// Plays an animation on all entities in a group with a specific LOT
|
||||
void PlayAnimation(const std::string animName, const std::string group, const LOT lot);
|
||||
};
|
||||
|
||||
#endif // FVRACEPILLARSERVER__H
|
Reference in New Issue
Block a user