Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shtoyan committed Sep 23, 2022
1 parent e64d460 commit 7e5d7e9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
56 changes: 31 additions & 25 deletions Classes/CSDMasterServerUplink.uc
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ var private array<GameInfo.KeyValuePair> cachedServerInfo;
// ==========================================================================
event postBeginPlay()
{
// ConsoleCommand("PROFILESCRIPT START");
// start the timer with config delay
setTimer(refreshTime, true);

// add to the game special custom GameRules
// so these GameRules will add extra details on the server description
if (AdditionalSD == none)
Expand All @@ -102,6 +98,31 @@ event postBeginPlay()
if (inStr(playerAliveNicknamePattern, "%nickname%") == -1)
log("CustomServerDetails[WARNING]: You set 'bAnotherNicknamesStyle=true'. But you didn't paste %nickname% in 'playerAliveNicknamePattern'. JUST DO IT!");
}

// ConsoleCommand("PROFILESCRIPT START");
// start the timer with config delay
setTimer(refreshTime, true);
}


final private function CacheStuff()
{
// filter/add/change server details
if (bChangeServerDetails)
{
filterServerDetails();
}

if (bMapColor)
{
cachedColoredMapName = class'o_Utility'.static.ParseTags(mapColor $ srl.mapName);
srl.mapName = cachedColoredMapName;
}

cachedServerInfo = srl.ServerInfo;
serverState = srl;

bInit = true;
}


Expand All @@ -125,36 +146,21 @@ event timer()
getServerPlayers();
level.game.getServerDetails(srl);

// change server name to custom one
if (bCustomServerName)
dynamicChangeServerName();

if (!bInit)
{
// filter/add/change server details
if (bChangeServerDetails)
{
filterServerDetails();
}

if (bMapColor)
{
cachedColoredMapName = class'o_Utility'.static.ParseTags(mapColor $ srl.mapName);
srl.mapName = cachedColoredMapName;
}

cachedServerInfo = srl.ServerInfo;
serverState = srl;
bInit = true;
}
CacheStuff();
else
{
// change server name to custom one
if (bCustomServerName)
dynamicChangeServerName();

if (bMapColor)
srl.mapName = cachedColoredMapName;

srl.ServerInfo = cachedServerInfo;
serverState = srl;
}

// uncomment if you want to measure whole mod impact in performance
// UnClock(f);
// log("Timer() job done in - "@f);
Expand Down
2 changes: 1 addition & 1 deletion Classes/o_Utility.uc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final static function Init()
default.cachedColoredStrings[i] = class'GameInfo'.static.MakeColorCode(default.ColorList[i].Color);
}
default.bInit = true;
log(">>>>>>>>>> All tags and colored strings cached!");
// log(">>>>>>>>>> All tags and colored strings cached!");
}
}

Expand Down

0 comments on commit 7e5d7e9

Please sign in to comment.