Compare commits
4 Commits
7f7221e1b7
...
8583bef23d
Author | SHA1 | Date | |
---|---|---|---|
8583bef23d | |||
6a13c509a2 | |||
925f9a100d | |||
e1d61ed7e8 |
@ -10,7 +10,7 @@
|
|||||||
* be used based on game info's settings;
|
* be used based on game info's settings;
|
||||||
* 3. `Report...()` methods that perform various validation checks
|
* 3. `Report...()` methods that perform various validation checks
|
||||||
* (and log them) on config data.
|
* (and log them) on config data.
|
||||||
* Copyright 2021 Anton Tarasenko
|
* Copyright 2021-2022 Anton Tarasenko
|
||||||
*------------------------------------------------------------------------------
|
*------------------------------------------------------------------------------
|
||||||
* This file is part of Acedia.
|
* This file is part of Acedia.
|
||||||
*
|
*
|
||||||
@ -101,6 +101,7 @@ protected function FromData(HashTable source)
|
|||||||
local int i;
|
local int i;
|
||||||
local ArrayList nextArray;
|
local ArrayList nextArray;
|
||||||
local HashTable nextPair;
|
local HashTable nextPair;
|
||||||
|
|
||||||
if (source == none) {
|
if (source == none) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -133,6 +134,7 @@ private final function FeatureConfigPair HashTableIntoPair(HashTable source)
|
|||||||
{
|
{
|
||||||
local Text nextText;
|
local Text nextText;
|
||||||
local FeatureConfigPair result;
|
local FeatureConfigPair result;
|
||||||
|
|
||||||
if (source == none) {
|
if (source == none) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -152,6 +154,7 @@ private final function array<string> DynamicIntoStringArray(ArrayList source)
|
|||||||
local int i;
|
local int i;
|
||||||
local Text nextText;
|
local Text nextText;
|
||||||
local array<string> result;
|
local array<string> result;
|
||||||
|
|
||||||
if (source == none) {
|
if (source == none) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -168,6 +171,7 @@ protected function array<Text> StringToTextArray(array<string> input)
|
|||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local array<Text> result;
|
local array<Text> result;
|
||||||
|
|
||||||
for (i = 0; i < input.length; i += 1) {
|
for (i = 0; i < input.length; i += 1) {
|
||||||
result[i] = _.text.FromString(input[i]);
|
result[i] = _.text.FromString(input[i]);
|
||||||
}
|
}
|
||||||
@ -211,6 +215,7 @@ public function ReportIncorrectSettings(
|
|||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local array<string> featureNames, featuresToReplace;
|
local array<string> featureNames, featuresToReplace;
|
||||||
|
|
||||||
for (i = 0; i < featuresToEnable.length; i += 1) {
|
for (i = 0; i < featuresToEnable.length; i += 1) {
|
||||||
featureNames[i] = string(featuresToEnable[i].featureClass);
|
featureNames[i] = string(featuresToEnable[i].featureClass);
|
||||||
}
|
}
|
||||||
@ -233,6 +238,7 @@ public function ReportIncorrectSettings(
|
|||||||
public function ReportBadMutatorNames()
|
public function ReportBadMutatorNames()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for (i = 0; i < includeMutator.length; i += 1)
|
for (i = 0; i < includeMutator.length; i += 1)
|
||||||
{
|
{
|
||||||
if (!ValidateServerURLName(includeMutator[i]))
|
if (!ValidateServerURLName(includeMutator[i]))
|
||||||
@ -268,6 +274,7 @@ private function ValidateFeatureArray(
|
|||||||
{
|
{
|
||||||
local int i, j;
|
local int i, j;
|
||||||
local bool foundItem;
|
local bool foundItem;
|
||||||
|
|
||||||
for (i = 0; i < subset.length; i += 1)
|
for (i = 0; i < subset.length; i += 1)
|
||||||
{
|
{
|
||||||
foundItem = false;
|
foundItem = false;
|
||||||
@ -305,6 +312,7 @@ public function UpdateFeatureArray(
|
|||||||
local int i;
|
local int i;
|
||||||
local Text newConfigName;
|
local Text newConfigName;
|
||||||
local string nextFeatureClassName;
|
local string nextFeatureClassName;
|
||||||
|
|
||||||
for (i = 0; i < featuresToEnable.length; i += 1)
|
for (i = 0; i < featuresToEnable.length; i += 1)
|
||||||
{
|
{
|
||||||
nextFeatureClassName = string(featuresToEnable[i].featureClass);
|
nextFeatureClassName = string(featuresToEnable[i].featureClass);
|
||||||
@ -334,6 +342,7 @@ public function UpdateFeatureArray(
|
|||||||
private function bool FeatureExcluded(string featureClassName)
|
private function bool FeatureExcluded(string featureClassName)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for (i = 0; i < excludeFeature.length; i += 1)
|
for (i = 0; i < excludeFeature.length; i += 1)
|
||||||
{
|
{
|
||||||
if (excludeFeature[i] ~= featureClassName) {
|
if (excludeFeature[i] ~= featureClassName) {
|
||||||
@ -346,6 +355,7 @@ private function bool FeatureExcluded(string featureClassName)
|
|||||||
private function Text TryReplacingFeatureConfig(string featureClassName)
|
private function Text TryReplacingFeatureConfig(string featureClassName)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for (i = 0; i < includeFeatureAs.length; i += 1)
|
for (i = 0; i < includeFeatureAs.length; i += 1)
|
||||||
{
|
{
|
||||||
if (includeFeatureAs[i].feature ~= featureClassName) {
|
if (includeFeatureAs[i].feature ~= featureClassName) {
|
||||||
@ -358,6 +368,7 @@ private function Text TryReplacingFeatureConfig(string featureClassName)
|
|||||||
private function bool FeatureInIncludedArray(string featureClassName)
|
private function bool FeatureInIncludedArray(string featureClassName)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for (i = 0; i < includeFeature.length; i += 1)
|
for (i = 0; i < includeFeature.length; i += 1)
|
||||||
{
|
{
|
||||||
if (includeFeature[i] ~= featureClassName) {
|
if (includeFeature[i] ~= featureClassName) {
|
||||||
@ -371,6 +382,7 @@ public function array<Text> GetIncludedMutators()
|
|||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local array<string> validatedMutators;
|
local array<string> validatedMutators;
|
||||||
|
|
||||||
for (i = 0; i < includeMutator.length; i += 1)
|
for (i = 0; i < includeMutator.length; i += 1)
|
||||||
{
|
{
|
||||||
if (ValidateServerURLName(includeMutator[i])) {
|
if (ValidateServerURLName(includeMutator[i])) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* The only implementation for `BaseGameMode` suitable for standard
|
* The only implementation for `BaseGameMode` suitable for standard
|
||||||
* killing floor game types.
|
* killing floor game types.
|
||||||
* Copyright 2021 Anton Tarasenko
|
* Copyright 2021-2022 Anton Tarasenko
|
||||||
*------------------------------------------------------------------------------
|
*------------------------------------------------------------------------------
|
||||||
* This file is part of Acedia.
|
* This file is part of Acedia.
|
||||||
*
|
*
|
||||||
@ -59,6 +59,7 @@ protected function HashTable ToData()
|
|||||||
local int i;
|
local int i;
|
||||||
local ArrayList nextArray;
|
local ArrayList nextArray;
|
||||||
local HashTable result, nextPair;
|
local HashTable result, nextPair;
|
||||||
|
|
||||||
result = super.ToData();
|
result = super.ToData();
|
||||||
if (result == none) {
|
if (result == none) {
|
||||||
return none;
|
return none;
|
||||||
@ -86,6 +87,7 @@ protected function FromData(HashTable source)
|
|||||||
local GameOption nextGameOption;
|
local GameOption nextGameOption;
|
||||||
local ArrayList nextArray;
|
local ArrayList nextArray;
|
||||||
local HashTable nextPair;
|
local HashTable nextPair;
|
||||||
|
|
||||||
super.FromData(source);
|
super.FromData(source);
|
||||||
if (source == none) {
|
if (source == none) {
|
||||||
return;
|
return;
|
||||||
@ -153,6 +155,7 @@ public function Text GetMapPrefix()
|
|||||||
public function ReportBadOptions()
|
public function ReportBadOptions()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for (i = 0; i < option.length; i += 1)
|
for (i = 0; i < option.length; i += 1)
|
||||||
{
|
{
|
||||||
if ( !ValidateServerURLName(option[i].key)
|
if ( !ValidateServerURLName(option[i].key)
|
||||||
@ -173,6 +176,7 @@ public function HashTable GetOptions()
|
|||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local HashTable result;
|
local HashTable result;
|
||||||
|
|
||||||
result = _.collections.EmptyHashTable();
|
result = _.collections.EmptyHashTable();
|
||||||
for (i = 0; i < option.length; i += 1)
|
for (i = 0; i < option.length; i += 1)
|
||||||
{
|
{
|
||||||
|
@ -22,13 +22,6 @@
|
|||||||
class Packages extends Mutator
|
class Packages extends Mutator
|
||||||
config(Acedia);
|
config(Acedia);
|
||||||
|
|
||||||
// Default value of this variable will be used to store
|
|
||||||
// reference to the active Acedia mutator,
|
|
||||||
// as well as to ensure there's only one copy of it.
|
|
||||||
// We can't use 'Singleton' class for that,
|
|
||||||
// as we have to derive from 'Mutator'.
|
|
||||||
var private Packages selfReference;
|
|
||||||
|
|
||||||
// Acedia's reference to a `Global` object.
|
// Acedia's reference to a `Global` object.
|
||||||
var private Global _;
|
var private Global _;
|
||||||
var private ServerGlobal _server;
|
var private ServerGlobal _server;
|
||||||
@ -56,11 +49,6 @@ struct FeatureConfigPair
|
|||||||
var public Text configName;
|
var public Text configName;
|
||||||
};
|
};
|
||||||
|
|
||||||
static public final function Packages GetInstance()
|
|
||||||
{
|
|
||||||
return default.selfReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "Constructor"
|
// "Constructor"
|
||||||
simulated function PreBeginPlay()
|
simulated function PreBeginPlay()
|
||||||
{
|
{
|
||||||
@ -74,16 +62,8 @@ simulated function PreBeginPlay()
|
|||||||
|
|
||||||
private simulated function InitializeClient()
|
private simulated function InitializeClient()
|
||||||
{
|
{
|
||||||
// Enforce one copy rule and remember a reference to that copy
|
|
||||||
if (default.selfReference != none)
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default.selfReference = self;
|
|
||||||
// TODO: Swap these around after dealing with aliases
|
|
||||||
class'ClientLevelCore'.static.CreateLevelCore(self);
|
|
||||||
_ = class'Global'.static.GetInstance();
|
_ = class'Global'.static.GetInstance();
|
||||||
|
class'ClientLevelCore'.static.CreateLevelCore(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function InitializeServer()
|
private function InitializeServer()
|
||||||
@ -92,23 +72,16 @@ private function InitializeServer()
|
|||||||
local LevelCore serverCore;
|
local LevelCore serverCore;
|
||||||
local GameMode currentGameMode;
|
local GameMode currentGameMode;
|
||||||
local array<FeatureConfigPair> availableFeatures;
|
local array<FeatureConfigPair> availableFeatures;
|
||||||
|
|
||||||
if (clientside) {
|
if (clientside) {
|
||||||
AddToPackageMap("Acedia");
|
AddToPackageMap("Acedia");
|
||||||
}
|
}
|
||||||
CheckForGarbage();
|
CheckForGarbage();
|
||||||
// Enforce one copy rule and remember a reference to that copy
|
|
||||||
if (default.selfReference != none)
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default.selfReference = self;
|
|
||||||
// Launch and setup core Acedia
|
// Launch and setup core Acedia
|
||||||
// TODO: Swap these around after dealing with aliases
|
|
||||||
serverCore = class'ServerLevelCore'.static.CreateLevelCore(self);
|
|
||||||
_ = class'Global'.static.GetInstance();
|
_ = class'Global'.static.GetInstance();
|
||||||
_server = class'ServerGlobal'.static.GetInstance();
|
_server = class'ServerGlobal'.static.GetInstance();
|
||||||
_client = class'ClientGlobal'.static.GetInstance();
|
_client = class'ClientGlobal'.static.GetInstance();
|
||||||
|
serverCore = class'ServerLevelCore'.static.CreateLevelCore(self);
|
||||||
for (i = 0; i < package.length; i += 1) {
|
for (i = 0; i < package.length; i += 1) {
|
||||||
_.environment.RegisterPackage_S(package[i]);
|
_.environment.RegisterPackage_S(package[i]);
|
||||||
}
|
}
|
||||||
@ -149,7 +122,6 @@ function ServerTraveling(string URL, bool bItems)
|
|||||||
_.memory.Free(votingAdapter);
|
_.memory.Free(votingAdapter);
|
||||||
votingAdapter = none;
|
votingAdapter = none;
|
||||||
}
|
}
|
||||||
default.selfReference = none;
|
|
||||||
_.environment.ShutDown();
|
_.environment.ShutDown();
|
||||||
if (nextMutator != none) {
|
if (nextMutator != none) {
|
||||||
nextMutator.ServerTraveling(URL, bItems);
|
nextMutator.ServerTraveling(URL, bItems);
|
||||||
@ -161,10 +133,13 @@ function ServerTraveling(string URL, bool bItems)
|
|||||||
// This can lead to serious problems, so such diagnostic check is warranted.
|
// This can lead to serious problems, so such diagnostic check is warranted.
|
||||||
private function CheckForGarbage()
|
private function CheckForGarbage()
|
||||||
{
|
{
|
||||||
local int leftoverObjectAmount, leftoverActorAmount, leftoverDBRAmount;
|
local int leftoverObjectAmount;
|
||||||
|
local int leftoverActorAmount;
|
||||||
|
local int leftoverDBRAmount;
|
||||||
local AcediaObject nextObject;
|
local AcediaObject nextObject;
|
||||||
local AcediaActor nextActor;
|
local AcediaActor nextActor;
|
||||||
local DBRecord nextRecord;
|
local DBRecord nextRecord;
|
||||||
|
|
||||||
foreach AllObjects(class'AcediaObject', nextObject) {
|
foreach AllObjects(class'AcediaObject', nextObject) {
|
||||||
leftoverObjectAmount += 1;
|
leftoverObjectAmount += 1;
|
||||||
}
|
}
|
||||||
@ -210,6 +185,7 @@ public final function array<FeatureConfigPair> GetAutoConfigurationInfo()
|
|||||||
private function EnableFeatures(array<FeatureConfigPair> features)
|
private function EnableFeatures(array<FeatureConfigPair> features)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for (i = 0; i < features.length; i += 1)
|
for (i = 0; i < features.length; i += 1)
|
||||||
{
|
{
|
||||||
if (features[i].featureClass == none) continue;
|
if (features[i].featureClass == none) continue;
|
||||||
@ -225,6 +201,7 @@ private function EnableFeatures(array<FeatureConfigPair> features)
|
|||||||
private function SetupMutatorSignals()
|
private function SetupMutatorSignals()
|
||||||
{
|
{
|
||||||
local ServerUnrealService service;
|
local ServerUnrealService service;
|
||||||
|
|
||||||
service = ServerUnrealService(class'ServerUnrealService'.static.Require());
|
service = ServerUnrealService(class'ServerUnrealService'.static.Require());
|
||||||
onMutateSignal = Mutator_OnMutate_Signal(
|
onMutateSignal = Mutator_OnMutate_Signal(
|
||||||
service.GetSignal(class'Mutator_OnMutate_Signal'));
|
service.GetSignal(class'Mutator_OnMutate_Signal'));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* This actor's role is to add Acedia mutator on listen and dedicated servers.
|
* This actor's role is to add Acedia mutator on listen and dedicated servers.
|
||||||
* Copyright 2019 Anton Tarasenko
|
* Copyright 2019-2022 Anton Tarasenko
|
||||||
*------------------------------------------------------------------------------
|
*------------------------------------------------------------------------------
|
||||||
* This file is part of Acedia.
|
* This file is part of Acedia.
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* data from Acedia's game modes.
|
* data from Acedia's game modes.
|
||||||
* Requires `GameInfo`'s voting handler to be derived from
|
* Requires `GameInfo`'s voting handler to be derived from
|
||||||
* `XVotingHandler`, which is satisfied by pretty much every used handler.
|
* `XVotingHandler`, which is satisfied by pretty much every used handler.
|
||||||
* Copyright 2021 Anton Tarasenko
|
* Copyright 2021-2022 Anton Tarasenko
|
||||||
*------------------------------------------------------------------------------
|
*------------------------------------------------------------------------------
|
||||||
* This file is part of Acedia.
|
* This file is part of Acedia.
|
||||||
*
|
*
|
||||||
@ -109,6 +109,7 @@ public final function InjectIntoVotingHandler()
|
|||||||
local GameMode nextGameMode;
|
local GameMode nextGameMode;
|
||||||
local XVotingHandler votingHandler;
|
local XVotingHandler votingHandler;
|
||||||
local array<VotingHandler.MapVoteGameConfig> newVotingHandlerConfig;
|
local array<VotingHandler.MapVoteGameConfig> newVotingHandlerConfig;
|
||||||
|
|
||||||
if (votingHandlerReference != none) {
|
if (votingHandlerReference != none) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -139,10 +140,11 @@ private function VotingHandler.MapVoteGameConfig BuildVotingHandlerConfig(
|
|||||||
GameMode gameMode)
|
GameMode gameMode)
|
||||||
{
|
{
|
||||||
local VotingHandler.MapVoteGameConfig result;
|
local VotingHandler.MapVoteGameConfig result;
|
||||||
result.gameClass = _.text.ToString(gameMode.GetGameTypeClass());
|
|
||||||
|
result.gameClass = _.text.IntoString(gameMode.GetGameTypeClass());
|
||||||
result.gameName = _.text.ToColoredString(gameMode.GetTitle());
|
result.gameName = _.text.ToColoredString(gameMode.GetTitle());
|
||||||
result.prefix = _.text.ToString(gameMode.GetMapPrefix());
|
result.prefix = _.text.IntoString(gameMode.GetMapPrefix());
|
||||||
result.acronym = _.text.ToString(gameMode.GetAcronym());
|
result.acronym = _.text.IntoString(gameMode.GetAcronym());
|
||||||
result.mutators = BuildMutatorString(gameMode);
|
result.mutators = BuildMutatorString(gameMode);
|
||||||
result.options = BuildOptionsString(gameMode);
|
result.options = BuildOptionsString(gameMode);
|
||||||
return result;
|
return result;
|
||||||
@ -153,13 +155,14 @@ private function string BuildMutatorString(GameMode gameMode)
|
|||||||
local int i;
|
local int i;
|
||||||
local string result;
|
local string result;
|
||||||
local array<Text> usedMutators;
|
local array<Text> usedMutators;
|
||||||
|
|
||||||
usedMutators = gameMode.GetIncludedMutators();
|
usedMutators = gameMode.GetIncludedMutators();
|
||||||
for (i = 0; i < usedMutators.length; i += 1)
|
for (i = 0; i < usedMutators.length; i += 1)
|
||||||
{
|
{
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
result $= ",";
|
result $= ",";
|
||||||
}
|
}
|
||||||
result $= _.text.ToString(usedMutators[i]);
|
result $= _.text.IntoString(usedMutators[i]);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -171,11 +174,12 @@ private function string BuildOptionsString(GameMode gameMode)
|
|||||||
local string nextKey, nextValue;
|
local string nextKey, nextValue;
|
||||||
local CollectionIterator iter;
|
local CollectionIterator iter;
|
||||||
local HashTable options;
|
local HashTable options;
|
||||||
|
|
||||||
options = gameMode.GetOptions();
|
options = gameMode.GetOptions();
|
||||||
for (iter = options.Iterate(); !iter.HasFinished(); iter.Next())
|
for (iter = options.Iterate(); !iter.HasFinished(); iter.Next())
|
||||||
{
|
{
|
||||||
nextKey = _.text.ToString(Text(iter.GetKey()));
|
nextKey = _.text.IntoString(Text(iter.GetKey()));
|
||||||
nextValue = _.text.ToString(Text(iter.Get()));
|
nextValue = _.text.IntoString(Text(iter.Get()));
|
||||||
if (optionWasAdded) {
|
if (optionWasAdded) {
|
||||||
result $= "?";
|
result $= "?";
|
||||||
}
|
}
|
||||||
@ -197,6 +201,7 @@ public final function PrepareForServerTravel()
|
|||||||
local string nextGameClassName;
|
local string nextGameClassName;
|
||||||
local class<GameInfo> nextGameClass;
|
local class<GameInfo> nextGameClass;
|
||||||
local XVotingHandler votingHandler;
|
local XVotingHandler votingHandler;
|
||||||
|
|
||||||
if (votingHandlerReference == none) return;
|
if (votingHandlerReference == none) return;
|
||||||
votingHandler = XVotingHandler(votingHandlerReference.Get());
|
votingHandler = XVotingHandler(votingHandlerReference.Get());
|
||||||
if (votingHandler == none) return;
|
if (votingHandler == none) return;
|
||||||
@ -259,6 +264,7 @@ public final function GameMode SetupGameModeAfterTravel()
|
|||||||
public final function RestoreVotingHandlerConfigBackup()
|
public final function RestoreVotingHandlerConfigBackup()
|
||||||
{
|
{
|
||||||
local XVotingHandler votingHandler;
|
local XVotingHandler votingHandler;
|
||||||
|
|
||||||
if (votingHandlerReference == none) return;
|
if (votingHandlerReference == none) return;
|
||||||
votingHandler = XVotingHandler(votingHandlerReference.Get());
|
votingHandler = XVotingHandler(votingHandlerReference.Get());
|
||||||
if (votingHandler == none) return;
|
if (votingHandler == none) return;
|
||||||
@ -285,7 +291,8 @@ private final function int GetNumericDifficulty(GameMode gameMode)
|
|||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local string difficulty;
|
local string difficulty;
|
||||||
difficulty = Locs(_.text.ToString(gameMode.GetDifficulty()));
|
|
||||||
|
difficulty = Locs(_.text.IntoString(gameMode.GetDifficulty()));
|
||||||
for (i = 0; i < default.beginnerSynonyms.length; i += 1)
|
for (i = 0; i < default.beginnerSynonyms.length; i += 1)
|
||||||
{
|
{
|
||||||
if (IsPrefixOf(difficulty, default.beginnerSynonyms[i])) {
|
if (IsPrefixOf(difficulty, default.beginnerSynonyms[i])) {
|
||||||
|
Reference in New Issue
Block a user