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;
|
||||
};
|
Reference in New Issue
Block a user