From 5faba66cb13147cc6d75ca85042ac6afcbdad1f6 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sat, 13 Aug 2022 14:13:47 +0300 Subject: [PATCH] update kick vote --- CVC/Classes/CVC.uc | 7 +----- CVC/Classes/CVC_LocalMessage.uc | 12 +++++------ CVC/Classes/CVC_VoteCollector.uc | 33 ++++++----------------------- Localization/INT/CVC.int | Bin 1340 -> 1384 bytes Localization/RUS/CVC.rus | Bin 1462 -> 1512 bytes PublicationContent/description.txt | 4 ++-- 6 files changed, 16 insertions(+), 40 deletions(-) diff --git a/CVC/Classes/CVC.uc b/CVC/Classes/CVC.uc index 5217162..5ea38a1 100644 --- a/CVC/Classes/CVC.uc +++ b/CVC/Classes/CVC.uc @@ -224,15 +224,10 @@ private function bool PlayerHasRequiredLevel(KFPlayerController KFPC) return (KFPRI.GetActivePerkLevel() >= CfgStartWaveKickProtection.default.MinLevel); } -public function bool PlayerCanKickVote(KFPlayerController KFPC, optional KFPlayerController KFPC_Kickee) +public function bool PlayerCanStartKickVote(KFPlayerController KFPC, KFPlayerController KFPC_Kickee) { `Log_Trace(); - if (KFPC_Kickee == None) - { - KFPC_Kickee = KFPlayerController(KFGRI.VoteCollector.CurrentKickVote.PlayerPRI.Owner); - } - if (KFPC_Kickee != None) { if (KFPC == KFPC_Kickee) diff --git a/CVC/Classes/CVC_LocalMessage.uc b/CVC/Classes/CVC_LocalMessage.uc index dc21e13..5cfd8d3 100644 --- a/CVC/Classes/CVC_LocalMessage.uc +++ b/CVC/Classes/CVC_LocalMessage.uc @@ -7,8 +7,8 @@ var private localized String PlayerIsKickProtected; var const String PlayerIsStartWaveKickProtectedDefault; var private localized String PlayerIsStartWaveKickProtected; -var const String PlayerCantVoteDefault; -var private localized String PlayerCantVote; +var const String PlayerCantStartKickVoteDefault; +var private localized String PlayerCantStartKickVote; var const String KickVoteNotEnoughPlayersDefault; var private localized String KickVoteNotEnoughPlayers; @@ -44,7 +44,7 @@ enum E_CVC_LocalMessageType { CVC_PlayerIsKickProtected, CVC_PlayerIsStartWaveKickProtected, - CVC_PlayerCantVote, + CVC_PlayerCantStartKickVote, CVC_KickVoteNotEnoughPlayers, CVC_KickVoteStarted, @@ -97,8 +97,8 @@ public static function String GetLocalizedString( case CVC_PlayerIsStartWaveKickProtected: return ReplWaves(ReplKickee(default.PlayerIsStartWaveKickProtected != "" ? default.PlayerIsStartWaveKickProtected : default.PlayerIsStartWaveKickProtectedDefault, String1), String2); - case CVC_PlayerCantVote: - return ReplWaves(default.PlayerCantVote != "" ? default.PlayerCantVote : default.PlayerCantVoteDefault, String1); + case CVC_PlayerCantStartKickVote: + return ReplWaves(default.PlayerCantStartKickVote != "" ? default.PlayerCantStartKickVote : default.PlayerCantStartKickVoteDefault, String1); case CVC_KickVoteNotEnoughPlayers: return ReplWaves(default.KickVoteNotEnoughPlayers != "" ? default.KickVoteNotEnoughPlayers : default.KickVoteNotEnoughPlayersDefault, String1); @@ -147,7 +147,7 @@ defaultproperties { PlayerIsKickProtectedDefault = " is protected from kick" PlayerIsStartWaveKickProtectedDefault = "You can't kick right now. He can be kicked when he plays at least wave(s)" - PlayerCantVoteDefault = "You can't vote for kick now. You can vote when you play at least wave(s)" + PlayerCantStartKickVoteDefault = "You can't start kick vote now. You can start kick vote when you play at least wave(s)" KickVoteNotEnoughPlayersDefault = "Not enough players to start vote (only players who have played at least wave(s) can vote)" KickVoteStartedDefault = " has started a vote to kick " KickVoteStartedForPlayerDefault = " started voting to kick you" diff --git a/CVC/Classes/CVC_VoteCollector.uc b/CVC/Classes/CVC_VoteCollector.uc index 4a73507..a7b2153 100644 --- a/CVC/Classes/CVC_VoteCollector.uc +++ b/CVC/Classes/CVC_VoteCollector.uc @@ -46,7 +46,6 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl { local Array KFPRIs; local KFPlayerReplicationInfo KFPRI; - local KFPlayerController KFPC; local KFGameInfo KFGI; `Log_Trace(); @@ -70,11 +69,11 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl return; } - if (!CVC.PlayerCanKickVote(KFPC_Kicker, KFPC_Kickee)) + if (!CVC.PlayerCanStartKickVote(KFPC_Kicker, KFPC_Kickee)) { CVC.WriteToChatLocalized( KFPC_Kicker, - CVC_PlayerCantVote, + CVC_PlayerCantStartKickVote, CfgKickVote.default.WarningColorHex, String(CfgStartWaveKickProtection.default.Waves)); return; @@ -164,7 +163,7 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl GetKFPRIArray(KFPRIs); foreach KFPRIs(KFPRI) { - KFPRI.ShowKickVote(PRI_Kickee, VoteTime, !(KFPRI == PRI_Kicker || KFPRI == PRI_Kickee || !CVC.PlayerCanKickVote(KFPlayerController(KFPRI.Owner)))); + KFPRI.ShowKickVote(PRI_Kickee, VoteTime, !(KFPRI == PRI_Kicker || KFPRI == PRI_Kickee)); } if (CfgKickVote.default.bChatNotifications) @@ -180,25 +179,7 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl KFPC_Kickee, CVC_KickVoteStartedForPlayer, CfgKickVote.default.NegativeColorHex, - KickerName, - KickeeName); - - foreach KFPRIs(KFPRI) - { - if (KFPRI == PRI_Kickee) - { - continue; - } - KFPC = KFPlayerController(KFPRI.Owner); - if (!CVC.PlayerCanKickVote(KFPC)) - { - CVC.WriteToChatLocalized( - KFPC, - CVC_PlayerCantVote, - CfgKickVote.default.WarningColorHex, - String(CfgStartWaveKickProtection.default.Waves)); - } - } + KickerName); } else { @@ -260,7 +241,7 @@ private function int VotingPlayers(optional PlayerReplicationInfo KickeePRI, opt foreach KFPRIs(KFPRI) { KFPC = KFPlayerController(KFPRI.Owner); - if (KFPC != None && CVC.PlayerCanKickVote(KFPC, KFPC_Kickee)) + if (KFPC != None && KFPC != KFPC_Kickee) { VotingPlayersNum++; } @@ -569,7 +550,7 @@ private function LogKickVotes() } `Log_Kick("Kicker:" @ LogVotePlayer(Kicker)); - `Log_Kick("Kicked:" @ LogVotePlayer(Kickee) @ String(Kickee.Perk) @ String(Kickee.Level)); + `Log_Kick("Kicked:" @ LogVotePlayer(Kickee)); `Log_Kick("Yes voters:"); foreach Yes(KV) `Log_Kick(LogVotePlayer(KV)); @@ -584,7 +565,7 @@ private function String LogVotePlayer(S_KickVote KV) { `Log_Trace(); - return KV.Name @ "(UniqueID:" @ KV.UniqueID $ (KV.SteamID == "" ? "" : (", SteamID:" @ KV.SteamID $ ", Profile:" @ "https://steamcommunity.com/profiles/" $ KV.SteamID)) $ ")"; + 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 reliable server function RecieveVoteSkipTrader(PlayerReplicationInfo PRI, bool bSkip) diff --git a/Localization/INT/CVC.int b/Localization/INT/CVC.int index 5c263108fdf316f46960c8e9b241b99655b27963..3368cd24fcba460154c473b816a02db7790d47de 100644 GIT binary patch delta 112 zcmdnP^@3}|Dn`Lzh7yKEh9V&8&5+5E%#b~KC8MHmF5HkRSC=mt# delta 36 mcmaFCy^VXrF~-R^7)>UNum~_avG`2ZXL5wGH&12?Wd;D)zX}lm diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 01f4543..34d7117 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -111,9 +111,9 @@ In this section, the system for preventing early kicks is configured (especially [b]How start wave kick protection works:[/b] When a player joins a server, he is protected from a kick for the specified number of [b]Waves[/b]. This keeps the server from being taken over by players, and it also forces current players to play with the new player for at least a little bit before they can kick him. This solves most of the unfair kicks in the game. -Along with receiving the kick protection, the new player loses the ability to vote for the kick. This eliminates the ability for new players to remove existing players using kick protection for impunity. +Along with receiving the kick protection, the new player loses the ability to start kick vote. This eliminates the ability for new players to remove existing players using kick protection for impunity. -When the player has played the specified number of [b]Waves[/b], he loses the kick protection and gets the opportunity to vote for the kick. +When the player has played the specified number of [b]Waves[/b], he loses the kick protection and gets the opportunity to start kick vote. The [b]MinLevel[/b] parameter specifies an exception to these rules, giving kick protection only to players above or equal the specified level. All players can vote to exclude players with an unsuitable level, regardless of whether they have played enough [b]Waves[/b] or not. This allows to remove low-level players without waiting for them to screw up in the game.