more readability

This commit is contained in:
GenZmeY 2021-06-09 00:21:28 +03:00
parent f9947ca798
commit 8b15531abd
10 changed files with 136 additions and 136 deletions

View File

@ -17,9 +17,9 @@ var KFPlayerController OwnerPC;
var Color PingColor;
var float PingBars,IdealPing,MaxPing;
// Groups
var array<PlayerGroupEntry> PlayerGroups;
var array<UIDInfoEntry> PlayerInfos;
// Ranks
var array<RankInfo> PlayerRanks;
var array<UIDRankRelation> PlayerInfos;
var string SystemAdminRank;
var ColorRGB SystemAdminColor;
@ -325,46 +325,46 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
local bool bIsZED;
local int Ping;
local PlayerGroupEntry Group;
local bool HasGroup;
local int PlayerInfoIndex, PlayerGroupIndex;
local RankInfo CurrentRank;
local bool HasRank;
local int PlayerInfoIndex, PlayerRankIndex;
YOffset *= 1.05;
KFPRI = KFPRIArray[Index];
HasGroup = false;
HasRank = false;
PlayerInfoIndex = PlayerInfos.Find('UID', KFPRI.UniqueId);
if (PlayerInfoIndex != INDEX_NONE )
{
PlayerGroupIndex = PlayerGroups.Find('ID', PlayerInfos[PlayerInfoIndex].GroupID);
if (PlayerGroupIndex != INDEX_NONE)
PlayerRankIndex = PlayerRanks.Find('ID', PlayerInfos[PlayerInfoIndex].RankID);
if (PlayerRankIndex != INDEX_NONE)
{
HasGroup = true;
Group = PlayerGroups[PlayerGroupIndex];
HasRank = true;
CurrentRank = PlayerRanks[PlayerRankIndex];
}
}
if (KFPRI.bAdmin)
{
if (!HasGroup || (HasGroup && !Group.OverrideAdminRank))
if (!HasRank || (HasRank && !CurrentRank.OverrideAdminRank))
{
Group.Rank = SystemAdminRank;
Group.TextColor = SystemAdminColor;
Group.ApplyColorToFields = SystemAdminApplyColorToFields;
HasGroup = true;
CurrentRank.Rank = SystemAdminRank;
CurrentRank.TextColor = SystemAdminColor;
CurrentRank.ApplyColorToFields = SystemAdminApplyColorToFields;
HasRank = true;
}
}
else // Player
{
if (!HasGroup)
if (!HasRank)
{
Group.Rank = SystemPlayerRank;
Group.TextColor = SystemPlayerColor;
Group.ApplyColorToFields = SystemPlayerApplyColorToFields;
HasGroup = true;
CurrentRank.Rank = SystemPlayerRank;
CurrentRank.TextColor = SystemPlayerColor;
CurrentRank.ApplyColorToFields = SystemPlayerApplyColorToFields;
HasRank = true;
}
}
// Now all players belongs to 'Group'
// Now all players belongs to 'Rank'
if( KFGRI.bVersusGame )
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
@ -436,9 +436,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.SetDrawColor(250,250,250,255);
// Rank
if (Group.ApplyColorToFields.Rank)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
S = Group.Rank;
if (CurrentRank.ApplyColorToFields.Rank)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
S = CurrentRank.Rank;
DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar);
C.SetDrawColor(250,250,250,255);
@ -446,8 +446,8 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
if( bIsZED )
{
C.SetDrawColor(255,0,0,255);
if (Group.ApplyColorToFields.Perk)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Perk)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
C.SetPos (PerkXPos, YOffset - ((Height-5) * 0.5f));
C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF');
@ -482,16 +482,16 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
}
C.SetDrawColor(250,250,250,255);
if (Group.ApplyColorToFields.Perk)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Perk)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
S = Level@KFPRI.CurrentPerkClass.default.PerkName;
DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar);
}
else
{
C.SetDrawColor(250,250,250,255);
if (Group.ApplyColorToFields.Perk)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Perk)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
S = "No Perk";
DrawTextShadowHLeftVCenter(S, PerkXPos, TextYOffset, FontScalar);
}
@ -514,8 +514,8 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.SetDrawColor(250,250,250,255);
// Player
if (Group.ApplyColorToFields.Player)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Player)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
if( Len(KFPRI.PlayerName) > 25 )
S = Left(KFPRI.PlayerName, 25);
else S = KFPRI.PlayerName;
@ -524,14 +524,14 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.SetDrawColor(250,250,250,255);
// Kill
if (Group.ApplyColorToFields.Kills)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Kills)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar);
C.SetDrawColor(250,250,250,255);
// Assist
if (Group.ApplyColorToFields.Assists)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Assists)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
C.SetDrawColor(250,250,250,255);
@ -546,8 +546,8 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.SetDrawColor(250, 250, 100, 255);
StrValue = GetNiceSize(int(KFPRI.Score));
}
if (Group.ApplyColorToFields.Dosh)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Dosh)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);
C.SetDrawColor(250,250,250,255);
@ -585,8 +585,8 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
S = string (KFPRI.PlayerHealth) @"HP";
}
if (Group.ApplyColorToFields.Health)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Health)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
DrawTextShadowHVCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar);
C.SetDrawColor(250,250,250,255);
@ -608,8 +608,8 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
}
C.TextSize(MaxPing, XL, YL, FontScalar, FontScalar);
if (Group.ApplyColorToFields.Ping)
C.SetDrawColor(Group.TextColor.R,Group.TextColor.G,Group.TextColor.B,255);
if (CurrentRank.ApplyColorToFields.Ping)
C.SetDrawColor(CurrentRank.TextColor.R,CurrentRank.TextColor.G,CurrentRank.TextColor.B,255);
DrawTextShadowHVCenter(S, PingXPos, TextYOffset, PingWBox/2, FontScalar);
C.SetDrawColor(250,250,250,255);

View File

@ -1,5 +0,0 @@
class PlayerGroups extends Object
dependson(Types)
config(ScoreboardExt);
var config array<PlayerGroupEntry> PlayerGroup;

View File

@ -2,4 +2,4 @@ class PlayerInfos extends Object
dependson(Types)
config(ScoreboardExt);
var config array<PlayerInfoEntry> PlayerInfo;
var config array<PlayerRankRelation> PlayerInfo;

View File

@ -0,0 +1,5 @@
class PlayerRanks extends Object
dependson(Types)
config(ScoreboardExt);
var config array<RankInfo> PlayerRank;

View File

@ -1,5 +1,5 @@
class ScoreboardExtMut extends KFMutator
dependson(PlayerGroups, PlayerInfos)
dependson(PlayerRanks, PlayerInfos)
config(ScoreboardExt);
const SteamIDLen = 17;
@ -17,7 +17,7 @@ struct SClient
var private array<SClient> RepClients;
var private array<UIDInfoEntry> UIDInfos;
var private array<UIDRankRelation> UIDInfos;
function PostBeginPlay()
{
@ -41,9 +41,9 @@ function NotifyLogout(Controller C)
private function InitConfig()
{
local PlayerGroupEntry ExampleGroup;
local PlayerInfoEntry ExamplePlayer;
local SteamGroupEntry ExampleSteamGroup;
local RankInfo ExampleRank;
local PlayerRankRelation ExamplePlayer;
local SteamGroupRankRelation ExampleSteamGroup;
// Update from config version to current version if needed
switch (ConfigVersion)
@ -52,48 +52,48 @@ private function InitConfig()
SaveConfig(); // because I want the main settings to be at the beginning of the config :)
// Default admin rank
class'SystemAdminGroup'.default.Rank = "Admin";
class'SystemAdminGroup'.default.TextColor.R = 250;
class'SystemAdminGroup'.default.TextColor.G = 0;
class'SystemAdminGroup'.default.TextColor.B = 0;
class'SystemAdminRank'.default.Rank = "Admin";
class'SystemAdminRank'.default.TextColor.R = 250;
class'SystemAdminRank'.default.TextColor.G = 0;
class'SystemAdminRank'.default.TextColor.B = 0;
// Default player rank
class'SystemPlayerGroup'.default.Rank = "Player";
class'SystemPlayerGroup'.default.TextColor.R = 250;
class'SystemPlayerGroup'.default.TextColor.G = 250;
class'SystemPlayerGroup'.default.TextColor.B = 250;
class'SystemPlayerRank'.default.Rank = "Player";
class'SystemPlayerRank'.default.TextColor.R = 250;
class'SystemPlayerRank'.default.TextColor.G = 250;
class'SystemPlayerRank'.default.TextColor.B = 250;
// Example rank for player(s)
ExampleGroup.ID = 0;
ExampleGroup.Rank = "SCE Creator";
ExampleGroup.TextColor.R = 130;
ExampleGroup.TextColor.G = 250;
ExampleGroup.TextColor.B = 235;
ExampleGroup.OverrideAdminRank = true;
class'PlayerGroups'.default.PlayerGroup.AddItem(ExampleGroup);
ExampleRank.ID = 0;
ExampleRank.Rank = "SCE Creator";
ExampleRank.TextColor.R = 130;
ExampleRank.TextColor.G = 250;
ExampleRank.TextColor.B = 235;
ExampleRank.OverrideAdminRank = true;
class'PlayerRanks'.default.PlayerRank.AddItem(ExampleRank);
// Example player
ExamplePlayer.PlayerID = "76561198001617867"; // GenZmeY SteamID64
ExamplePlayer.GroupID = ExampleGroup.ID;
ExamplePlayer.RankID = ExampleRank.ID;
class'PlayerInfos'.default.PlayerInfo.AddItem(ExamplePlayer);
// Example rank for steam group members
ExampleGroup.ID = 1;
ExampleGroup.Rank = "[MSK-GS]";
ExampleGroup.TextColor.R = 130;
ExampleGroup.TextColor.G = 250;
ExampleGroup.TextColor.B = 130;
ExampleGroup.OverrideAdminRank = false;
class'PlayerGroups'.default.PlayerGroup.AddItem(ExampleGroup);
ExampleRank.ID = 1;
ExampleRank.Rank = "[MSK-GS]";
ExampleRank.TextColor.R = 130;
ExampleRank.TextColor.G = 250;
ExampleRank.TextColor.B = 130;
ExampleRank.OverrideAdminRank = false;
class'PlayerRanks'.default.PlayerRank.AddItem(ExampleRank);
// Example steam group
ExampleSteamGroup.SteamGroupID = "103582791465384046"; // MSK-GS SteamID64
ExampleSteamGroup.GroupID = ExampleGroup.ID;
ExampleSteamGroup.RankID = ExampleRank.ID;
class'SteamGroups'.default.SteamGroup.AddItem(ExampleSteamGroup);
class'SystemAdminGroup'.static.StaticSaveConfig();
class'SystemPlayerGroup'.static.StaticSaveConfig();
class'PlayerGroups'.static.StaticSaveConfig();
class'SystemAdminRank'.static.StaticSaveConfig();
class'SystemPlayerRank'.static.StaticSaveConfig();
class'PlayerRanks'.static.StaticSaveConfig();
class'PlayerInfos'.static.StaticSaveConfig();
class'SteamGroups'.static.StaticSaveConfig();
@ -119,15 +119,15 @@ private function InitConfig()
private function LoadGroupPlayers()
{
local PlayerInfoEntry Player;
local PlayerRankRelation Player;
local OnlineSubsystem steamworks;
local UIDInfoEntry UIDInfo;
local UIDRankRelation UIDInfo;
steamworks = class'GameEngine'.static.GetOnlineSubsystem();
foreach class'PlayerInfos'.default.PlayerInfo(Player)
{
UIDInfo.GroupID = Player.GroupID;
UIDInfo.RankID = Player.RankID;
if (Len(Player.PlayerID) == UniqueIDLen && steamworks.StringToUniqueNetId(Player.PlayerID, UIDInfo.UID))
{
if (UIDInfos.Find('Uid', UIDInfo.UID) == INDEX_NONE)
@ -157,13 +157,13 @@ function AddPlayerInfo(Controller C)
RepClients.AddItem(RepClient);
RepClient.RepInfo.PlayerInfos = UIDInfos;
RepClient.RepInfo.PlayerGroups = class'PlayerGroups'.default.PlayerGroup;
RepClient.RepInfo.SystemAdminRank = class'SystemAdminGroup'.default.Rank;
RepClient.RepInfo.SystemAdminColor = class'SystemAdminGroup'.default.TextColor;
RepClient.RepInfo.SystemAdminApplyColorToFields = class'SystemAdminGroup'.default.ApplyColorToFields;
RepClient.RepInfo.SystemPlayerRank = class'SystemPlayerGroup'.default.Rank;
RepClient.RepInfo.SystemPlayerColor = class'SystemPlayerGroup'.default.TextColor;
RepClient.RepInfo.SystemPlayerApplyColorToFields = class'SystemPlayerGroup'.default.ApplyColorToFields;
RepClient.RepInfo.PlayerRanks = class'PlayerRanks'.default.PlayerRank;
RepClient.RepInfo.SystemAdminRank = class'SystemAdminRank'.default.Rank;
RepClient.RepInfo.SystemAdminColor = class'SystemAdminRank'.default.TextColor;
RepClient.RepInfo.SystemAdminApplyColorToFields = class'SystemAdminRank'.default.ApplyColorToFields;
RepClient.RepInfo.SystemPlayerRank = class'SystemPlayerRank'.default.Rank;
RepClient.RepInfo.SystemPlayerColor = class'SystemPlayerRank'.default.TextColor;
RepClient.RepInfo.SystemPlayerApplyColorToFields = class'SystemPlayerRank'.default.ApplyColorToFields;
RepClient.RepInfo.ClientStartReplication();
}

View File

@ -1,7 +1,7 @@
class ScoreboardExtRepInfo extends ReplicationInfo;
var public array<UIDInfoEntry> PlayerInfos;
var public array<PlayerGroupEntry> PlayerGroups;
var public array<UIDRankRelation> PlayerInfos;
var public array<RankInfo> PlayerRanks;
var public string SystemAdminRank;
var public ColorRGB SystemAdminColor;
@ -11,12 +11,12 @@ var public string SystemPlayerRank;
var public ColorRGB SystemPlayerColor;
var public Fields SystemPlayerApplyColorToFields;
var private bool SystemFinished, GroupsFinished, InfosFinished;
var private int InfosReplicateProgress, GroupsReplicateProgress;
var private bool InitFinished, RanksFinished, InfosFinished;
var private int InfosReplicateProgress, RanksReplicateProgress;
var private KFScoreBoard SC;
public final function ClientStartReplication()
public function ClientStartReplication()
{
GetScoreboard();
@ -28,25 +28,25 @@ public final function ClientStartReplication()
SystemPlayerColor,
SystemPlayerApplyColorToFields);
SetTimer(0.01f, true, nameof(ClientReplicateGroups));
SetTimer(0.01f, true, nameof(ClientReplicateRanks));
SetTimer(0.01f, true, nameof(ClientReplicateInfos));
}
public final function ClientReplicateGroups()
public function ClientReplicateRanks()
{
if (GroupsReplicateProgress < PlayerGroups.Length)
if (RanksReplicateProgress < PlayerRanks.Length)
{
ClientAddPlayerGroup(PlayerGroups[GroupsReplicateProgress]);
++GroupsReplicateProgress;
ClientAddPlayerRank(PlayerRanks[RanksReplicateProgress]);
++RanksReplicateProgress;
}
else
{
ClearTimer(nameof(ClientReplicateGroups));
GroupReplicationFinished();
ClearTimer(nameof(ClientReplicateRanks));
RankReplicationFinished();
}
}
public final function ClientReplicateInfos()
public function ClientReplicateInfos()
{
if (InfosReplicateProgress < PlayerInfos.Length)
{
@ -60,7 +60,7 @@ public final function ClientReplicateInfos()
}
}
private reliable client final function GetScoreboard()
private reliable client function GetScoreboard()
{
if (SC != None)
{
@ -72,29 +72,29 @@ private reliable client final function GetScoreboard()
SetTimer(0.1f, false, nameof(GetScoreboard));
}
private reliable client final function ClientAddPlayerGroup(PlayerGroupEntry Group)
private reliable client function ClientAddPlayerRank(RankInfo Rank)
{
PlayerGroups.AddItem(Group);
PlayerRanks.AddItem(Rank);
}
private reliable client final function ClientAddPlayerInfo(UIDInfoEntry PlayerInfo)
private reliable client function ClientAddPlayerInfo(UIDRankRelation PlayerInfo)
{
PlayerInfos.AddItem(PlayerInfo);
}
private reliable client final function GroupReplicationFinished()
private reliable client function RankReplicationFinished()
{
GroupsFinished = true;
ClientGroupsApply();
RanksFinished = true;
ClientRanksApply();
}
private reliable client final function InfosReplicationFinished()
private reliable client function InfosReplicationFinished()
{
InfosFinished = true;
ClientInfosApply();
}
private reliable client final function ClientInitSystem(
private reliable client function ClientInitSystem(
string _SystemAdminRank,
ColorRGB _SystemAdminColor,
Fields _SystemAdminApplyColorToFields,
@ -112,7 +112,7 @@ private reliable client final function ClientInitSystem(
ClientSystemApply();
}
private reliable client final function ClientSystemApply()
private reliable client function ClientSystemApply()
{
if (SC == None)
{
@ -127,24 +127,24 @@ private reliable client final function ClientSystemApply()
SC.SystemPlayerColor = SystemPlayerColor;
SC.SystemPlayerApplyColorToFields = SystemPlayerApplyColorToFields;
SystemFinished = true;
InitFinished = true;
Finished();
}
private reliable client final function ClientGroupsApply()
private reliable client function ClientRanksApply()
{
if (SC == None)
{
SetTimer(0.1f, false, nameof(ClientGroupsApply));
SetTimer(0.1f, false, nameof(ClientRanksApply));
return;
}
SC.PlayerGroups = PlayerGroups;
GroupsFinished = true;
SC.PlayerRanks = PlayerRanks;
RanksFinished = true;
Finished();
}
private reliable client final function ClientInfosApply()
private reliable client function ClientInfosApply()
{
if (SC == None)
{
@ -153,22 +153,22 @@ private reliable client final function ClientInfosApply()
}
SC.PlayerInfos = PlayerInfos;
GroupsFinished = true;
RanksFinished = true;
Finished();
}
private reliable client final function Finished()
private reliable client function Finished()
{
if (SystemFinished && GroupsFinished && InfosFinished)
if (InitFinished && RanksFinished && InfosFinished)
Destroy();
}
defaultproperties
{
InfosReplicateProgress=0
GroupsReplicateProgress=0
RanksReplicateProgress=0
SystemFinished=false
GroupsFinished=false
InitFinished=false
RanksFinished=false
InfosFinished=false
}

View File

@ -2,7 +2,7 @@ class SteamGroups extends Object
dependson(Types)
config(ScoreboardExt);
var config array<SteamGroupEntry> SteamGroup;
var config array<SteamGroupRankRelation> SteamGroup;
DefaultProperties
{

View File

@ -1,4 +1,4 @@
class SystemAdminGroup extends Object
class SystemAdminRank extends Object
dependson(Types)
config(ScoreboardExt);

View File

@ -1,4 +1,4 @@
class SystemPlayerGroup extends Object
class SystemPlayerRank extends Object
dependson(Types)
config(ScoreboardExt);

View File

@ -49,7 +49,7 @@ struct Fields
}
};
struct PlayerGroupEntry
struct RankInfo
{
var int ID;
var string Rank;
@ -58,20 +58,20 @@ struct PlayerGroupEntry
var Fields ApplyColorToFields;
};
struct SteamGroupEntry
struct SteamGroupRankRelation
{
var string SteamGroupID;
var int GroupID;
var int RankID;
};
struct PlayerInfoEntry
struct PlayerRankRelation
{
var string PlayerID;
var int GroupID;
var int RankID;
};
struct UIDInfoEntry
struct UIDRankRelation
{
var UniqueNetId UID;
var int GroupID;
var int RankID;
};