mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
rigid as heck
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING
|
||||
"RaceFireballs.cpp"
|
||||
"RaceMaelstromGeiser.cpp"
|
||||
"RaceShipLapColumnsServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
18
dScripts/02_server/Map/FV/Racing/RaceFireballs.cpp
Normal file
18
dScripts/02_server/Map/FV/Racing/RaceFireballs.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "RaceFireballs.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void RaceFireballs::OnStartup(Entity* self) {
|
||||
self->AddTimer("fire", GeneralUtils::GenerateRandomNumber<float>(3,10));
|
||||
}
|
||||
|
||||
void RaceFireballs::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "fire") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) {
|
||||
self->AddComponent<SkillComponent>();
|
||||
}
|
||||
skillComponent->CastSkill(894);
|
||||
self->AddTimer("fire", GeneralUtils::GenerateRandomNumber<float>(3,10));
|
||||
|
||||
}
|
||||
}
|
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,29 @@
|
||||
#include "RaceShipLapColumnsServer.h"
|
||||
|
||||
void RaceShipLapColumnsServer::OnStartup(Entity* self) {
|
||||
self->SetVar("Lap2Complete",false);
|
||||
self->SetVar("Lap3Complete",false);
|
||||
}
|
||||
|
||||
void RaceShipLapColumnsServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target) return;
|
||||
|
||||
const auto racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
|
||||
if (racingControllers.empty()) return;
|
||||
const auto* racingController = racingControllers.at(0);
|
||||
|
||||
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if(!player) return;
|
||||
|
||||
if (player->lap == 2 && self->GetVar<bool>("Lap2Complete")) {
|
||||
self->SetVar("Lap2Complete",true);
|
||||
const auto Lap2Column = Game::entityManager->GetEntitiesInGroup("Lap2Column").at(0);
|
||||
const auto Lap2Ramp = Game::entityManager->GetEntitiesInGroup("Lap2Ramp").at(0);
|
||||
} else if (player->lap == 3 && self->GetVar<bool>("Lap3Complete")) {
|
||||
self->SetVar("Lap3Complete",true);
|
||||
const auto Lap3Column = Game::entityManager->GetEntitiesInGroup("Lap3Column").at(0);
|
||||
const auto Lap3Ramp = Game::entityManager->GetEntitiesInGroup("Lap3Ramp").at(0);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class RaceMaelstromGeiser : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
};
|
@@ -154,6 +154,12 @@
|
||||
#include "FvBounceOverWall.h"
|
||||
#include "FvFong.h"
|
||||
#include "FvMaelstromGeyser.h"
|
||||
#include "FvRaceDragonLap1.h"
|
||||
#include "FvRaceDragonLap2.h"
|
||||
#include "FvRaceDragonLap3.h"
|
||||
#include "FvRacePillarABCServer.h"
|
||||
#include "FvRacePillarDServer.h"
|
||||
#include "RaceFireballs.h"
|
||||
|
||||
// FB Scripts
|
||||
#include "AgJetEffectServer.h"
|
||||
@@ -611,9 +617,21 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
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\\ai\\RACING\\OBJECTS\\FV_RACE_DRAGON_LAP1_SERVER.lua")
|
||||
script = new FvRaceDragonLap1();
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_DRAGON_LAP2_SERVER.lua")
|
||||
script = new FvRaceDragonLap2();
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\FV_RACE_DRAGON_LAP3_SERVER.lua")
|
||||
script = new FvRaceDragonLap3();
|
||||
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")
|
||||
|
@@ -1,6 +1,11 @@
|
||||
set(DSCRIPTS_SOURCES_AI_RACING_OBJECTS
|
||||
"RaceImagineCrateServer.cpp"
|
||||
"RaceImaginePowerup.cpp"
|
||||
"FvRaceDragonLap1.cpp"
|
||||
"FvRaceDragonLap2.cpp"
|
||||
"FvRaceDragonLap3.cpp"
|
||||
"FvRacePillarABCServer.cpp"
|
||||
"FvRacePillarDServer.cpp"
|
||||
"FvRaceSmashEggImagineServer.cpp"
|
||||
"RaceSmashServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
28
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap1.cpp
Normal file
28
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap1.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "FvRaceDragonLap1.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "RacingControlComponent.h"
|
||||
|
||||
void FvRaceDragonLap1::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target) return;
|
||||
|
||||
const auto racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
|
||||
if (racingControllers.empty()) return;
|
||||
const auto* racingController = racingControllers.at(0);
|
||||
|
||||
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if(!player) return;
|
||||
|
||||
if (player->lap == 3) {
|
||||
LOG("Lap1Script");
|
||||
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, "lap_01");
|
||||
}
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
||||
}
|
8
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap1.h
Normal file
8
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap1.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRaceDragonLap1 : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
private:
|
||||
LOT m_Dragon = 11898;
|
||||
};
|
28
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap2.cpp
Normal file
28
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap2.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "FvRaceDragonLap2.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "RacingControlComponent.h"
|
||||
|
||||
void FvRaceDragonLap2::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target) return;
|
||||
|
||||
const auto racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
|
||||
if (racingControllers.empty()) return;
|
||||
const auto* racingController = racingControllers.at(0);
|
||||
|
||||
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if(!player) return;
|
||||
|
||||
if (player->lap == 1) {
|
||||
LOG("Lap2Script");
|
||||
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, "lap_02");
|
||||
}
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
||||
}
|
8
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap2.h
Normal file
8
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap2.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRaceDragonLap2 : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
private:
|
||||
LOT m_Dragon = 11898;
|
||||
};
|
28
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap3.cpp
Normal file
28
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap3.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "FvRaceDragonLap3.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "RacingControlComponent.h"
|
||||
|
||||
void FvRaceDragonLap3::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target) return;
|
||||
|
||||
const auto racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
|
||||
if (racingControllers.empty()) return;
|
||||
const auto* racingController = racingControllers.at(0);
|
||||
|
||||
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if(!player) return;
|
||||
|
||||
if (player->lap == 2) {
|
||||
LOG("Lap3Script");
|
||||
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, "lap_03");
|
||||
}
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
||||
}
|
8
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap3.h
Normal file
8
dScripts/ai/RACING/OBJECTS/FvRaceDragonLap3.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRaceDragonLap3 : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
private:
|
||||
LOT m_Dragon = 11898;
|
||||
};
|
64
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.cpp
Normal file
64
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#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;
|
||||
const auto* racingController = racingControllers.at(0);
|
||||
|
||||
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if(!player) return;
|
||||
if (player->lap == 2){
|
||||
LOG("pillar abcScript");
|
||||
const auto pillars = Game::entityManager->GetEntitiesInGroup("pillars");
|
||||
for (const auto &pillar : pillars){
|
||||
if (!pillar || pillar->GetLOT() != this->m_PillarA) continue;
|
||||
auto* renderComponent = pillar->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) continue;
|
||||
renderComponent->PlayAnimation(pillar, "crumble");
|
||||
}
|
||||
|
||||
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, "roar");
|
||||
}
|
||||
self->AddTimer("PillarBFall", 2.5);
|
||||
self->AddTimer("PillarCFall", 3.7);
|
||||
self->AddTimer("DeleteObject", 3.8);
|
||||
}
|
||||
}
|
||||
|
||||
void FvRacePillarABCServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "PillarBFall"){
|
||||
LOG("pillar abcScriptbbbbbbbbbbbbbbbbbb");
|
||||
|
||||
const auto pillars = Game::entityManager->GetEntitiesInGroup("pillars");
|
||||
for (const auto &pillar : pillars){
|
||||
if (!pillar || pillar->GetLOT() != this->m_PillarB) continue;
|
||||
auto* renderComponent = pillar->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) continue;
|
||||
renderComponent->PlayAnimation(pillar, "crumble");
|
||||
}
|
||||
} else if (timerName == "PillarCFall") {
|
||||
LOG("pillar abcScriptcccccccccccccccccccccc");
|
||||
|
||||
const auto pillars = Game::entityManager->GetEntitiesInGroup("pillars");
|
||||
for (const auto &pillar : pillars){
|
||||
if (!pillar || pillar->GetLOT() != this->m_PillarC) continue;
|
||||
auto* renderComponent = pillar->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) continue;
|
||||
renderComponent->PlayAnimation(pillar, "crumble");
|
||||
}
|
||||
} else if (timerName == "DeleteObject") {
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
12
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.h
Normal file
12
dScripts/ai/RACING/OBJECTS/FvRacePillarABCServer.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRacePillarABCServer : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
LOT m_PillarA = 11946;
|
||||
LOT m_PillarB = 11947;
|
||||
LOT m_PillarC = 11949;
|
||||
LOT m_Dragon = 11898;
|
||||
};
|
36
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.cpp
Normal file
36
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#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;
|
||||
const auto* racingController = racingControllers.at(0);
|
||||
|
||||
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
|
||||
if (!racingControlComponent) return;
|
||||
const auto* player = racingControlComponent->GetPlayerData(target->GetObjectID());
|
||||
if(!player) return;
|
||||
if (player->lap == 3){
|
||||
LOG("pillar d, Script");
|
||||
|
||||
const auto pillars = Game::entityManager->GetEntitiesInGroup("pillars");
|
||||
for (const auto &pillar : pillars){
|
||||
if (!pillar || pillar->GetLOT() != this->m_PillarD) continue;
|
||||
auto* renderComponent = pillar->GetComponent<RenderComponent>();
|
||||
if (!renderComponent) continue;
|
||||
renderComponent->PlayAnimation(pillar, "crumble");
|
||||
}
|
||||
|
||||
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, "roar");
|
||||
}
|
||||
Game::entityManager->DestroyEntity(self);
|
||||
}
|
||||
}
|
9
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.h
Normal file
9
dScripts/ai/RACING/OBJECTS/FvRacePillarDServer.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvRacePillarDServer : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
private:
|
||||
LOT m_PillarD = 11949;
|
||||
LOT m_Dragon = 11898;
|
||||
};
|
Reference in New Issue
Block a user