add VoteTime setting
This commit is contained in:
parent
a881c1ef93
commit
3379596de4
@ -7,6 +7,7 @@ var public config String NegativeColorHex;
|
|||||||
var public config bool bChatNotifications;
|
var public config bool bChatNotifications;
|
||||||
var public config bool bHudNotifications;
|
var public config bool bHudNotifications;
|
||||||
var public config float DefferedClearHUD;
|
var public config float DefferedClearHUD;
|
||||||
|
var public config int VoteTime;
|
||||||
|
|
||||||
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
||||||
{
|
{
|
||||||
@ -17,6 +18,9 @@ public static function InitConfig(int Version, int LatestVersion, E_LogLevel Log
|
|||||||
case `NO_CONFIG:
|
case `NO_CONFIG:
|
||||||
ApplyDefault(LogLevel);
|
ApplyDefault(LogLevel);
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
default.VoteTime = class'KFVoteCollector'.default.VoteTime;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +51,12 @@ public static function Load(E_LogLevel LogLevel)
|
|||||||
`Log_Error("DefferedClearHUD" @ "(" $ default.DefferedClearHUD $ ")" @ "must be greater than 0");
|
`Log_Error("DefferedClearHUD" @ "(" $ default.DefferedClearHUD $ ")" @ "must be greater than 0");
|
||||||
default.DefferedClearHUD = 0.0f;
|
default.DefferedClearHUD = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (default.VoteTime <= 0 || default.VoteTime > 255)
|
||||||
|
{
|
||||||
|
`Log_Error("VoteTime" @ "(" $ default.VoteTime $ ")" @ "must be in range 1-255");
|
||||||
|
default.VoteTime = class'KFVoteCollector'.default.VoteTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function ApplyDefault(E_LogLevel LogLevel)
|
protected static function ApplyDefault(E_LogLevel LogLevel)
|
||||||
@ -58,6 +68,7 @@ protected static function ApplyDefault(E_LogLevel LogLevel)
|
|||||||
default.PositiveColorHex = class'KFLocalMessage'.default.EventColor;
|
default.PositiveColorHex = class'KFLocalMessage'.default.EventColor;
|
||||||
default.NegativeColorHex = class'KFLocalMessage'.default.InteractionColor;
|
default.NegativeColorHex = class'KFLocalMessage'.default.InteractionColor;
|
||||||
default.DefferedClearHUD = 1.0f;
|
default.DefferedClearHUD = 1.0f;
|
||||||
|
default.VoteTime = class'KFVoteCollector'.default.VoteTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel)
|
protected static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel)
|
||||||
|
@ -2,7 +2,7 @@ class CVC extends Info
|
|||||||
dependson(CVC_LocalMessage)
|
dependson(CVC_LocalMessage)
|
||||||
config(CVC);
|
config(CVC);
|
||||||
|
|
||||||
const LatestVersion = 1;
|
const LatestVersion = 2;
|
||||||
|
|
||||||
const CfgKickProtected = class'KickProtected';
|
const CfgKickProtected = class'KickProtected';
|
||||||
const CfgKickVote = class'KickVote';
|
const CfgKickVote = class'KickVote';
|
||||||
@ -79,6 +79,8 @@ private function PreInit()
|
|||||||
case `NO_CONFIG:
|
case `NO_CONFIG:
|
||||||
`Log_Info("Config created");
|
`Log_Info("Config created");
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
|
||||||
case MaxInt:
|
case MaxInt:
|
||||||
`Log_Info("Config updated to version"@LatestVersion);
|
`Log_Info("Config updated to version"@LatestVersion);
|
||||||
break;
|
break;
|
||||||
|
@ -15,19 +15,17 @@ public event PreBeginPlay()
|
|||||||
|
|
||||||
foreach WorldInfo.DynamicActors(class'CVC', CVC)
|
foreach WorldInfo.DynamicActors(class'CVC', CVC)
|
||||||
{
|
{
|
||||||
`Log_Base("Found 'CVC'");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVC == None)
|
if (CVC == None)
|
||||||
{
|
{
|
||||||
`Log_Base("Spawn 'CVC'");
|
|
||||||
CVC = WorldInfo.Spawn(class'CVC');
|
CVC = WorldInfo.Spawn(class'CVC');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVC == None)
|
if (CVC == None)
|
||||||
{
|
{
|
||||||
`Log_Base("Can't Spawn 'CVC', Destroy...");
|
`Log_Base("FATAL: Can't Spawn 'CVC'");
|
||||||
SafeDestroy();
|
SafeDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
|
|||||||
GetKFPRIArray(KFPRIs);
|
GetKFPRIArray(KFPRIs);
|
||||||
foreach KFPRIs(KFPRI)
|
foreach KFPRIs(KFPRI)
|
||||||
{
|
{
|
||||||
KFPRI.ShowKickVote(PRI_Kickee, VoteTime, !(KFPRI == PRI_Kicker || KFPRI == PRI_Kickee));
|
KFPRI.ShowKickVote(PRI_Kickee, CfgKickVote.default.VoteTime, !(KFPRI == PRI_Kicker || KFPRI == PRI_Kickee));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CfgKickVote.default.bChatNotifications)
|
if (CfgKickVote.default.bChatNotifications)
|
||||||
@ -197,7 +197,7 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
|
|||||||
AllowHudNotification = bTraderIsOpen;
|
AllowHudNotification = bTraderIsOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTimer(VoteTime, false, nameof(ConcludeVoteKick), Self);
|
SetTimer(CfgKickVote.default.VoteTime, false, nameof(ConcludeVoteKick), Self);
|
||||||
|
|
||||||
RecieveVoteKick(PRI_Kicker, true);
|
RecieveVoteKick(PRI_Kicker, true);
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ public reliable server function RecieveVoteKick(PlayerReplicationInfo PRI, bool
|
|||||||
{
|
{
|
||||||
CVC.BroadcastHUDLocalized(
|
CVC.BroadcastHUDLocalized(
|
||||||
CVC_KickVoteStartedHUD,
|
CVC_KickVoteStartedHUD,
|
||||||
float(VoteTime),
|
float(CfgKickVote.default.VoteTime),
|
||||||
KickerName,
|
KickerName,
|
||||||
KickeeName,
|
KickeeName,
|
||||||
YesVotesPlayers);
|
YesVotesPlayers);
|
||||||
@ -391,7 +391,7 @@ public reliable server function RecieveVoteKick(PlayerReplicationInfo PRI, bool
|
|||||||
{
|
{
|
||||||
CVC.BroadcastHUDLocalized(
|
CVC.BroadcastHUDLocalized(
|
||||||
CVC_KickVoteReceivedHUD,
|
CVC_KickVoteReceivedHUD,
|
||||||
float(VoteTime),
|
float(CfgKickVote.default.VoteTime),
|
||||||
YesVotesPlayers,
|
YesVotesPlayers,
|
||||||
NoVotesPlayers);
|
NoVotesPlayers);
|
||||||
}
|
}
|
||||||
@ -568,6 +568,17 @@ private function String LogVotePlayer(S_KickVote KV)
|
|||||||
return KV.Name @ "(UniqueID:" @ KV.UniqueID $ (KV.SteamID == "" ? "" : (", SteamID:" @ KV.SteamID $ ", Profile:" @ "https://steamcommunity.com/profiles/" $ KV.SteamID)) $ ")" @ "Perk:" @ Repl(String(KV.Perk), "KFPerk_", "", false) @ "Level:" @ String(KV.Level);
|
return KV.Name @ "(UniqueID:" @ KV.UniqueID $ (KV.SteamID == "" ? "" : (", SteamID:" @ KV.SteamID $ ", Profile:" @ "https://steamcommunity.com/profiles/" $ KV.SteamID)) $ ")" @ "Perk:" @ Repl(String(KV.Perk), "KFPerk_", "", false) @ "Level:" @ String(KV.Level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ServerStartVoteSkipTrader(PlayerReplicationInfo PRI)
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
VoteTime = CfgSkipTraderVote.default.VoteTime;
|
||||||
|
|
||||||
|
Super.ServerStartVoteSkipTrader(PRI);
|
||||||
|
|
||||||
|
VoteTime = default.VoteTime;
|
||||||
|
}
|
||||||
|
|
||||||
public reliable server function RecieveVoteSkipTrader(PlayerReplicationInfo PRI, bool bSkip)
|
public reliable server function RecieveVoteSkipTrader(PlayerReplicationInfo PRI, bool bSkip)
|
||||||
{
|
{
|
||||||
local bool MustNotify;
|
local bool MustNotify;
|
||||||
@ -592,7 +603,7 @@ public reliable server function RecieveVoteSkipTrader(PlayerReplicationInfo PRI,
|
|||||||
{
|
{
|
||||||
CVC.BroadcastHUDLocalized(
|
CVC.BroadcastHUDLocalized(
|
||||||
CVC_VoteProgressHUD,
|
CVC_VoteProgressHUD,
|
||||||
float(VoteTime),
|
float(CfgSkipTraderVote.default.VoteTime),
|
||||||
VotedPlayers(),
|
VotedPlayers(),
|
||||||
DidntVotedPlayers());
|
DidntVotedPlayers());
|
||||||
}
|
}
|
||||||
@ -619,6 +630,17 @@ public reliable server function ConcludeVoteSkipTrader()
|
|||||||
Super.ConcludeVoteSkipTrader();
|
Super.ConcludeVoteSkipTrader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ServerStartVotePauseGame(PlayerReplicationInfo PRI)
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
VoteTime = CfgPauseVote.default.VoteTime;
|
||||||
|
|
||||||
|
Super.ServerStartVotePauseGame(PRI);
|
||||||
|
|
||||||
|
VoteTime = default.VoteTime;
|
||||||
|
}
|
||||||
|
|
||||||
public reliable server function ReceiveVotePauseGame(PlayerReplicationInfo PRI, bool bSkip)
|
public reliable server function ReceiveVotePauseGame(PlayerReplicationInfo PRI, bool bSkip)
|
||||||
{
|
{
|
||||||
local bool MustNotify;
|
local bool MustNotify;
|
||||||
@ -643,7 +665,7 @@ public reliable server function ReceiveVotePauseGame(PlayerReplicationInfo PRI,
|
|||||||
{
|
{
|
||||||
CVC.BroadcastHUDLocalized(
|
CVC.BroadcastHUDLocalized(
|
||||||
CVC_VoteProgressHUD,
|
CVC_VoteProgressHUD,
|
||||||
float(VoteTime),
|
float(CfgPauseVote.default.VoteTime),
|
||||||
VotedPlayers(),
|
VotedPlayers(),
|
||||||
DidntVotedPlayers());
|
DidntVotedPlayers());
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-ControlledVoteCollector[/img] [img]https://img.shields.io/steam/subscriptions/2847465899[/img] [img]https://img.shields.io/steam/favorites/2847465899[/img] [img]https://img.shields.io/steam/update-date/2847465899[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2847465899][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector[/img][/url]
|
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-ControlledVoteCollector[/img] [img]https://img.shields.io/steam/favorites/2847465899[/img] [img]https://img.shields.io/steam/update-date/2847465899[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2847465899][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector[/img][/url]
|
||||||
|
|
||||||
[h1]Description[/h1]
|
[h1]Description[/h1]
|
||||||
New vote collector with improvements and features.
|
New vote collector with improvements and features.
|
||||||
@ -69,7 +69,8 @@ This section sets the next map when no one voted for the map.
|
|||||||
[*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
|
[*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
|
||||||
[*][b]NegativeColorHex[/b] - hex color for no vote in chat;
|
[*][b]NegativeColorHex[/b] - hex color for no vote in chat;
|
||||||
[*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
|
[*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
|
||||||
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
|
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends;
|
||||||
|
[*][b]VoteTime[/b] - time in seconds for voting (will be automatically reduced if it exceeds the trader's remaining time).
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[b][CVC.PauseVote][/b]
|
[b][CVC.PauseVote][/b]
|
||||||
@ -78,7 +79,8 @@ This section sets the next map when no one voted for the map.
|
|||||||
[*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
|
[*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
|
||||||
[*][b]NegativeColorHex[/b] - hex color for no vote in chat;
|
[*][b]NegativeColorHex[/b] - hex color for no vote in chat;
|
||||||
[*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
|
[*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
|
||||||
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
|
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends;
|
||||||
|
[*][b]VoteTime[/b] - time in seconds for voting (will be automatically reduced if it exceeds the trader's remaining time).
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[b][CVC.KickVote][/b]
|
[b][CVC.KickVote][/b]
|
||||||
@ -92,7 +94,8 @@ This section sets the next map when no one voted for the map.
|
|||||||
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
|
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
|
||||||
[*][b]bLogKickVote[/b] - set to [b]True[/b] to log information about every kick vote;
|
[*][b]bLogKickVote[/b] - set to [b]True[/b] to log information about every kick vote;
|
||||||
[*][b]MinVotingPlayersToStartKickVote[/b] - minimum number of voting players to start kick voting;
|
[*][b]MinVotingPlayersToStartKickVote[/b] - minimum number of voting players to start kick voting;
|
||||||
[*][b]MaxKicks[/b] - maximum number of kicks per game.
|
[*][b]MaxKicks[/b] - maximum number of kicks per game;
|
||||||
|
[*][b]VoteTime[/b] - time in seconds for voting.
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[b][CVC.KickProtected][/b]
|
[b][CVC.KickProtected][/b]
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Controlled Vote Collector
|
# Controlled Vote Collector
|
||||||
|
|
||||||
[![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
[![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
||||||
[![Steam Subscriptions](https://img.shields.io/steam/subscriptions/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
|
||||||
[![Steam Favorites](https://img.shields.io/steam/favorites/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
[![Steam Favorites](https://img.shields.io/steam/favorites/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
||||||
[![Steam Update Date](https://img.shields.io/steam/update-date/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
[![Steam Update Date](https://img.shields.io/steam/update-date/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
|
||||||
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector)](https://github.com/GenZmeY/KF2-ControlledVoteCollector/tags)
|
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector)](https://github.com/GenZmeY/KF2-ControlledVoteCollector/tags)
|
||||||
|
Loading…
Reference in New Issue
Block a user