fix: add missing racing scripts (#1708)

This commit is contained in:
David Markowitz 2025-01-01 10:54:21 -08:00 committed by GitHub
parent 94e7cfc211
commit 900c9b6abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 193 additions and 4 deletions

View File

@ -84,6 +84,10 @@ dpEntity* PhysicsComponent::CreatePhysicsEntity(eReplicaComponentType type) {
} else if (info->physicsAsset == "env\\env_won_fv_gas-blocking-volume.hkx") { } else if (info->physicsAsset == "env\\env_won_fv_gas-blocking-volume.hkx") {
toReturn = new dpEntity(m_Parent->GetObjectID(), 390.496826f, 111.467964f, 600.821534f, true); toReturn = new dpEntity(m_Parent->GetObjectID(), 390.496826f, 111.467964f, 600.821534f, true);
m_Position.y -= (111.467964f * m_Parent->GetDefaultScale()) / 2; m_Position.y -= (111.467964f * m_Parent->GetDefaultScale()) / 2;
} else if (info->physicsAsset == "env\\GFTrack_DeathVolume1_CaveExit.hkx") {
toReturn = new dpEntity(m_Parent->GetObjectID(), 112.416870f, 50.363434f, 87.679268f);
} else if (info->physicsAsset == "env\\GFTrack_DeathVolume2_RoadGaps.hkx") {
toReturn = new dpEntity(m_Parent->GetObjectID(), 48.386536f, 50.363434f, 259.361755f);
} else { } else {
// LOG_DEBUG("This one is supposed to have %s", info->physicsAsset.c_str()); // LOG_DEBUG("This one is supposed to have %s", info->physicsAsset.c_str());

View File

@ -285,7 +285,7 @@ void RacingControlComponent::OnRacingClientReady(Entity* player) {
Game::entityManager->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
} }
void RacingControlComponent::OnRequestDie(Entity* player) { void RacingControlComponent::OnRequestDie(Entity* player, const std::u16string& deathType) {
// Sent by the client when they collide with something which should smash // Sent by the client when they collide with something which should smash
// them. // them.
@ -301,8 +301,9 @@ void RacingControlComponent::OnRequestDie(Entity* player) {
if (!racingPlayer.noSmashOnReload) { if (!racingPlayer.noSmashOnReload) {
racingPlayer.smashedTimes++; racingPlayer.smashedTimes++;
LOG("Death type %s", GeneralUtils::UTF16ToWTF8(deathType).c_str());
GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true, GameMessages::SendDie(vehicle, vehicle->GetObjectID(), LWOOBJID_EMPTY, true,
eKillType::VIOLENT, u"", 0, 0, 90.0f, false, true, 0); eKillType::VIOLENT, deathType, 0, 0, 90.0f, false, true, 0);
auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>(); auto* destroyableComponent = vehicle->GetComponent<DestroyableComponent>();
uint32_t respawnImagination = 0; uint32_t respawnImagination = 0;

View File

@ -135,7 +135,7 @@ public:
/** /**
* Invoked when the client says it should be smashed. * Invoked when the client says it should be smashed.
*/ */
void OnRequestDie(Entity* player); void OnRequestDie(Entity* player, const std::u16string& deathType = u"");
/** /**
* Invoked when the player has finished respawning. * Invoked when the player has finished respawning.

View File

@ -294,6 +294,9 @@
#include "ShardArmor.h" #include "ShardArmor.h"
#include "TeslaPack.h" #include "TeslaPack.h"
#include "StunImmunity.h" #include "StunImmunity.h"
#include "GfRaceServer.h"
#include "FvRaceServer.h"
#include "VehicleDeathTriggerWaterServer.h"
// Survival scripts // Survival scripts
#include "AgSurvivalStromling.h" #include "AgSurvivalStromling.h"
@ -694,6 +697,9 @@ namespace {
{"scripts\\ai\\AG\\L_AG_SPIDER_BOSS_MESSAGE.lua", []() {return new AgSpiderBossMessage();}}, {"scripts\\ai\\AG\\L_AG_SPIDER_BOSS_MESSAGE.lua", []() {return new AgSpiderBossMessage();}},
{"scripts\\ai\\GF\\L_GF_RACE_INSTANCER.lua", []() {return new GfRaceInstancer();}}, {"scripts\\ai\\GF\\L_GF_RACE_INSTANCER.lua", []() {return new GfRaceInstancer();}},
{"scripts\\ai\\RACING\\TRACK_NS\\NS_RACE_SERVER.lua", []() {return new NsRaceServer();}}, {"scripts\\ai\\RACING\\TRACK_NS\\NS_RACE_SERVER.lua", []() {return new NsRaceServer();}},
{"scripts\\ai\\RACING\\TRACK_GF\\GF_RACE_SERVER.lua", []() {return new GfRaceServer();}},
{"scripts\\ai\\RACING\\TRACK_FV\\FV_RACE_SERVER.lua", []() {return new FvRaceServer();}},
{"scripts\\ai\\RACING\\OBJECTS\\VEHICLE_DEATH_TRIGGER_WATER_SERVER.lua", []() {return new VehicleDeathTriggerWaterServer();}},
}; };

View File

@ -13,6 +13,18 @@ foreach(file ${DSCRIPTS_SOURCES_AI_RACING_TRACK_NS})
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "TRACK_NS/${file}") set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "TRACK_NS/${file}")
endforeach() endforeach()
add_subdirectory(TRACK_GF)
foreach(file ${DSCRIPTS_SOURCES_AI_RACING_TRACK_GF})
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "TRACK_GF/${file}")
endforeach()
add_subdirectory(TRACK_FV)
foreach(file ${DSCRIPTS_SOURCES_AI_RACING_TRACK_FV})
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "TRACK_FV/${file}")
endforeach()
add_library(dScriptsAiRacing OBJECT ${DSCRIPTS_SOURCES_AI_RACING}) add_library(dScriptsAiRacing OBJECT ${DSCRIPTS_SOURCES_AI_RACING})
target_include_directories(dScriptsAiRacing PUBLIC "." "OBJECTS" "TRACK_NS") target_include_directories(dScriptsAiRacing PUBLIC "." "OBJECTS" "TRACK_NS" "TRACK_GF" "TRACK_FV")
target_precompile_headers(dScriptsAiRacing REUSE_FROM dScriptsBase) target_precompile_headers(dScriptsAiRacing REUSE_FROM dScriptsBase)

View File

@ -7,4 +7,5 @@ set(DSCRIPTS_SOURCES_AI_RACING_OBJECTS
"FvRacePillarDServer.cpp" "FvRacePillarDServer.cpp"
"FvRaceSmashEggImagineServer.cpp" "FvRaceSmashEggImagineServer.cpp"
"RaceSmashServer.cpp" "RaceSmashServer.cpp"
"VehicleDeathTriggerWaterServer.cpp"
PARENT_SCOPE) PARENT_SCOPE)

View File

@ -0,0 +1,16 @@
#include "VehicleDeathTriggerWaterServer.h"
#include "PossessorComponent.h"
#include "RacingControlComponent.h"
void VehicleDeathTriggerWaterServer::OnCollisionPhantom(Entity* self, Entity* target) {
if (target->IsPlayer() && !target->GetIsDead()) {
const std::vector<Entity*> racingControllers = Game::entityManager->GetEntitiesByComponent(RacingControlComponent::ComponentType);
for (auto* const racingController : racingControllers) {
auto* racingControlComponent = racingController->GetComponent<RacingControlComponent>();
if (racingControlComponent) {
racingControlComponent->OnRequestDie(target, u"death_water");
}
}
}
}

View File

@ -0,0 +1,11 @@
#ifndef VEHICLEDEATHTRIGGERWATERSERVER_H
#define VEHICLEDEATHTRIGGERWATERSERVER_H
#include "CppScripts.h"
class VehicleDeathTriggerWaterServer : public CppScripts::Script {
public:
void OnCollisionPhantom(Entity* self, Entity* target) override;
};
#endif //!VEHICLEDEATHTRIGGERWATERSERVER_H

View File

@ -0,0 +1,3 @@
set(DSCRIPTS_SOURCES_AI_RACING_TRACK_FV
"FvRaceServer.cpp"
PARENT_SCOPE)

View File

@ -0,0 +1,55 @@
#include "FvRaceServer.h"
#include "RacingControlComponent.h"
#include "Entity.h"
using std::unique_ptr;
using std::make_unique;
void FvRaceServer::OnStartup(Entity* self) {
GameMessages::ConfigureRacingControl config;
auto& raceSet = config.racingSettings;
raceSet.push_back(make_unique<LDFData<std::u16string>>(u"GameType", u"Racing"));
raceSet.push_back(make_unique<LDFData<std::u16string>>(u"GameState", u"Starting"));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Number_Of_PlayersPerTeam", 6));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Minimum_Players_to_Start", 2));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Minimum_Players_for_Group_Achievements", 2));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Car_Object", 7703));
raceSet.push_back(make_unique<LDFData<std::u16string>>(u"Race_PathName", u"MainPath"));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Current_Lap", 1));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Number_of_Laps", 3));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"activityID", 54));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_1", 100));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_2", 90));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_3", 80));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_4", 70));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_5", 60));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_6", 50));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_1", 15));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_2", 25));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_3", 50));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_4", 85));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_5", 90));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_6", 100));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Number_of_Spawn_Groups", 1));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Spawners", 4847));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Spawners", 4848));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Flag", 4850));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Flag", 4851));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Point", 4846));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Point", 4845));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Mark", 4844));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Mark", 4843));
const std::vector<Entity*> racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
for (auto* const racingController : racingControllers) {
auto* racingComponent = racingController->GetComponent<RacingControlComponent>();
if (racingComponent) racingComponent->MsgConfigureRacingControl(config);
}
}

View File

@ -0,0 +1,11 @@
#ifndef FVRACESERVER_H
#define FVRACESERVER_H
#include "RaceImaginationServer.h"
class FvRaceServer : public RaceImaginationServer {
public:
void OnStartup(Entity* self) override;
};
#endif //!FVRACESERVER_H

View File

@ -0,0 +1,3 @@
set(DSCRIPTS_SOURCES_AI_RACING_TRACK_GF
"GfRaceServer.cpp"
PARENT_SCOPE)

View File

@ -0,0 +1,55 @@
#include "GfRaceServer.h"
#include "RacingControlComponent.h"
#include "Entity.h"
using std::unique_ptr;
using std::make_unique;
void GfRaceServer::OnStartup(Entity* self) {
GameMessages::ConfigureRacingControl config;
auto& raceSet = config.racingSettings;
raceSet.push_back(make_unique<LDFData<std::u16string>>(u"GameType", u"Racing"));
raceSet.push_back(make_unique<LDFData<std::u16string>>(u"GameState", u"Starting"));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Number_Of_PlayersPerTeam", 6));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Minimum_Players_to_Start", 2));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Minimum_Players_for_Group_Achievements", 2));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Car_Object", 7703));
raceSet.push_back(make_unique<LDFData<std::u16string>>(u"Race_PathName", u"MainPath"));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Current_Lap", 1));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Number_of_Laps", 3));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"activityID", 39));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_1", 100));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_2", 90));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_3", 80));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_4", 70));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_5", 60));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Place_6", 50));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_1", 15));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_2", 25));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_3", 50));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_4", 85));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_5", 90));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Num_of_Players_6", 100));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Number_of_Spawn_Groups", 1));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Spawners", 4847));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Spawners", 4848));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Flag", 4850));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Flag", 4851));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Point", 4846));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Point", 4845));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Red_Mark", 4844));
raceSet.push_back(make_unique<LDFData<int32_t>>(u"Blue_Mark", 4843));
const std::vector<Entity*> racingControllers = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::RACING_CONTROL);
for (auto* const racingController : racingControllers) {
auto* racingComponent = racingController->GetComponent<RacingControlComponent>();
if (racingComponent) racingComponent->MsgConfigureRacingControl(config);
}
}

View File

@ -0,0 +1,11 @@
#ifndef GFRACESERVER_H
#define GFRACESERVER_H
#include "RaceImaginationServer.h"
class GfRaceServer : public RaceImaginationServer {
public:
void OnStartup(Entity* self) override;
};
#endif //!GFRACESERVER_H