From 9c663f72ef6cd3b2be039399413ba26cf6fadd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20Falkowski?= Date: Thu, 13 Jun 2019 10:13:09 +0200 Subject: [PATCH] System messags + other changes * preparing for whitelist * changed default INI values in code, added configVer to INI * minor changes to workshop text * removed custom colour dummy variables for now as it is not yet implemented * no configVer bump for now * changed PC.ClientMessage to Game.Broadcast for now (more in line with original mod version) --- Classes/BRTSServerAds.uc | 24 +++++++++++++----------- KFBRTSServerAds.ini | 5 +++-- WorkshopReadme.txt | 6 +++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Classes/BRTSServerAds.uc b/Classes/BRTSServerAds.uc index b0b5ab4..c0848f5 100644 --- a/Classes/BRTSServerAds.uc +++ b/Classes/BRTSServerAds.uc @@ -57,11 +57,9 @@ var int CurrentMsgID; // ---------------- .ini file variables ---------------------- var config array ServerAdsList; // Messages -// ToDo: add RandomMsgList or bRandomOrder for random order var config float MsgInterval; // Time between messages var config bool bUse24HrFormat; // 24h switch -var config bool bUseRandomColor; -var config int ConfigVer; +var config int ConfigVer; // Version control for INI // -------------------- INIT ---------------------------- function PostBeginPlay() @@ -81,12 +79,13 @@ function PostBeginPlay() function UpdateConfigs() { + // If missing, create INI with default values if( ConfigVer == 0 ) { ConfigVer = 1; - MsgInterval = 180.f; + MsgInterval = 45.f; bUse24HrFormat = true; - bUseRandomColor = false; + ServerAdsList.AddItem("Welcome to" @ SupportedWildcards[0]); SaveConfig(); } } @@ -94,7 +93,7 @@ function UpdateConfigs() // -------------------- TOKEN FUNCTIONS ---------------------------- /** - Gets fresh values for dynamic information like time or players for the wildcard struct. + Gets dynamic information like time or players for the wildcard struct. **/ function RefreshWildcardValues() { @@ -106,7 +105,6 @@ function RefreshWildcardValues() DTG = GetDateTime(); WildCardList.Length = 0; - // ToDo: Replace tokens like SEC and MIN by HH:MM:SS and HH:MM etc.. Seconds on their own are useless for( i = 0; i < SupportedWildcards.Length; i++ ) { found = true; @@ -260,14 +258,18 @@ auto state Loop { msgID = CurrentMsgID; sMsg = ReplWildcardsInString(ServerAdsList[msgID]); + foreach WorldInfo.AllControllers(class'PlayerController', PC) { - if( PC.bIsPlayer ) PC.ClientMessage(sMsg, 'FFFFFF'); //Freebase*: default color is White (New color Ex. 02D1FA) - //Will add a custom color system when I have more time + // System Announcement + if( PC.bIsPlayer ) WorldInfo.Game.Broadcast(PC, sMsg); } + } + // Queue next message CurrentMsgID++; - // If reached last msg, start from the first again + + // If reached last msg already, start from the first again if( CurrentMsgID >= (ServerAdsList.Length) ) CurrentMsgID = 0; } @@ -275,7 +277,7 @@ Begin: BroadcastMsg(); Sleep(MsgInterval); goto 'Begin'; - stop; + stop; } defaultproperties diff --git a/KFBRTSServerAds.ini b/KFBRTSServerAds.ini index 67eb327..3bf183d 100644 --- a/KFBRTSServerAds.ini +++ b/KFBRTSServerAds.ini @@ -1,8 +1,9 @@ # Move or copy this file to %server_root%\killingfloor2\KFGame\Config\KFBRTSServerAds.ini [BRTSServerAds.BRTSServerAds] +MsgInterval=60 +bUse24HrFormat=True ServerAdsList=Welcome to {SERVERNAME} ServerAdsList=Server time: {HR}:{MIN} {AMPM} #ServerAdsList=Debug {HR}:{MIN}:{SEC} {AMPM} {DAY}-{MTH}-{YR} | {SDAY} / {SMTH} ServerAdsList={MAPNAME} Players: {PLAYERCOUNT}/{SERVERSLOTS} -MsgInterval=60 -bUse24HrFormat=True +ConfigVer=1 diff --git a/WorkshopReadme.txt b/WorkshopReadme.txt index 2f0ec43..05eab52 100644 --- a/WorkshopReadme.txt +++ b/WorkshopReadme.txt @@ -2,11 +2,11 @@ Brutus ServerAds ServerActor (original from FZFalzar) let's you display customisable server messages. [h1]Installation[/h1] -Please refer to the [url=https://forums.tripwireinteractive.com/forum/killing-floor-2/killing-floor-2-modifications/general-modding-discussion-ad/beta-mod-releases/109273-mutator-brutus-serverads-serveractor]forum thread[/url] for help and instructions. Subscribing to this mutator will save you the process of recompiling and/or reuploading the BRTSServerAds.u file. You can subscribe directly to get the .u file or subscribe with your server to automate the process. Instructions on how to subscribe your server to Steam Workshop can be found [url=http://wiki.tripwireinteractive.com/index.php?title=Dedicated_Server_(Killing_Floor_2)#Setting_Up_Steam_Workshop_For_Servers]here[/url]. +This is a ServerActor and has to be added in the server config instead of the start parameters (not like loading mutators). See readme on GitHub or refer to the [url=https://forums.tripwireinteractive.com/forum/killing-floor-2/killing-floor-2-modifications/general-modding-discussion-ad/beta-mod-releases/109273-mutator-brutus-serverads-serveractor]forum thread[/url] for help and instructions. Subscribing to this mutator will save you the process of recompiling and/or reuploading the BRTSServerAds.u file. You can subscribe directly to get the .u file or subscribe with your server to automate the process. Instructions on how to subscribe your server to Steam Workshop can be found [url=http://wiki.tripwireinteractive.com/index.php?title=Dedicated_Server_(Killing_Floor_2)#Setting_Up_Steam_Workshop_For_Servers]here[/url]. [h1]Source[/h1] Official thread: [url=https://forums.tripwireinteractive.com/forum/killing-floor-2/killing-floor-2-modifications/general-modding-discussion-ad/beta-mod-releases/109273-mutator-brutus-serverads-serveractor]TWI forums[/url] -Source control: [url=https://github.com/wookiefriseur/KF2-BRTSServerAds]GitHub[/url] +Sourcecode: [url=https://github.com/wookiefriseur/KF2-BRTSServerAds]GitHub[/url] [h1]Support and Collaboration[/h1] -If you find any issues or have requests open a new GitHub issue. If you need support please refer to the official thread. I will try to keep this item up to date but I have to do it manually (I do not have a build pipeline for this). So if you see a new version on GitHub that isn't here in the Steam Workshop yet, just let me know and I will update it. If you are interested on helping to maintain this item let me know. If you want to improve the code feel free to fork it on GitHub and make pull requests. +If you find any issues or have requests open a new GitHub issue. If you need support please refer to the official thread. I will try to keep this item up to date but I have to do it manually (I do not have a build pipeline for this). So if you see a working version with new features on GitHub that isn't here in the Steam Workshop yet, just let me know and I will update it. If you are interested on helping to maintain this item let me know. If you want to improve the code feel free to fork it on GitHub and make pull requests. \ No newline at end of file