From 92bbaef9c4aa19ae1a157cd37f94f5414dc4e464 Mon Sep 17 00:00:00 2001 From: Shtoyan Date: Tue, 7 Mar 2023 20:27:26 +0400 Subject: [PATCH] a --- config/AcediaMaps.ini | 10 ++++++--- sources/AcediaLauncherMut.uc | 1 + sources/StartUp.uc | 9 +++----- sources/VotingHandlerAdapter.uc | 40 +++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/config/AcediaMaps.ini b/config/AcediaMaps.ini index 5535019..c0ed975 100644 --- a/config/AcediaMaps.ini +++ b/config/AcediaMaps.ini @@ -1,3 +1,7 @@ -[defaultHard MapList] - -[defaultHOE MapList] \ No newline at end of file +[default MapList] +autoEnable=true +map="KF-BioticsLab" +map="KF-Farm" +map="KF-Manor" +map="KF-Offices" +map="KF-WestLondon" diff --git a/sources/AcediaLauncherMut.uc b/sources/AcediaLauncherMut.uc index 82ee6ca..194e34d 100644 --- a/sources/AcediaLauncherMut.uc +++ b/sources/AcediaLauncherMut.uc @@ -45,6 +45,7 @@ simulated function PreBeginPlay() } if (votingAdapter != none) { votingAdapter.InjectIntoVotingHandler(); + votingAdapter.TrySetupMapList(); } SetupMutatorSignals(); } diff --git a/sources/StartUp.uc b/sources/StartUp.uc index 87ee756..4556c35 100644 --- a/sources/StartUp.uc +++ b/sources/StartUp.uc @@ -50,7 +50,6 @@ private function InitializeServer() { local int i; local GameMode currentGameMode; - local MapList_Feature mapListFeature; local array availableFeatures; if (class'Packages'.default.clientside) { @@ -80,11 +79,6 @@ private function InitializeServer() } } EnableFeatures(availableFeatures); - - mapListFeature = MapList_Feature(class'MapList_Feature'.static.GetEnabledInstance()); - if (mapListFeature != none) { - warn("aaaaaaaa"); - } } // Checks whether Acedia has left garbage after the previous map. @@ -131,6 +125,9 @@ public function array GetAutoConfigurationInfo() local array result; availableFeatures = _.environment.GetAvailableFeatures(); + // We only have a single feature, so instead of adding our own manifest, simply add it here + class'MapList_Feature'.static.LoadConfigs(); + availableFeatures[availableFeatures.length] = class'MapList_Feature'; for (i = 0; i < availableFeatures.length; i += 1) { autoConfig = availableFeatures[i].static.GetAutoEnabledConfig(); diff --git a/sources/VotingHandlerAdapter.uc b/sources/VotingHandlerAdapter.uc index 94fa11e..d03d37e 100644 --- a/sources/VotingHandlerAdapter.uc +++ b/sources/VotingHandlerAdapter.uc @@ -139,6 +139,46 @@ public final function InjectIntoVotingHandler() votingHandler.gameConfig = newVotingHandlerConfig; } +public function TrySetupMapList() { + local MapList_Feature mapListFeature; + local Text currentConfigName; + local MapList currentConfig; + + warn(">>>>>>>> START!"); + mapListFeature = MapList_Feature(class'MapList_Feature'.static.GetEnabledInstance()); + currentConfigName = mapListFeature.GetCurrentConfig(); + currentConfig = MapList(class'MapList'.static.GetConfigInstance(currentConfigName)); + + ReplaceHandlerMaps(XVotingHandler(votingHandlerReference.Get()), currentConfig.map); +} + +public function ReplaceHandlerMaps(XVotingHandler votingHandler, array maps) { + local int i; + local VotingHandler.MapVoteMapList nextRecord; + local array recordArray; + + if (votingHandler == none) { + warn("votingHandler is none!"); + return; + } + if (maps.length == 0) { + warn("maps.length is 0!"); + return; + } + + recordArray = votingHandler.mapList; + warn(">>> recordArray.length =" $ recordArray.length); + + recordArray.length = maps.length; + + for (i = 0; i < maps.length; i += 1) { + nextRecord.mapName = maps[i]; + recordArray[recordArray.length] = nextRecord; + } + + votingHandler.mapList = recordArray; +} + private function VotingHandler.MapVoteGameConfig BuildVotingHandlerConfig( GameMode gameMode) {