Skip to content
This repository has been archived by the owner on Feb 6, 2021. It is now read-only.

Commit

Permalink
System messags + other changes
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
wookiefriseur committed Jun 13, 2019
1 parent c889044 commit 9c663f7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
24 changes: 13 additions & 11 deletions Classes/BRTSServerAds.uc
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ var int CurrentMsgID;

// ---------------- .ini file variables ----------------------
var config array<config string> 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()
Expand All @@ -81,20 +79,21 @@ 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();
}
}

// -------------------- 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()
{
Expand All @@ -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;
Expand Down Expand Up @@ -260,22 +258,26 @@ 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;
}

Begin:
BroadcastMsg();
Sleep(MsgInterval);
goto 'Begin';
stop;
stop;
}

defaultproperties
Expand Down
5 changes: 3 additions & 2 deletions KFBRTSServerAds.ini
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions WorkshopReadme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 9c663f7

Please sign in to comment.