Don't play chat sounds when loading games
This commit is contained in:
@@ -51,9 +51,6 @@ namespace OpenRA.Server
|
||||
[FluentReference]
|
||||
const string CustomRules = "notification-custom-rules";
|
||||
|
||||
[FluentReference]
|
||||
const string BotsDisabled = "notification-map-bots-disabled";
|
||||
|
||||
[FluentReference]
|
||||
const string TwoHumansRequired = "notification-two-humans-required";
|
||||
|
||||
@@ -587,7 +584,8 @@ namespace OpenRA.Server
|
||||
|
||||
Log.Write("server", $"{client.Name} ({newConn.EndPoint}) has joined the game.");
|
||||
|
||||
SendFluentMessage(Joined, "player", client.Name);
|
||||
var otherConns = Conns.Where(c => c != newConn).ToArray();
|
||||
SendFluentMessage(otherConns.AsSpan(), Joined, "player", client.Name);
|
||||
|
||||
if (Type == ServerType.Dedicated)
|
||||
{
|
||||
@@ -598,15 +596,13 @@ namespace OpenRA.Server
|
||||
var motd = File.ReadAllText(motdFile);
|
||||
if (!string.IsNullOrEmpty(motd))
|
||||
SendOrderTo(newConn, "Message", motd);
|
||||
|
||||
if (!LobbyInfo.GlobalSettings.EnableSingleplayer)
|
||||
SendFluentMessageTo(newConn, TwoHumansRequired);
|
||||
}
|
||||
|
||||
if ((LobbyInfo.GlobalSettings.MapStatus & Session.MapStatus.UnsafeCustomRules) != 0)
|
||||
if (Type != ServerType.Local && (LobbyInfo.GlobalSettings.MapStatus & Session.MapStatus.UnsafeCustomRules) != 0)
|
||||
SendFluentMessageTo(newConn, CustomRules);
|
||||
|
||||
if (!LobbyInfo.GlobalSettings.EnableSingleplayer)
|
||||
SendFluentMessageTo(newConn, TwoHumansRequired);
|
||||
else if (Map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots))
|
||||
SendFluentMessageTo(newConn, BotsDisabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -893,6 +889,17 @@ namespace OpenRA.Server
|
||||
RecordOrder(frame, data, From);
|
||||
}
|
||||
|
||||
public void DispatchServerOrdersToClients(ReadOnlySpan<Connection> conns, byte[] data, int frame = 0)
|
||||
{
|
||||
const int From = 0;
|
||||
var frameData = CreateFrame(From, frame, data);
|
||||
foreach (var c in conns)
|
||||
if (c.Validated)
|
||||
DispatchFrameToClient(c, From, frameData);
|
||||
|
||||
RecordOrder(frame, data, From);
|
||||
}
|
||||
|
||||
public void ReceiveOrders(Connection conn, int frame, byte[] data)
|
||||
{
|
||||
// Make sure we don't accidentally forward on orders from clients who we have just dropped
|
||||
@@ -952,9 +959,15 @@ namespace OpenRA.Server
|
||||
}
|
||||
|
||||
public void SendFluentMessage(string key, params object[] args)
|
||||
{
|
||||
var conns = Conns.ToArray();
|
||||
SendFluentMessage(conns, key, args);
|
||||
}
|
||||
|
||||
public void SendFluentMessage(ReadOnlySpan<Connection> conns, string key, params object[] args)
|
||||
{
|
||||
var text = FluentMessage.Serialize(key, args);
|
||||
DispatchServerOrdersToClients(Order.FromTargetString("FluentMessage", text, true));
|
||||
DispatchServerOrdersToClients(conns, Order.FromTargetString("FluentMessage", text, true).Serialize());
|
||||
|
||||
if (Type == ServerType.Dedicated)
|
||||
WriteLineWithTimeStamp(FluentProvider.GetMessage(key, args));
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
[FluentReference]
|
||||
const string ConfigureBots = "options-slot-admin.configure-bots";
|
||||
|
||||
[FluentReference]
|
||||
const string BotsDisabled = "notification-map-bots-disabled";
|
||||
|
||||
[FluentReference("count")]
|
||||
const string NumberTeams = "options-slot-admin.teams-count";
|
||||
|
||||
@@ -588,6 +591,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
playerLeftSound = yaml.Value;
|
||||
if (logicArgs.TryGetValue("LobbyOptionChangedSound", out yaml))
|
||||
lobbyOptionChangedSound = yaml.Value;
|
||||
|
||||
Game.Sound.PlayNotification(modRules, null, "Sounds", playerJoinedSound, null);
|
||||
}
|
||||
|
||||
bool disposed;
|
||||
@@ -709,6 +714,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (newLobbyOptions.TryGetValue(o.Id, out var s) && (lobbyOptions.TryGetValue(o.Id, out var old) ? s.Value != old.Value : s.Value != o.DefaultValue))
|
||||
TextNotificationsManager.AddSystemLine(OptionValue, "name", o.Name, "value", o.Label(s.Value));
|
||||
|
||||
if (map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots))
|
||||
TextNotificationsManager.AddSystemLine(BotsDisabled);
|
||||
|
||||
lobbyOptions = newLobbyOptions;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ button-quit = Quit
|
||||
|
||||
## Server Orders
|
||||
notification-custom-rules = This map contains custom rules. Game experience may change.
|
||||
notification-map-bots-disabled = Bots have been disabled on this map.
|
||||
notification-two-humans-required = This server requires at least two human players to start a match.
|
||||
notification-unknown-server-command = Unknown server command: { $command }.
|
||||
notification-admin-start-game = Only the host can start the game.
|
||||
@@ -204,6 +203,7 @@ label-bot-player = AI Player
|
||||
## LobbyLogic
|
||||
notification-lobby-option = { $name }: { $value }.
|
||||
notification-lobby-option-changed = { $name } changed to { $value }.
|
||||
notification-map-bots-disabled = Bots have been disabled on this map.
|
||||
|
||||
## IngameMenuLogic
|
||||
menu-ingame =
|
||||
|
||||
Reference in New Issue
Block a user