Husk improvements, option for admin to talk to dead players, spectators or one specific player, entitygrid bugfix

This commit is contained in:
Regalis
2016-02-14 22:22:24 +02:00
parent 94e34c0ed9
commit ef78f2d0f6
12 changed files with 81 additions and 32 deletions

View File

@@ -882,6 +882,9 @@ namespace Barotrauma.Networking
GameMain.GameScreen.Select();
AddChatMessage("Press TAB to chat. Use ''/d'' to talk to dead players and spectators, and ''/playername'' to only send the message to a specific player.", ChatMessageType.Server);
yield return CoroutineStatus.Success;
}
@@ -1267,17 +1270,43 @@ namespace Barotrauma.Networking
public override void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server)
{
AddChatMessage(message, type);
if (server.Connections.Count == 0) return;
string[] words = message.Split(' ');
List<Client> recipients = new List<Client>();
Client targetClient = null;
foreach (Client c in ConnectedClients)
if (words.Length > 2)
{
if (type!=ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c);
if (words[1] == "/dead" || words[1] == "/d")
{
type = ChatMessageType.Dead;
}
else
{
targetClient = ConnectedClients.Find(c =>
words[0] == "/" + c.name.ToLower() ||
c.Character != null && words[0] == "/" + c.Character.Name.ToLower());
}
message = words[0] + " " + string.Join(" ", words, 2, words.Length - 2);
}
if (targetClient != null)
{
recipients.Add(targetClient);
}
else
{
foreach (Client c in ConnectedClients)
{
if (type != ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c);
}
}
AddChatMessage(message, type);
if (!server.Connections.Any()) return;
foreach (Client c in recipients)
{
ReliableMessage msg = c.ReliableChannel.CreateMessage();

View File

@@ -9,7 +9,7 @@ namespace Barotrauma.Networking
{
class ServerLog
{
const int LinesPerFile = 500;
const int LinesPerFile = 300;
const string SavePath = "ServerLogs";