rigid as heck

This commit is contained in:
Aaron Kimbre
2023-12-02 21:03:17 -06:00
parent 731b828c12
commit 4dce512d64
19 changed files with 675 additions and 16 deletions

View File

@@ -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)

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

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

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

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

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

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

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

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

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

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