From 96cf98f46fde73f4ec9b237fed2439e9cc28802e Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 3 May 2021 22:06:02 +0300 Subject: [PATCH] feat: change server name when changing mode --- ServerExtMut/Classes/xVoteWebApp.uc | 5 ++++- ServerExtMut/Classes/xVotingHandler.uc | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ServerExtMut/Classes/xVoteWebApp.uc b/ServerExtMut/Classes/xVoteWebApp.uc index 70e5a30..af80a55 100644 --- a/ServerExtMut/Classes/xVoteWebApp.uc +++ b/ServerExtMut/Classes/xVoteWebApp.uc @@ -124,6 +124,7 @@ function handleMapVotes(WebAdminQuery q) class'xVotingHandler'.Default.GameModes[i].Mutators = q.request.getVariable("MM",class'xVotingHandler'.Default.GameModes[i].GameName); class'xVotingHandler'.Default.GameModes[i].Options = q.request.getVariable("OP",class'xVotingHandler'.Default.GameModes[i].GameName); class'xVotingHandler'.Default.GameModes[i].Prefix = q.request.getVariable("PF",class'xVotingHandler'.Default.GameModes[i].GameName); + class'xVotingHandler'.Default.GameModes[i].ServerName = q.request.getVariable("SN",class'xVotingHandler'.Default.GameModes[i].GameName); class'xVotingHandler'.Static.StaticSaveConfig(); } EditSettingLine = -1; @@ -160,7 +161,7 @@ function handleMapVotes(WebAdminQuery q) q.response.SendText(""); q.response.SendText("
"); q.response.SendText(""); - q.response.SendText(""); + q.response.SendText(""); for (i=0; i"); } else @@ -182,6 +184,7 @@ function handleMapVotes(WebAdminQuery q) ""); } } diff --git a/ServerExtMut/Classes/xVotingHandler.uc b/ServerExtMut/Classes/xVotingHandler.uc index 5c482ee..a9450a4 100644 --- a/ServerExtMut/Classes/xVotingHandler.uc +++ b/ServerExtMut/Classes/xVotingHandler.uc @@ -3,7 +3,7 @@ Class xVotingHandler extends xVotingHandlerBase struct FGameModeOption { - var config string GameName,GameShortName,GameClass,Mutators,Options,Prefix; + var config string GameName,GameShortName,GameClass,Mutators,Options,Prefix,ServerName; }; var config array GameModes; var config int LastVotedGameInfo,VoteTime,MaxMapsOnList,VoteNumForOrgy; @@ -52,6 +52,7 @@ function PostBeginPlay() GameModes[0].GameClass = PathName(WorldInfo.Game.Class); GameModes[0].Mutators = ""; GameModes[0].Prefix = ""; + GameModes[0].ServerName = ""; MidGameVotePct = 0.51; MapWinPct = 0.75; VoteTime = 35; @@ -498,6 +499,12 @@ final function SwitchToLevel(int GameIndex, int MapIndex, bool bAdminForce) if (GameModes[GameIndex].Options!="") PendingMapURL $= "?"$GameModes[GameIndex].Options; `Log("MapVote: Switch map to "$PendingMapURL); + if (GameModes[GameIndex].ServerName != "") + { + WorldInfo.GRI.ServerName = GameModes[GameIndex].ServerName; + WorldInfo.GRI.SaveConfig(); + `Log("MapVote: Next ServerName: "$WorldInfo.GRI.ServerName); + } SetTimer(FMax(MapChangeDelay,0.1),false,'PendingSwitch'); }
Mapvote game modes
Game NameGame Short NameGame ClassMutatorsOptionsMap Prefix
Game NameGame Short NameGame ClassMutatorsOptionsMap PrefixServer Name
"$class'xVotingHandler'.Default.GameModes[i].Mutators$ ""$class'xVotingHandler'.Default.GameModes[i].Options$ ""$class'xVotingHandler'.Default.GameModes[i].Prefix$ + ""$class'xVotingHandler'.Default.GameModes[i].ServerName$ "