Forcing hull/gap ids to correct ones if receiving a dockingport network event and the hulls/gaps have already been created, ItemContainers are active by default (to always check for potential statuseffects of the contained items), fixed NullReferenceException in Wire.Connect if attempting to connect to something outside the sub (shouldn't be possible unless messing something up in the editor)

This commit is contained in:
Regalis
2016-08-11 21:52:57 +03:00
parent 04a63a98cd
commit eb33746907
4 changed files with 10 additions and 1 deletions
@@ -580,7 +580,7 @@ namespace Barotrauma
{
message.WriteRangedInteger(0, Enum.GetValues(typeof(AiState)).Length-1, (int)state);
bool wallAttack = (wallAttackPos != Vector2.Zero && state == AiState.Attack);
//bool wallAttack = (wallAttackPos != Vector2.Zero && state == AiState.Attack);
//message.Write(wallAttack);
@@ -620,6 +620,11 @@ namespace Barotrauma.Items.Components
gapId = message.ReadUInt16();
if (hulls[0] != null) hulls[0].ID = (ushort)hullIds[0];
if (hulls[1] != null) hulls[1].ID = (ushort)hullIds[1];
if (gap != null) gap.ID = (ushort)gapId;
Dock(dockingTarget);
}
@@ -121,6 +121,8 @@ namespace Barotrauma.Items.Components
break;
}
}
IsActive = true;
}
public void RemoveContained(Item item)
@@ -119,6 +119,8 @@ namespace Barotrauma.Items.Components
if (!addNode) break;
if (newConnection.Item.Submarine == null) continue;
if (Nodes.Count > 0 && Nodes[0] == newConnection.Item.Position - newConnection.Item.Submarine.HiddenSubPosition) break;
if (Nodes.Count > 1 && Nodes[Nodes.Count-1] == newConnection.Item.Position - newConnection.Item.Submarine.HiddenSubPosition) break;