Add vote kick

(cherry picked from commit 144e716cdf)
This commit is contained in:
Gustas
2025-11-02 02:57:04 +00:00
committed by hacker
parent aacf0e2b8d
commit ee4403f923
5 changed files with 103 additions and 98 deletions

View File

@@ -20,24 +20,6 @@ namespace OpenRA.Network
{
public const int ChatMessageMaxLength = 2500;
[FluentReference("player")]
const string Joined = "notification-joined";
[FluentReference("player")]
const string Left = "notification-lobby-disconnected";
[FluentReference]
const string GameStarted = "notification-game-has-started";
[FluentReference]
const string GameSaved = "notification-game-saved";
[FluentReference("player")]
const string GamePaused = "notification-game-paused";
[FluentReference("player")]
const string GameUnpaused = "notification-game-unpaused";
public static int? KickVoteTarget { get; internal set; }
static Player FindPlayerByClient(this World world, Session.Client c)
@@ -78,8 +60,16 @@ namespace OpenRA.Network
}
case "DisableChatEntry":
{
if (OrderNotFromServerOrWorldIsReplay(clientId, world))
{
if (OrderNotFromServerOrWorldIsReplay(clientId, world))
break;
// Server may send MaxValue to indicate that it is disabled until further notice
if (order.ExtraData == uint.MaxValue)
TextNotificationsManager.ChatDisabledUntil = uint.MaxValue;
else
TextNotificationsManager.ChatDisabledUntil = Game.RunTime + order.ExtraData;
break;
// Server may send MaxValue to indicate that it is disabled until further notice
@@ -111,6 +101,26 @@ namespace OpenRA.Network
break;
}
case "StartKickVote":
{
if (OrderNotFromServerOrWorldIsReplay(clientId, world))
break;
KickVoteTarget = (int)order.ExtraData;
break;
}
case "EndKickVote":
{
if (OrderNotFromServerOrWorldIsReplay(clientId, world))
break;
if (KickVoteTarget == (int)order.ExtraData)
KickVoteTarget = null;
break;
}
case "Chat":
{
var client = orderManager.LobbyInfo.ClientWithIndex(clientId);