Dockingport power wire is connected to a free wire slot instead of the last slot, submarines above the top of the level (i.e. respawn shuttle) aren't shown on sonar, underwater scooter for each respawned player

This commit is contained in:
Regalis
2016-08-13 21:35:52 +03:00
parent fbe6c91d67
commit 0602bb6154
9 changed files with 34 additions and 15 deletions
@@ -252,9 +252,10 @@ namespace Barotrauma.Items.Components
wire.RemoveConnection(item);
wire.RemoveConnection(dockingTarget.item);
powerConnection.AddLink(4, wire);
powerConnection.TryAddLink(wire);
wire.Connect(powerConnection, false);
recipient.AddLink(4, wire);
recipient.TryAddLink(wire);
wire.Connect(recipient, false);
}
@@ -282,7 +282,8 @@ namespace Barotrauma.Items.Components
foreach (Submarine sub in Submarine.Loaded)
{
if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue;
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue;
DrawMarker(spriteBatch, sub.Name, sub.WorldPosition - item.WorldPosition, displayScale, center, (rect.Width * 0.45f));
}
@@ -140,10 +140,21 @@ namespace Barotrauma.Items.Components
return -1;
}
public void TryAddLink(Wire wire)
{
for (int i = 0; i < MaxLinked; i++)
{
if (Wires[i] == null)
{
Wires[i] = wire;
UpdateRecipients();
return;
}
}
}
public void AddLink(int index, Wire wire)
{
//linked[index] = connectedItem;
//recipient[index] = otherConnection;
Wires[index] = wire;
UpdateRecipients();
}
@@ -459,6 +470,7 @@ namespace Barotrauma.Items.Components
{
if (wireId == null) return;
for (int i = 0; i < MaxLinked; i++)
{
if (wireId[i] == 0) continue;