Fixed items attached mid-round by other clients or the host being impossible to interact with and occasionally being attached to an incorrect position. Closes #296

This commit is contained in:
Joonas Rikkonen
2018-02-28 14:01:38 +02:00
parent 2585cc9873
commit 74ef5c6ea6
5 changed files with 40 additions and 18 deletions
@@ -23,12 +23,6 @@ namespace Barotrauma.Items.Components
{
get
{
if (powerConnections == null)
{
var connections = Item.Connections;
powerConnections = connections == null ? new List<Connection>() : connections.FindAll(c => c.IsPower);
}
return powerConnections;
}
}
@@ -338,18 +332,18 @@ namespace Barotrauma.Items.Components
connectionDirty[connection] = true;
}
public override void OnMapLoaded()
public override void OnItemLoaded()
{
var connections = item.Connections;
var connections = Item.Connections;
powerConnections = connections == null ? new List<Connection>() : connections.FindAll(c => c.IsPower);
if (connections == null)
{
IsActive = false;
return;
}
SetAllConnectionsDirty();
}
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power)
{
base.ReceiveSignal(stepsTaken, signal, connection, source, sender, power);