Fixed modified clients being able to disconnect locked wires
This commit is contained in:
@@ -1059,6 +1059,9 @@ namespace Barotrauma
|
||||
Wire wire = item.GetComponent<Wire>();
|
||||
if (wire != null)
|
||||
{
|
||||
//locked wires are never interactable
|
||||
if (wire.Locked) return false;
|
||||
|
||||
//wires are interactable if the character has selected either of the items the wire is connected to
|
||||
if (wire.Connections[0]?.Item != null && selectedConstruction == wire.Connections[0].Item) return true;
|
||||
if (wire.Connections[1]?.Item != null && selectedConstruction == wire.Connections[1].Item) return true;
|
||||
|
||||
@@ -212,6 +212,14 @@ namespace Barotrauma.Items.Components
|
||||
//existing wire not in the list of new wires -> disconnect it
|
||||
if (!wires[i].Contains(existingWire))
|
||||
{
|
||||
if (existingWire.Locked)
|
||||
{
|
||||
//this should not be possible unless the client is running a modified version of the game
|
||||
GameServer.Log(c.Character.Name + " attempted to disconnect a locked wire from " +
|
||||
Connections[i].Item.Name + " (" + Connections[i].Name + ")", ServerLog.MessageType.Error);
|
||||
continue;
|
||||
}
|
||||
|
||||
existingWire.RemoveConnection(item);
|
||||
|
||||
if (existingWire.Connections[0] == null && existingWire.Connections[1] == null)
|
||||
|
||||
Reference in New Issue
Block a user