Fixed crashing when a client clears connections of a wire (because the logging attempted to access Character.Controlled instead of the client's character), fixed the (completely broken) ConnectionPanel.ServerRead

This commit is contained in:
Joonas Rikkonen
2017-07-25 20:26:41 +03:00
parent f460b4c2bc
commit 286c1ad950
3 changed files with 76 additions and 56 deletions
@@ -172,13 +172,17 @@ namespace Barotrauma.Items.Components
if (draggingConnected.Connect(this, !alreadyConnected, true))
{
GameServer.Log(item.Name + " rewired by " + Character.Controlled.Name, ServerLog.MessageType.ItemInteraction);
var otherConnection = draggingConnected.OtherConnection(this);
GameServer.Log(item.Name + " rewired by " + Character.Controlled.Name + ": " +
Name + " -> " +
(otherConnection == null ? "none" : otherConnection.Item.Name + " (" + (otherConnection.Name) + ")"), ServerLog.MessageType.ItemInteraction);
if (otherConnection == null)
{
GameServer.Log(Character.Controlled + " connected a wire to " +
Item.Name + " (" + Name + ")", ServerLog.MessageType.ItemInteraction);
}
else
{
GameServer.Log(Character.Controlled + " connected a wire from " +
Item.Name + " (" + Name + ") to " + otherConnection.item.Name + " (" + otherConnection.Name + ")", ServerLog.MessageType.ItemInteraction);
}
Wires[index] = draggingConnected;
}