mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-14 02:34:20 +00:00
Compare commits
14 Commits
v3.0.0
...
entity-cle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81b4f84d03 | ||
|
|
6ed6efa921 | ||
|
|
dcc9e023a6 | ||
|
|
8509ec8856 | ||
|
|
18295017c1 | ||
|
|
e8f011b830 | ||
|
|
a787673baf | ||
|
|
e869c0ad03 | ||
|
|
b2af3fa9d4 | ||
|
|
2560bb00da | ||
|
|
1ae21c423f | ||
|
|
0ae9eb4a96 | ||
|
|
fced6d753a | ||
|
|
15dc5feeb5 |
@@ -1,5 +1,5 @@
|
|||||||
PROJECT_VERSION_MAJOR=2
|
PROJECT_VERSION_MAJOR=3
|
||||||
PROJECT_VERSION_MINOR=3
|
PROJECT_VERSION_MINOR=0
|
||||||
PROJECT_VERSION_PATCH=0
|
PROJECT_VERSION_PATCH=0
|
||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -24,13 +24,14 @@ Darkflame Universe is a server emulator and does not distribute any LEGO® Unive
|
|||||||
Warning: WSL version 1 does NOT support using sqlite as a database due to how it handles filesystem synchronization.
|
Warning: WSL version 1 does NOT support using sqlite as a database due to how it handles filesystem synchronization.
|
||||||
You must use Version 2 if you must run the server under WSL. Not doing so will result in save data loss.
|
You must use Version 2 if you must run the server under WSL. Not doing so will result in save data loss.
|
||||||
* Single player installs now no longer require building the server from source or installing development tools.
|
* Single player installs now no longer require building the server from source or installing development tools.
|
||||||
* Download the [latest release](https://github.com/DarkflameUniverse/DarkflameServer/releases) and extract the files into a folder inside your client.
|
* Download the [latest windows release](https://github.com/DarkflameUniverse/DarkflameServer/releases) (or whichever release you need) and extract the files into a folder inside your client. Note that this setup is expecting that when double clicking the folder that you put in the same folder as `legouniverse.exe`, the file `MasterServer.exe` is in there.
|
||||||
* You should be able to see the folder with the server executables in the same folder as `legouniverse.exe`.
|
* You should be able to see the folder with the server files in the same folder as `legouniverse.exe`.
|
||||||
* Open `sharedconfig.ini` and find the line that says `client_location` and put `..` after it so the line reads `client_location=..`.
|
* Go into the server files folder and open `sharedconfig.ini`. Find the line that says `client_location` and put `..` after it so the line reads `client_location=..`.
|
||||||
* To run the server, double-click `MasterServer.exe`.
|
* To run the server, double-click `MasterServer.exe`.
|
||||||
* You will be asked to create an account the first time you run the server.
|
* You will be asked to create an account the first time you run the server. After you have created the account, the server will shutdown and need to be restarted.
|
||||||
|
* To connect to the server, either delete the file `boot.cfg` which is found in your LEGO Universe client, rename the file `boot.cfg` to something else or follow the steps [here](#allowing-a-user-to-connect-to-your-server) if you wish to keep the file.
|
||||||
* When shutting down the server, it is highly recommended to click the `MasterServer.exe` window and hold `ctrl` while pressing `c` to stop the server.
|
* When shutting down the server, it is highly recommended to click the `MasterServer.exe` window and hold `ctrl` while pressing `c` to stop the server.
|
||||||
* We are working on a way to make it so when you close the game, the server saves automatically alongside when you open the game, the server starts automatically.
|
* We are working on a way to make it so when you close the game, the server stops automatically alongside when you open the game, the server starts automatically.
|
||||||
|
|
||||||
<font size="32">**If you are not planning on hosting a server for others, working in the codebase or wanting to use MariaDB for a database, you can stop reading here.**</font>
|
<font size="32">**If you are not planning on hosting a server for others, working in the codebase or wanting to use MariaDB for a database, you can stop reading here.**</font>
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,25 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
//For reading null-terminated strings
|
//For reading null-terminated strings
|
||||||
std::string BinaryIO::ReadString(std::istream& instream) {
|
template<typename StringType>
|
||||||
std::string toReturn;
|
StringType ReadString(std::istream& instream) {
|
||||||
char buffer;
|
StringType toReturn{};
|
||||||
|
typename StringType::value_type buffer{};
|
||||||
|
|
||||||
BinaryIO::BinaryRead(instream, buffer);
|
BinaryIO::BinaryRead(instream, buffer);
|
||||||
|
|
||||||
while (buffer != 0x00) {
|
while (buffer != 0x00) {
|
||||||
toReturn += buffer;
|
toReturn += buffer;
|
||||||
BinaryRead(instream, buffer);
|
BinaryIO::BinaryRead(instream, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string BinaryIO::ReadString(std::istream& instream) {
|
||||||
|
return ::ReadString<std::string>(instream);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::u8string BinaryIO::ReadU8String(std::istream& instream) {
|
||||||
|
return ::ReadString<std::u8string>(instream);
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ namespace BinaryIO {
|
|||||||
|
|
||||||
std::string ReadString(std::istream& instream);
|
std::string ReadString(std::istream& instream);
|
||||||
|
|
||||||
|
std::u8string ReadU8String(std::istream& instream);
|
||||||
|
|
||||||
inline bool DoesFileExist(const std::string& name) {
|
inline bool DoesFileExist(const std::string& name) {
|
||||||
std::ifstream f(name.c_str());
|
std::ifstream f(name.c_str());
|
||||||
return f.good();
|
return f.good();
|
||||||
|
|||||||
@@ -65,13 +65,14 @@ int64_t FdbToSqlite::Convert::ReadInt64(std::istream& cdClientBuffer) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cdclient is encoded in latin1
|
||||||
std::string FdbToSqlite::Convert::ReadString(std::istream& cdClientBuffer) {
|
std::string FdbToSqlite::Convert::ReadString(std::istream& cdClientBuffer) {
|
||||||
int32_t prevPosition = SeekPointer(cdClientBuffer);
|
int32_t prevPosition = SeekPointer(cdClientBuffer);
|
||||||
|
|
||||||
auto readString = BinaryIO::ReadString(cdClientBuffer);
|
const auto readString = BinaryIO::ReadU8String(cdClientBuffer);
|
||||||
|
|
||||||
cdClientBuffer.seekg(prevPosition);
|
cdClientBuffer.seekg(prevPosition);
|
||||||
return readString;
|
return GeneralUtils::Latin1ToWTF8(readString);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t FdbToSqlite::Convert::SeekPointer(std::istream& cdClientBuffer) {
|
int32_t FdbToSqlite::Convert::SeekPointer(std::istream& cdClientBuffer) {
|
||||||
|
|||||||
@@ -167,17 +167,19 @@ std::u16string GeneralUtils::ASCIIToUTF16(const std::string_view string, const s
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Converts a (potentially-ill-formed) UTF-16 string to UTF-8
|
|
||||||
|
//! Converts a (potentially-ill-formed) Latin1 string to UTF-8
|
||||||
//! See: <http://simonsapin.github.io/wtf-8/#decoding-ill-formed-utf-16>
|
//! See: <http://simonsapin.github.io/wtf-8/#decoding-ill-formed-utf-16>
|
||||||
std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const size_t size) {
|
template<typename StringType>
|
||||||
|
std::string ToWTF8(const StringType string, const size_t size) {
|
||||||
const size_t newSize = MinSize(size, string);
|
const size_t newSize = MinSize(size, string);
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret.reserve(newSize);
|
ret.reserve(newSize);
|
||||||
|
|
||||||
for (size_t i = 0; i < newSize; ++i) {
|
for (size_t i = 0; i < newSize; ++i) {
|
||||||
const char16_t u = string[i];
|
const auto u = string[i];
|
||||||
if (IsLeadSurrogate(u) && (i + 1) < newSize) {
|
if (IsLeadSurrogate(u) && (i + 1) < newSize) {
|
||||||
const char16_t next = string[i + 1];
|
const auto next = string[i + 1];
|
||||||
if (IsTrailSurrogate(next)) {
|
if (IsTrailSurrogate(next)) {
|
||||||
i += 1;
|
i += 1;
|
||||||
const char32_t cp = 0x10000
|
const char32_t cp = 0x10000
|
||||||
@@ -194,6 +196,13 @@ std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const si
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
std::string GeneralUtils::Latin1ToWTF8(const std::u8string_view string, const size_t size) {
|
||||||
|
return ToWTF8(string, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const size_t size) {
|
||||||
|
return ToWTF8(string, size);
|
||||||
|
}
|
||||||
|
|
||||||
bool GeneralUtils::CaseInsensitiveStringCompare(const std::string_view a, const std::string_view b) {
|
bool GeneralUtils::CaseInsensitiveStringCompare(const std::string_view a, const std::string_view b) {
|
||||||
return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); });
|
return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); });
|
||||||
@@ -291,11 +300,12 @@ std::u16string GeneralUtils::ReadWString(RakNet::BitStream& inStream) {
|
|||||||
|
|
||||||
std::vector<std::string> GeneralUtils::GetSqlFileNamesFromFolder(const std::string_view folder) {
|
std::vector<std::string> GeneralUtils::GetSqlFileNamesFromFolder(const std::string_view folder) {
|
||||||
// Because we dont know how large the initial number before the first _ is we need to make it a map like so.
|
// Because we dont know how large the initial number before the first _ is we need to make it a map like so.
|
||||||
std::map<uint32_t, std::string> filenames{};
|
std::map<uint32_t, std::string> filenames{};
|
||||||
for (const auto& t : std::filesystem::directory_iterator(folder)) {
|
for (const auto& t : std::filesystem::directory_iterator(folder)) {
|
||||||
auto filename = t.path().filename().string();
|
if (t.is_directory() || t.is_symlink()) continue;
|
||||||
const auto index = std::stoi(GeneralUtils::SplitString(filename, '_').at(0));
|
auto filename = t.path().filename().string();
|
||||||
filenames.emplace(index, std::move(filename));
|
const auto index = std::stoi(GeneralUtils::SplitString(filename, '_').at(0));
|
||||||
|
filenames.emplace(index, std::move(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now sort the map by the oldest migration.
|
// Now sort the map by the oldest migration.
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ namespace GeneralUtils {
|
|||||||
bool _NextUTF8Char(std::string_view& slice, uint32_t& out);
|
bool _NextUTF8Char(std::string_view& slice, uint32_t& out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Converts a Latin1 string to a UTF-8 string
|
||||||
|
/*!
|
||||||
|
\param string The string to convert
|
||||||
|
\param size A size to trim the string to. Default is SIZE_MAX (No trimming)
|
||||||
|
\return An UTF-8 representation of the string
|
||||||
|
*/
|
||||||
|
std::string Latin1ToWTF8(const std::u8string_view string, const size_t size = SIZE_MAX);
|
||||||
|
|
||||||
//! Converts a UTF-16 string to a UTF-8 string
|
//! Converts a UTF-16 string to a UTF-8 string
|
||||||
/*!
|
/*!
|
||||||
\param string The string to convert
|
\param string The string to convert
|
||||||
|
|||||||
@@ -1253,6 +1253,7 @@ namespace MessageType {
|
|||||||
VEHICLE_NOTIFY_HIT_EXPLODER = 1385,
|
VEHICLE_NOTIFY_HIT_EXPLODER = 1385,
|
||||||
CHECK_NEAREST_ROCKET_LAUNCH_PRE_CONDITIONS = 1386,
|
CHECK_NEAREST_ROCKET_LAUNCH_PRE_CONDITIONS = 1386,
|
||||||
REQUEST_NEAREST_ROCKET_LAUNCH_PRE_CONDITIONS = 1387,
|
REQUEST_NEAREST_ROCKET_LAUNCH_PRE_CONDITIONS = 1387,
|
||||||
|
CONFIGURE_RACING_CONTROL = 1388,
|
||||||
CONFIGURE_RACING_CONTROL_CLIENT = 1389,
|
CONFIGURE_RACING_CONTROL_CLIENT = 1389,
|
||||||
NOTIFY_RACING_CLIENT = 1390,
|
NOTIFY_RACING_CLIENT = 1390,
|
||||||
RACING_PLAYER_HACK_CAR = 1391,
|
RACING_PLAYER_HACK_CAR = 1391,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "dPlatforms.h"
|
#include "dPlatforms.h"
|
||||||
|
#include "BinaryPathFinder.h"
|
||||||
|
|
||||||
// Static Variables
|
// Static Variables
|
||||||
|
|
||||||
@@ -17,7 +18,14 @@ namespace {
|
|||||||
void SQLiteDatabase::Connect() {
|
void SQLiteDatabase::Connect() {
|
||||||
LOG("Using SQLite database");
|
LOG("Using SQLite database");
|
||||||
con = new CppSQLite3DB();
|
con = new CppSQLite3DB();
|
||||||
con->open(Game::config->GetValue("sqlite_database_path").c_str());
|
const auto path = BinaryPathFinder::GetBinaryDir() / Game::config->GetValue("sqlite_database_path");
|
||||||
|
|
||||||
|
if (!std::filesystem::exists(path)) {
|
||||||
|
LOG("Creating sqlite path %s", path.string().c_str());
|
||||||
|
std::filesystem::create_directories(path.parent_path());
|
||||||
|
}
|
||||||
|
|
||||||
|
con->open(path.string().c_str());
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
|
|
||||||
// Make sure wal is enabled for the database.
|
// Make sure wal is enabled for the database.
|
||||||
|
|||||||
@@ -1378,7 +1378,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!other->GetIsDead()) {
|
if (!other->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
if (GetComponent<BaseCombatAIComponent>() != nullptr) {
|
if (GetComponent<BaseCombatAIComponent>() != nullptr) {
|
||||||
const auto index = std::find(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), otherEntity);
|
const auto index = std::find(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), otherEntity);
|
||||||
|
|
||||||
@@ -1606,13 +1606,6 @@ void Entity::AddQuickBuildCompleteCallback(const std::function<void(Entity* user
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::GetIsDead() const {
|
|
||||||
DestroyableComponent* dest = GetComponent<DestroyableComponent>();
|
|
||||||
if (dest && dest->GetArmor() == 0 && dest->GetHealth() == 0) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Entity::AddLootItem(const Loot::Info& info) {
|
void Entity::AddLootItem(const Loot::Info& info) {
|
||||||
if (!IsPlayer()) return;
|
if (!IsPlayer()) return;
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ public:
|
|||||||
|
|
||||||
const std::vector<LDFBaseData*>& GetNetworkSettings() const { return m_NetworkSettings; }
|
const std::vector<LDFBaseData*>& GetNetworkSettings() const { return m_NetworkSettings; }
|
||||||
|
|
||||||
bool GetIsDead() const;
|
|
||||||
|
|
||||||
bool GetPlayerReadyForUpdates() const { return m_PlayerIsReadyForUpdates; }
|
bool GetPlayerReadyForUpdates() const { return m_PlayerIsReadyForUpdates; }
|
||||||
|
|
||||||
bool GetIsGhostingCandidate() const;
|
bool GetIsGhostingCandidate() const;
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
|||||||
|
|
||||||
bitStream.Write(armorDamageDealt);
|
bitStream.Write(armorDamageDealt);
|
||||||
bitStream.Write(healthDamageDealt);
|
bitStream.Write(healthDamageDealt);
|
||||||
bitStream.Write(targetEntity->GetIsDead());
|
bitStream.Write(targetEntity->GetComponent<DestroyableComponent>()->GetIsDead());
|
||||||
}
|
}
|
||||||
|
|
||||||
bitStream.Write(successState);
|
bitStream.Write(successState);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitS
|
|||||||
for (auto validTarget : validTargets) {
|
for (auto validTarget : validTargets) {
|
||||||
if (targets.size() >= this->m_maxTargets) break;
|
if (targets.size() >= this->m_maxTargets) break;
|
||||||
if (std::find(targets.begin(), targets.end(), validTarget) != targets.end()) continue;
|
if (std::find(targets.begin(), targets.end(), validTarget) != targets.end()) continue;
|
||||||
if (validTarget->GetIsDead()) continue;
|
if (validTarget->GetComponent<DestroyableComponent>()->GetIsDead()) continue;
|
||||||
|
|
||||||
const auto targetPos = validTarget->GetPosition();
|
const auto targetPos = validTarget->GetPosition();
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
|||||||
m_SoftTimer -= deltaTime;
|
m_SoftTimer -= deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Disabled || m_Parent->GetIsDead())
|
if (m_Disabled || m_Parent->GetComponent<DestroyableComponent>()->GetIsDead())
|
||||||
return;
|
return;
|
||||||
bool stunnedThisFrame = m_Stunned;
|
bool stunnedThisFrame = m_Stunned;
|
||||||
CalculateCombat(deltaTime); // Putting this here for now
|
CalculateCombat(deltaTime); // Putting this here for now
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ set(DGAME_DCOMPONENTS_SOURCES
|
|||||||
"BuildBorderComponent.cpp"
|
"BuildBorderComponent.cpp"
|
||||||
"CharacterComponent.cpp"
|
"CharacterComponent.cpp"
|
||||||
"CollectibleComponent.cpp"
|
"CollectibleComponent.cpp"
|
||||||
"Component.cpp"
|
|
||||||
"ControllablePhysicsComponent.cpp"
|
"ControllablePhysicsComponent.cpp"
|
||||||
"DestroyableComponent.cpp"
|
"DestroyableComponent.cpp"
|
||||||
"DonationVendorComponent.cpp"
|
"DonationVendorComponent.cpp"
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
#include "Component.h"
|
|
||||||
|
|
||||||
|
|
||||||
Component::Component(Entity* parent) {
|
|
||||||
m_Parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
Component::~Component() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity* Component::GetParent() const {
|
|
||||||
return m_Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Component::Update(float deltaTime) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Component::OnUse(Entity* originator) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Component::UpdateXml(tinyxml2::XMLDocument& doc) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Component::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Component::Serialize(RakNet::BitStream& outBitStream, bool isConstruction) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "tinyxml2.h"
|
namespace tinyxml2 {
|
||||||
|
class XMLDocument;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace RakNet {
|
||||||
|
class BitStream;
|
||||||
|
}
|
||||||
|
|
||||||
class Entity;
|
class Entity;
|
||||||
|
|
||||||
@@ -9,40 +15,40 @@ class Entity;
|
|||||||
*/
|
*/
|
||||||
class Component {
|
class Component {
|
||||||
public:
|
public:
|
||||||
Component(Entity* parent);
|
Component(Entity* parent) : m_Parent{ parent } {}
|
||||||
virtual ~Component();
|
virtual ~Component() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the owner of this component
|
* Gets the owner of this component
|
||||||
* @return the owner of this component
|
* @return the owner of this component
|
||||||
*/
|
*/
|
||||||
Entity* GetParent() const;
|
Entity* GetParent() const { return m_Parent; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the component in the game loop
|
* Updates the component in the game loop
|
||||||
* @param deltaTime time passed since last update
|
* @param deltaTime time passed since last update
|
||||||
*/
|
*/
|
||||||
virtual void Update(float deltaTime);
|
virtual void Update(float deltaTime) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event called when this component is being used, e.g. when some entity interacted with it
|
* Event called when this component is being used, e.g. when some entity interacted with it
|
||||||
* @param originator
|
* @param originator
|
||||||
*/
|
*/
|
||||||
virtual void OnUse(Entity* originator);
|
virtual void OnUse(Entity* originator) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save data from this componennt to character XML
|
* Save data from this componennt to character XML
|
||||||
* @param doc the document to write data to
|
* @param doc the document to write data to
|
||||||
*/
|
*/
|
||||||
virtual void UpdateXml(tinyxml2::XMLDocument& doc);
|
virtual void UpdateXml(tinyxml2::XMLDocument& doc) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load base data for this component from character XML
|
* Load base data for this component from character XML
|
||||||
* @param doc the document to read data from
|
* @param doc the document to read data from
|
||||||
*/
|
*/
|
||||||
virtual void LoadFromXml(const tinyxml2::XMLDocument& doc);
|
virtual void LoadFromXml(const tinyxml2::XMLDocument& doc) {}
|
||||||
|
|
||||||
virtual void Serialize(RakNet::BitStream& outBitStream, bool isConstruction);
|
virtual void Serialize(RakNet::BitStream& outBitStream, bool isConstruction) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
#include "eUseItemResponse.h"
|
#include "eUseItemResponse.h"
|
||||||
#include "Mail.h"
|
#include "Mail.h"
|
||||||
|
#include "ProximityMonitorComponent.h"
|
||||||
|
|
||||||
#include "CDComponentsRegistryTable.h"
|
#include "CDComponentsRegistryTable.h"
|
||||||
#include "CDInventoryComponentTable.h"
|
#include "CDInventoryComponentTable.h"
|
||||||
@@ -829,6 +830,30 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (item->GetLot() == 8092) {
|
||||||
|
// Trying to equip a car
|
||||||
|
const auto proximityObjects = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROXIMITY_MONITOR);
|
||||||
|
|
||||||
|
// look for car instancers and check if we are in its setup range
|
||||||
|
for (auto* const entity : proximityObjects) {
|
||||||
|
if (!entity) continue;
|
||||||
|
|
||||||
|
auto* proximityMonitorComponent = entity->GetComponent<ProximityMonitorComponent>();
|
||||||
|
if (!proximityMonitorComponent) continue;
|
||||||
|
|
||||||
|
if (proximityMonitorComponent->IsInProximity("Interaction_Distance", m_Parent->GetObjectID())) {
|
||||||
|
// in the range of a car instancer
|
||||||
|
entity->OnUse(m_Parent);
|
||||||
|
GameMessages::UseItemOnClient itemMsg;
|
||||||
|
itemMsg.target = entity->GetObjectID();
|
||||||
|
itemMsg.itemLOT = item->GetLot();
|
||||||
|
itemMsg.itemToUse = item->GetId();
|
||||||
|
itemMsg.playerId = m_Parent->GetObjectID();
|
||||||
|
itemMsg.Send(m_Parent->GetSystemAddress());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
RacingControlComponent::RacingControlComponent(Entity* parent)
|
RacingControlComponent::RacingControlComponent(Entity* parent)
|
||||||
: Component(parent) {
|
: Component(parent) {
|
||||||
m_PathName = u"MainPath";
|
m_PathName = u"MainPath";
|
||||||
m_RemainingLaps = 3;
|
m_NumberOfLaps = 3;
|
||||||
|
m_RemainingLaps = m_NumberOfLaps;
|
||||||
m_LeadingPlayer = LWOOBJID_EMPTY;
|
m_LeadingPlayer = LWOOBJID_EMPTY;
|
||||||
m_RaceBestTime = 0;
|
m_RaceBestTime = 0;
|
||||||
m_RaceBestLap = 0;
|
m_RaceBestLap = 0;
|
||||||
@@ -658,23 +659,9 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn imagination pickups
|
GameMessages::ZoneLoadedInfo zoneLoadInfo{};
|
||||||
auto* minSpawner = Game::zoneManager->GetSpawnersByName(
|
zoneLoadInfo.maxPlayers = m_LoadedPlayers;
|
||||||
"ImaginationSpawn_Min")[0];
|
m_Parent->GetScript()->OnZoneLoadedInfo(m_Parent, zoneLoadInfo);
|
||||||
auto* medSpawner = Game::zoneManager->GetSpawnersByName(
|
|
||||||
"ImaginationSpawn_Med")[0];
|
|
||||||
auto* maxSpawner = Game::zoneManager->GetSpawnersByName(
|
|
||||||
"ImaginationSpawn_Max")[0];
|
|
||||||
|
|
||||||
minSpawner->Activate();
|
|
||||||
|
|
||||||
if (m_LoadedPlayers > 2) {
|
|
||||||
medSpawner->Activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_LoadedPlayers > 4) {
|
|
||||||
maxSpawner->Activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset players to their start location, without smashing them
|
// Reset players to their start location, without smashing them
|
||||||
for (auto& player : m_RacingPlayers) {
|
for (auto& player : m_RacingPlayers) {
|
||||||
@@ -764,7 +751,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
// new checkpoint
|
// new checkpoint
|
||||||
uint32_t respawnIndex = 0;
|
uint32_t respawnIndex = 0;
|
||||||
for (const auto& waypoint : path->pathWaypoints) {
|
for (const auto& waypoint : path->pathWaypoints) {
|
||||||
if (player.lap == 3) {
|
if (player.lap == m_NumberOfLaps) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +822,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
// Progress lap time tasks
|
// Progress lap time tasks
|
||||||
missionComponent->Progress(eMissionTaskType::RACING, lapTime.count(), static_cast<LWOOBJID>(eRacingTaskParam::LAP_TIME));
|
missionComponent->Progress(eMissionTaskType::RACING, lapTime.count(), static_cast<LWOOBJID>(eRacingTaskParam::LAP_TIME));
|
||||||
|
|
||||||
if (player.lap == 3) {
|
if (player.lap == m_NumberOfLaps) {
|
||||||
m_Finished++;
|
m_Finished++;
|
||||||
player.finished = m_Finished;
|
player.finished = m_Finished;
|
||||||
|
|
||||||
@@ -882,3 +869,20 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RacingControlComponent::MsgConfigureRacingControl(const GameMessages::ConfigureRacingControl& msg) {
|
||||||
|
for (const auto& dataUnique : msg.racingSettings) {
|
||||||
|
if (!dataUnique) continue;
|
||||||
|
const auto* const data = dataUnique.get();
|
||||||
|
if (data->GetKey() == u"Race_PathName" && data->GetValueType() == LDF_TYPE_UTF_16) {
|
||||||
|
m_PathName = static_cast<const LDFData<std::u16string>*>(data)->GetValue();
|
||||||
|
} else if (data->GetKey() == u"activityID" && data->GetValueType() == LDF_TYPE_S32) {
|
||||||
|
m_ActivityID = static_cast<const LDFData<int32_t>*>(data)->GetValue();
|
||||||
|
} else if (data->GetKey() == u"Number_of_Laps" && data->GetValueType() == LDF_TYPE_S32) {
|
||||||
|
m_NumberOfLaps = static_cast<const LDFData<int32_t>*>(data)->GetValue();
|
||||||
|
m_RemainingLaps = m_NumberOfLaps;
|
||||||
|
} else if (data->GetKey() == u"Minimum_Players_for_Group_Achievements" && data->GetValueType() == LDF_TYPE_S32) {
|
||||||
|
m_MinimumPlayersForGroupAchievements = static_cast<const LDFData<int32_t>*>(data)->GetValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
RacingPlayerInfo* GetPlayerData(LWOOBJID playerID);
|
RacingPlayerInfo* GetPlayerData(LWOOBJID playerID);
|
||||||
|
|
||||||
|
void MsgConfigureRacingControl(const GameMessages::ConfigureRacingControl& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,11 +163,13 @@ private:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The paths that are followed for the camera scenes
|
* The paths that are followed for the camera scenes
|
||||||
|
* Configurable in the ConfigureRacingControl msg with the key `Race_PathName`.
|
||||||
*/
|
*/
|
||||||
std::u16string m_PathName;
|
std::u16string m_PathName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ID of the activity for participating in this race
|
* The ID of the activity for participating in this race
|
||||||
|
* Configurable in the ConfigureRacingControl msg with the key `activityID`.
|
||||||
*/
|
*/
|
||||||
uint32_t m_ActivityID;
|
uint32_t m_ActivityID;
|
||||||
|
|
||||||
@@ -245,5 +249,20 @@ private:
|
|||||||
* Value for message box response to know if we are exiting the race via the activity dialogue
|
* Value for message box response to know if we are exiting the race via the activity dialogue
|
||||||
*/
|
*/
|
||||||
const int32_t m_ActivityExitConfirm = 1;
|
const int32_t m_ActivityExitConfirm = 1;
|
||||||
|
|
||||||
bool m_AllPlayersReady = false;
|
bool m_AllPlayersReady = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The number of laps in this race. Configurable in the ConfigureRacingControl msg
|
||||||
|
* with the key `Number_of_Laps`.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int32_t m_NumberOfLaps{ 3 };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The minimum number of players required to progress group achievements.
|
||||||
|
* Configurable with the ConfigureRacingControl msg with the key `Minimum_Players_for_Group_Achievements`.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int32_t m_MinimumPlayersForGroupAchievements{ 2 };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Kill player if health == 0
|
//Kill player if health == 0
|
||||||
if (entity->GetIsDead()) {
|
if (entity->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
entity->Smash(entity->GetObjectID());
|
entity->Smash(entity->GetObjectID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6342,36 +6342,57 @@ void GameMessages::SendUpdateInventoryUi(LWOOBJID objectId, const SystemAddress&
|
|||||||
SEND_PACKET;
|
SEND_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::DisplayTooltip::Send() const {
|
namespace GameMessages {
|
||||||
CBITSTREAM;
|
void GameMsg::Send(const SystemAddress& sysAddr) const {
|
||||||
CMSGHEADER;
|
CBITSTREAM;
|
||||||
|
CMSGHEADER;
|
||||||
|
|
||||||
bitStream.Write(target);
|
bitStream.Write(target); // Who this message will be sent to on the (a) client
|
||||||
bitStream.Write(msgId);
|
bitStream.Write(msgId); // the ID of this message
|
||||||
|
|
||||||
bitStream.Write(doOrDie);
|
Serialize(bitStream); // write the message data
|
||||||
bitStream.Write(noRepeat);
|
|
||||||
bitStream.Write(noRevive);
|
|
||||||
bitStream.Write(isPropertyTooltip);
|
|
||||||
bitStream.Write(show);
|
|
||||||
bitStream.Write(translate);
|
|
||||||
bitStream.Write(time);
|
|
||||||
bitStream.Write<int32_t>(id.size());
|
|
||||||
bitStream.Write(id);
|
|
||||||
|
|
||||||
std::string toWrite;
|
// Send to everyone if someone sent unassigned system address, or to one specific client.
|
||||||
for (const auto* item : localizeParams) {
|
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) {
|
||||||
toWrite += item->GetString() + "\n";
|
SEND_PACKET_BROADCAST;
|
||||||
|
} else {
|
||||||
|
SEND_PACKET;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!toWrite.empty()) toWrite.pop_back();
|
|
||||||
bitStream.Write<int32_t>(toWrite.size());
|
|
||||||
bitStream.Write(GeneralUtils::ASCIIToUTF16(toWrite));
|
|
||||||
if (!toWrite.empty()) bitStream.Write<uint16_t>(0x00); // Null Terminator
|
|
||||||
|
|
||||||
bitStream.Write<int32_t>(imageName.size());
|
void DisplayTooltip::Serialize(RakNet::BitStream& bitStream) const {
|
||||||
bitStream.Write(imageName);
|
bitStream.Write(doOrDie);
|
||||||
bitStream.Write<int32_t>(text.size());
|
bitStream.Write(noRepeat);
|
||||||
bitStream.Write(text);
|
bitStream.Write(noRevive);
|
||||||
|
bitStream.Write(isPropertyTooltip);
|
||||||
|
bitStream.Write(show);
|
||||||
|
bitStream.Write(translate);
|
||||||
|
bitStream.Write(time);
|
||||||
|
bitStream.Write<int32_t>(id.size());
|
||||||
|
bitStream.Write(id);
|
||||||
|
|
||||||
SEND_PACKET;
|
std::string toWrite;
|
||||||
|
for (const auto* item : localizeParams) {
|
||||||
|
toWrite += item->GetString() + "\n";
|
||||||
|
}
|
||||||
|
if (!toWrite.empty()) toWrite.pop_back();
|
||||||
|
bitStream.Write<int32_t>(toWrite.size());
|
||||||
|
bitStream.Write(GeneralUtils::ASCIIToUTF16(toWrite));
|
||||||
|
if (!toWrite.empty()) bitStream.Write<uint16_t>(0x00); // Null Terminator
|
||||||
|
|
||||||
|
bitStream.Write<int32_t>(imageName.size());
|
||||||
|
bitStream.Write(imageName);
|
||||||
|
bitStream.Write<int32_t>(text.size());
|
||||||
|
bitStream.Write(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UseItemOnClient::Serialize(RakNet::BitStream& bitStream) const {
|
||||||
|
bitStream.Write(itemLOT);
|
||||||
|
bitStream.Write(itemToUse);
|
||||||
|
bitStream.Write(itemType);
|
||||||
|
bitStream.Write(playerId);
|
||||||
|
bitStream.Write(targetPosition.x);
|
||||||
|
bitStream.Write(targetPosition.y);
|
||||||
|
bitStream.Write(targetPosition.z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ namespace GameMessages {
|
|||||||
struct GameMsg {
|
struct GameMsg {
|
||||||
GameMsg(MessageType::Game gmId) : msgId{ gmId } {}
|
GameMsg(MessageType::Game gmId) : msgId{ gmId } {}
|
||||||
virtual ~GameMsg() = default;
|
virtual ~GameMsg() = default;
|
||||||
virtual void Send() const {}
|
void Send(const SystemAddress& sysAddr) const;
|
||||||
|
virtual void Serialize(RakNet::BitStream& bitStream) const {}
|
||||||
MessageType::Game msgId;
|
MessageType::Game msgId;
|
||||||
LWOOBJID target{ LWOOBJID_EMPTY };
|
LWOOBJID target{ LWOOBJID_EMPTY };
|
||||||
SystemAddress sysAddr{ UNASSIGNED_SYSTEM_ADDRESS };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertyDataMessage;
|
class PropertyDataMessage;
|
||||||
@@ -705,7 +705,27 @@ namespace GameMessages {
|
|||||||
std::vector<LDFBaseData*> localizeParams{};
|
std::vector<LDFBaseData*> localizeParams{};
|
||||||
std::u16string imageName{};
|
std::u16string imageName{};
|
||||||
std::u16string text{};
|
std::u16string text{};
|
||||||
void Send() const override;
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UseItemOnClient : public GameMsg {
|
||||||
|
UseItemOnClient() : GameMsg(MessageType::Game::USE_ITEM_ON_CLIENT) {}
|
||||||
|
LWOOBJID playerId{};
|
||||||
|
LWOOBJID itemToUse{};
|
||||||
|
uint32_t itemType{};
|
||||||
|
LOT itemLOT{};
|
||||||
|
NiPoint3 targetPosition{};
|
||||||
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ZoneLoadedInfo : public GameMsg {
|
||||||
|
ZoneLoadedInfo() : GameMsg(MessageType::Game::ZONE_LOADED_INFO) {}
|
||||||
|
int32_t maxPlayers{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ConfigureRacingControl : public GameMsg {
|
||||||
|
ConfigureRacingControl() : GameMsg(MessageType::Game::CONFIGURE_RACING_CONTROL) {}
|
||||||
|
std::vector<std::unique_ptr<LDFBaseData>> racingSettings{};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,24 @@ int main(int argc, char** argv) {
|
|||||||
Server::SetupLogger("MasterServer");
|
Server::SetupLogger("MasterServer");
|
||||||
if (!Game::logger) return EXIT_FAILURE;
|
if (!Game::logger) return EXIT_FAILURE;
|
||||||
|
|
||||||
|
auto folders = { "navmeshes", "migrations", "vanity" };
|
||||||
|
|
||||||
|
for (const auto folder : folders) {
|
||||||
|
if (!std::filesystem::exists(BinaryPathFinder::GetBinaryDir() / folder)) {
|
||||||
|
std::string msg = "The (" +
|
||||||
|
std::string(folder) +
|
||||||
|
") folder was not copied to the binary directory. Please copy the (" +
|
||||||
|
std::string(folder) +
|
||||||
|
") folder from your download to the binary directory or re-run cmake.";
|
||||||
|
LOG("%s", msg.c_str());
|
||||||
|
// toss an error box up for windows users running the download
|
||||||
|
#ifdef DARKFLAME_PLATFORM_WIN32
|
||||||
|
MessageBoxA(nullptr, msg.c_str(), "Missing Folder", MB_OK | MB_ICONERROR);
|
||||||
|
#endif
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!dConfig::Exists("authconfig.ini")) LOG("Could not find authconfig.ini, using default settings");
|
if (!dConfig::Exists("authconfig.ini")) LOG("Could not find authconfig.ini, using default settings");
|
||||||
if (!dConfig::Exists("chatconfig.ini")) LOG("Could not find chatconfig.ini, using default settings");
|
if (!dConfig::Exists("chatconfig.ini")) LOG("Could not find chatconfig.ini, using default settings");
|
||||||
if (!dConfig::Exists("masterconfig.ini")) LOG("Could not find masterconfig.ini, using default settings");
|
if (!dConfig::Exists("masterconfig.ini")) LOG("Could not find masterconfig.ini, using default settings");
|
||||||
@@ -126,6 +144,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
MigrationRunner::RunMigrations();
|
MigrationRunner::RunMigrations();
|
||||||
const auto resServerPath = BinaryPathFinder::GetBinaryDir() / "resServer";
|
const auto resServerPath = BinaryPathFinder::GetBinaryDir() / "resServer";
|
||||||
|
std::filesystem::create_directories(resServerPath);
|
||||||
const bool cdServerExists = std::filesystem::exists(resServerPath / "CDServer.sqlite");
|
const bool cdServerExists = std::filesystem::exists(resServerPath / "CDServer.sqlite");
|
||||||
const bool oldCDServerExists = std::filesystem::exists(Game::assetManager->GetResPath() / "CDServer.sqlite");
|
const bool oldCDServerExists = std::filesystem::exists(Game::assetManager->GetResPath() / "CDServer.sqlite");
|
||||||
const bool fdbExists = std::filesystem::exists(Game::assetManager->GetResPath() / "cdclient.fdb");
|
const bool fdbExists = std::filesystem::exists(Game::assetManager->GetResPath() / "cdclient.fdb");
|
||||||
@@ -176,7 +195,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run migrations should any need to be run.
|
// Run migrations should any need to be run.
|
||||||
MigrationRunner::RunSQLiteMigrations();
|
MigrationRunner::RunSQLiteMigrations();
|
||||||
|
|
||||||
//If the first command line argument is -a or --account then make the user
|
//If the first command line argument is -a or --account then make the user
|
||||||
//input a username and password, with the password being hidden.
|
//input a username and password, with the password being hidden.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void BaseEnemyApe::OnStartup(Entity* self) {
|
|||||||
|
|
||||||
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
|
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
|
||||||
auto* anchor = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
|
auto* anchor = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
|
||||||
if (anchor != nullptr && !anchor->GetIsDead()) {
|
if (anchor != nullptr && !anchor->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
anchor->Smash(self->GetObjectID(), eKillType::SILENT);
|
anchor->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,13 +152,13 @@ void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
|
|||||||
auto StateChangeType = eStateChangeType::POP;
|
auto StateChangeType = eStateChangeType::POP;
|
||||||
|
|
||||||
if (bFreeze) {
|
if (bFreeze) {
|
||||||
if (player->GetIsDead()) {
|
if (player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StateChangeType = eStateChangeType::PUSH;
|
StateChangeType = eStateChangeType::PUSH;
|
||||||
} else {
|
} else {
|
||||||
if (player->GetIsDead()) {
|
if (player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
|
|||||||
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
|
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
|
||||||
for (auto memberID : team) {
|
for (auto memberID : team) {
|
||||||
auto member = Game::entityManager->GetEntity(memberID);
|
auto member = Game::entityManager->GetEntity(memberID);
|
||||||
if (member != nullptr && !member->GetIsDead()) {
|
if (member != nullptr && !member->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ bool BaseSurvivalServer::CheckAllPlayersDead() {
|
|||||||
|
|
||||||
for (const auto& playerID : state.players) {
|
for (const auto& playerID : state.players) {
|
||||||
auto* player = Game::entityManager->GetEntity(playerID);
|
auto* player = Game::entityManager->GetEntity(playerID);
|
||||||
if (player == nullptr || player->GetIsDead()) {
|
if (player == nullptr || player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
deadPlayers++;
|
deadPlayers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ bool BaseWavesServer::CheckAllPlayersDead() {
|
|||||||
|
|
||||||
for (const auto& playerID : state.players) {
|
for (const auto& playerID : state.players) {
|
||||||
auto* player = Game::entityManager->GetEntity(playerID);
|
auto* player = Game::entityManager->GetEntity(playerID);
|
||||||
if (player == nullptr || player->GetIsDead()) {
|
if (player == nullptr || player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
deadPlayers++;
|
deadPlayers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,7 @@ void BaseWavesServer::SpawnWave(Entity* self) {
|
|||||||
|
|
||||||
for (const auto& playerID : state.players) {
|
for (const auto& playerID : state.players) {
|
||||||
auto* player = Game::entityManager->GetEntity(playerID);
|
auto* player = Game::entityManager->GetEntity(playerID);
|
||||||
if (player && player->GetIsDead()) {
|
if (player && player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
player->Resurrect();
|
player->Resurrect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3
|
|||||||
|
|
||||||
for (const auto& playerID : state.players) {
|
for (const auto& playerID : state.players) {
|
||||||
auto* player = Game::entityManager->GetEntity(playerID);
|
auto* player = Game::entityManager->GetEntity(playerID);
|
||||||
if (player != nullptr && !player->GetIsDead()) {
|
if (player != nullptr && !player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
SetActivityValue(self, playerID, 1, currentTime);
|
SetActivityValue(self, playerID, 1, currentTime);
|
||||||
SetActivityValue(self, playerID, 2, state.waveNumber);
|
SetActivityValue(self, playerID, 2, state.waveNumber);
|
||||||
|
|
||||||
|
|||||||
@@ -329,6 +329,8 @@
|
|||||||
#include "WblRobotCitizen.h"
|
#include "WblRobotCitizen.h"
|
||||||
#include "EnemyClearThreat.h"
|
#include "EnemyClearThreat.h"
|
||||||
#include "AgSpiderBossMessage.h"
|
#include "AgSpiderBossMessage.h"
|
||||||
|
#include "GfRaceInstancer.h"
|
||||||
|
#include "NsRaceServer.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -690,6 +692,8 @@ namespace {
|
|||||||
{"scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizenYellow.lua", []() {return new WblRobotCitizen();}},
|
{"scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizenYellow.lua", []() {return new WblRobotCitizen();}},
|
||||||
{"scripts\\02_server\\Map\\General\\L_ENEMY_CLEAR_THREAT.lua", []() {return new EnemyClearThreat();}},
|
{"scripts\\02_server\\Map\\General\\L_ENEMY_CLEAR_THREAT.lua", []() {return new EnemyClearThreat();}},
|
||||||
{"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\\RACING\\TRACK_NS\\NS_RACE_SERVER.lua", []() {return new NsRaceServer();}},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -702,7 +706,12 @@ namespace {
|
|||||||
"scripts\\empty.lua",
|
"scripts\\empty.lua",
|
||||||
"scripts\\zone\\AG\\L_ZONE_AG.lua",
|
"scripts\\zone\\AG\\L_ZONE_AG.lua",
|
||||||
"scripts\\zone\\NS\\L_ZONE_NS.lua",
|
"scripts\\zone\\NS\\L_ZONE_NS.lua",
|
||||||
"scripts\\zone\\GF\\L_ZONE_GF.lua",
|
"scripts\\ai\\GF\\L_ZONE_GF.lua",
|
||||||
|
"scripts\\ai\\AG\\CONCERT_STAGE.lua",
|
||||||
|
"scripts\\ai\\NS\\L_NS_CAR_MODULAR_BUILD.lua", // In our implementation, this is done in GameMessages.cpp
|
||||||
|
"scripts\\ai\\PETS\\PET_BLOCKER.lua",
|
||||||
|
"scripts\\ai\\PETS\\PET_FLEA_MISSION.lua",
|
||||||
|
"scripts\\ai\\ACT\\L_ACT_PET_INSTANCE_EXIT.lua",
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -354,7 +354,9 @@ namespace CppScripts {
|
|||||||
* @param player the player to remove
|
* @param player the player to remove
|
||||||
* @param canceled if it was done via the cancel button
|
* @param canceled if it was done via the cancel button
|
||||||
*/
|
*/
|
||||||
virtual void OnRequestActivityExit(Entity* sender, LWOOBJID player, bool canceled){};
|
virtual void OnRequestActivityExit(Entity* sender, LWOOBJID player, bool canceled) {};
|
||||||
|
|
||||||
|
virtual void OnZoneLoadedInfo(Entity* self, const GameMessages::ZoneLoadedInfo& info) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
Script* const GetScript(Entity* parent, const std::string& scriptName);
|
Script* const GetScript(Entity* parent, const std::string& scriptName);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "ActPlayerDeathTrigger.h"
|
#include "ActPlayerDeathTrigger.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
|
||||||
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||||
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
if (!target->IsPlayer() || target->GetComponent<DestroyableComponent>()->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||||
|
|
||||||
target->Smash(self->GetObjectID(), eKillType::SILENT);
|
target->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "ActSharkPlayerDeathTrigger.h"
|
#include "ActSharkPlayerDeathTrigger.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
@@ -11,7 +12,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen
|
|||||||
|
|
||||||
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419);
|
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419);
|
||||||
|
|
||||||
if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
if (sender->GetComponent<DestroyableComponent>()->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||||
|
|
||||||
if (sender->GetCharacter()) {
|
if (sender->GetCharacter()) {
|
||||||
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");
|
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "AgShipPlayerDeathTrigger.h"
|
#include "AgShipPlayerDeathTrigger.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
|
||||||
void AgShipPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
void AgShipPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||||
if (target->GetLOT() == 1 && !target->GetIsDead()) {
|
if (target->GetLOT() == 1 && !target->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"electro-shock-death");
|
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"electro-shock-death");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,10 @@ void AgSpiderBossMessage::MakeBox(Entity* self) const {
|
|||||||
if (!tgt) return;
|
if (!tgt) return;
|
||||||
GameMessages::DisplayTooltip tooltip;
|
GameMessages::DisplayTooltip tooltip;
|
||||||
tooltip.target = tgt->GetObjectID();
|
tooltip.target = tgt->GetObjectID();
|
||||||
tooltip.sysAddr = tgt->GetSystemAddress();
|
|
||||||
tooltip.show = true;
|
tooltip.show = true;
|
||||||
tooltip.text = box.boxText;
|
tooltip.text = box.boxText;
|
||||||
tooltip.time = box.boxTime * 1000; // to ms
|
tooltip.time = box.boxTime * 1000; // to ms
|
||||||
tooltip.Send();
|
tooltip.Send(tgt->GetSystemAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgSpiderBossMessage::OnCollisionPhantom(Entity* self, Entity* target) {
|
void AgSpiderBossMessage::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "TriggerGas.h"
|
#include "TriggerGas.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
@@ -28,7 +29,7 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
|
|||||||
if (timerName != this->m_TimerName) return;
|
if (timerName != this->m_TimerName) return;
|
||||||
auto players = self->GetVar<std::vector<Entity*>>(u"players");
|
auto players = self->GetVar<std::vector<Entity*>>(u"players");
|
||||||
for (auto player : players) {
|
for (auto player : players) {
|
||||||
if (player->GetIsDead() || !player){
|
if (player->GetComponent<DestroyableComponent>()->GetIsDead() || !player){
|
||||||
auto position = std::find(players.begin(), players.end(), player);
|
auto position = std::find(players.begin(), players.end(), player);
|
||||||
if (position != players.end()) players.erase(position);
|
if (position != players.end()) players.erase(position);
|
||||||
continue;
|
continue;
|
||||||
@@ -46,4 +47,3 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
|
|||||||
self->SetVar(u"players", players);
|
self->SetVar(u"players", players);
|
||||||
self->AddTimer(this->m_TimerName, this->m_Time);
|
self->AddTimer(this->m_TimerName, this->m_Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
set(DSCRIPTS_SOURCES_AI_GF
|
set(DSCRIPTS_SOURCES_AI_GF
|
||||||
|
"GfRaceInstancer.cpp"
|
||||||
"GfCampfire.cpp"
|
"GfCampfire.cpp"
|
||||||
"GfOrgan.cpp"
|
"GfOrgan.cpp"
|
||||||
"GfBanana.cpp"
|
"GfBanana.cpp"
|
||||||
|
|||||||
7
dScripts/ai/GF/GfRaceInstancer.cpp
Normal file
7
dScripts/ai/GF/GfRaceInstancer.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "GfRaceInstancer.h"
|
||||||
|
|
||||||
|
#include "Entity.h"
|
||||||
|
|
||||||
|
void GfRaceInstancer::OnStartup(Entity* self) {
|
||||||
|
self->SetProximityRadius(self->HasVar(u"interaction_distance") ? self->GetVar<float>(u"interaction_distance") : 16.0f, "Interaction_Distance");
|
||||||
|
}
|
||||||
11
dScripts/ai/GF/GfRaceInstancer.h
Normal file
11
dScripts/ai/GF/GfRaceInstancer.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef GFRACEINSTANCER_H
|
||||||
|
#define GFRACEINSTANCER_H
|
||||||
|
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class GfRaceInstancer : public CppScripts::Script {
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!GFRACEINSTANCER_H
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "PetDigBuild.h"
|
#include "PetDigBuild.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "EntityInfo.h"
|
#include "EntityInfo.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "eMissionState.h"
|
#include "eMissionState.h"
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// If the quick build expired and the treasure was not collected, hide the treasure
|
// If the quick build expired and the treasure was not collected, hide the treasure
|
||||||
if (!treasure->GetIsDead()) {
|
if (!treasure->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
treasure->Smash(self->GetObjectID(), eKillType::SILENT);
|
treasure->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void NsConcertInstrument::OnQuickBuildNotifyState(Entity* self, eQuickBuildState
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NsConcertInstrument::OnQuickBuildComplete(Entity* self, Entity* target) {
|
void NsConcertInstrument::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||||
if (!target->GetIsDead()) {
|
if (!target->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||||
self->SetVar<LWOOBJID>(u"activePlayer", target->GetObjectID());
|
self->SetVar<LWOOBJID>(u"activePlayer", target->GetObjectID());
|
||||||
|
|
||||||
self->AddCallbackTimer(0.2f, [self, target]() {
|
self->AddCallbackTimer(0.2f, [self, target]() {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
set(DSCRIPTS_SOURCES_AI_RACING)
|
set(DSCRIPTS_SOURCES_AI_RACING
|
||||||
|
"RaceImaginationServer.cpp")
|
||||||
|
|
||||||
add_subdirectory(OBJECTS)
|
add_subdirectory(OBJECTS)
|
||||||
|
|
||||||
@@ -6,6 +7,12 @@ foreach(file ${DSCRIPTS_SOURCES_AI_RACING_OBJECTS})
|
|||||||
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "OBJECTS/${file}")
|
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "OBJECTS/${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
add_subdirectory(TRACK_NS)
|
||||||
|
|
||||||
|
foreach(file ${DSCRIPTS_SOURCES_AI_RACING_TRACK_NS})
|
||||||
|
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "TRACK_NS/${file}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
add_library(dScriptsAiRacing OBJECT ${DSCRIPTS_SOURCES_AI_RACING})
|
add_library(dScriptsAiRacing OBJECT ${DSCRIPTS_SOURCES_AI_RACING})
|
||||||
target_include_directories(dScriptsAiRacing PUBLIC "." "OBJECTS")
|
target_include_directories(dScriptsAiRacing PUBLIC "." "OBJECTS" "TRACK_NS")
|
||||||
target_precompile_headers(dScriptsAiRacing REUSE_FROM dScriptsBase)
|
target_precompile_headers(dScriptsAiRacing REUSE_FROM dScriptsBase)
|
||||||
|
|||||||
19
dScripts/ai/RACING/RaceImaginationServer.cpp
Normal file
19
dScripts/ai/RACING/RaceImaginationServer.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "RaceImaginationServer.h"
|
||||||
|
#include "dZoneManager.h"
|
||||||
|
|
||||||
|
void StartSpawner(const std::vector<Spawner*>& spawner) {
|
||||||
|
for (auto* const entity : spawner) {
|
||||||
|
entity->Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RaceImaginationServer::OnZoneLoadedInfo(Entity* self, const GameMessages::ZoneLoadedInfo& info) {
|
||||||
|
// Spawn imagination pickups
|
||||||
|
StartSpawner(Game::zoneManager->GetSpawnersByName("ImaginationSpawn_Min"));
|
||||||
|
if (info.maxPlayers > 2) {
|
||||||
|
StartSpawner(Game::zoneManager->GetSpawnersByName("ImaginationSpawn_Med"));
|
||||||
|
}
|
||||||
|
if (info.maxPlayers > 4) {
|
||||||
|
StartSpawner(Game::zoneManager->GetSpawnersByName("ImaginationSpawn_Max"));
|
||||||
|
}
|
||||||
|
}
|
||||||
11
dScripts/ai/RACING/RaceImaginationServer.h
Normal file
11
dScripts/ai/RACING/RaceImaginationServer.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef RACEIMAGINATIONSERVER_H
|
||||||
|
#define RACEIMAGINATIONSERVER_H
|
||||||
|
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class RaceImaginationServer : public virtual CppScripts::Script {
|
||||||
|
public:
|
||||||
|
void OnZoneLoadedInfo(Entity* self, const GameMessages::ZoneLoadedInfo& info) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!RACEIMAGINATIONSERVER_H
|
||||||
3
dScripts/ai/RACING/TRACK_NS/CMakeLists.txt
Normal file
3
dScripts/ai/RACING/TRACK_NS/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
set(DSCRIPTS_SOURCES_AI_RACING_TRACK_NS
|
||||||
|
"NsRaceServer.cpp"
|
||||||
|
PARENT_SCOPE)
|
||||||
54
dScripts/ai/RACING/TRACK_NS/NsRaceServer.cpp
Normal file
54
dScripts/ai/RACING/TRACK_NS/NsRaceServer.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "NsRaceServer.h"
|
||||||
|
|
||||||
|
#include "RacingControlComponent.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
|
||||||
|
using std::unique_ptr;
|
||||||
|
using std::make_unique;
|
||||||
|
|
||||||
|
void NsRaceServer::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", 42));
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
dScripts/ai/RACING/TRACK_NS/NsRaceServer.h
Normal file
12
dScripts/ai/RACING/TRACK_NS/NsRaceServer.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef NSRACESERVER_H
|
||||||
|
#define NSRACESERVER_H
|
||||||
|
|
||||||
|
#include "CppScripts.h"
|
||||||
|
#include "RaceImaginationServer.h"
|
||||||
|
|
||||||
|
class NsRaceServer : public RaceImaginationServer {
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!NSRACESERVER_H
|
||||||
@@ -13,7 +13,7 @@ void Server::SetupLogger(const std::string_view serviceName) {
|
|||||||
|
|
||||||
const auto logsDir = BinaryPathFinder::GetBinaryDir() / "logs";
|
const auto logsDir = BinaryPathFinder::GetBinaryDir() / "logs";
|
||||||
|
|
||||||
if (!std::filesystem::exists(logsDir)) std::filesystem::create_directory(logsDir);
|
if (!std::filesystem::exists(logsDir)) std::filesystem::create_directories(logsDir);
|
||||||
|
|
||||||
std::string logPath = (logsDir / serviceName).string() + "_" + std::to_string(time(nullptr)) + ".log";
|
std::string logPath = (logsDir / serviceName).string() + "_" + std::to_string(time(nullptr)) + ".log";
|
||||||
bool logToConsole = false;
|
bool logToConsole = false;
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ client_location=
|
|||||||
|
|
||||||
# The maximum outgoing bandwidth in bits. If your clients are having
|
# The maximum outgoing bandwidth in bits. If your clients are having
|
||||||
# issues with enemies taking a while to catch up to them, increse this value.
|
# issues with enemies taking a while to catch up to them, increse this value.
|
||||||
maximum_outgoing_bandwidth=80000
|
# Empty or 0 means no limit
|
||||||
|
maximum_outgoing_bandwidth=0
|
||||||
|
|
||||||
# The Maximum Translation Unit (MTU) size for packets. If players are
|
# The Maximum Translation Unit (MTU) size for packets. If players are
|
||||||
# getting stuck at 55% on the loading screen, lower this number to
|
# getting stuck at 55% on the loading screen, lower this number to
|
||||||
|
|||||||
Reference in New Issue
Block a user