Fixed docking ports leaking if multiple vessels have docked to the main sub, cargo is always spawned in the main sub

This commit is contained in:
Regalis
2016-08-19 20:13:24 +03:00
parent ef0098d52a
commit 08817090a0
5 changed files with 9 additions and 3 deletions
@@ -54,7 +54,7 @@ namespace Barotrauma
return; return;
} }
WayPoint cargoSpawnPos = WayPoint.GetRandom(SpawnType.Cargo); WayPoint cargoSpawnPos = WayPoint.GetRandom(SpawnType.Cargo, null, Submarine.MainSub);
if (cargoSpawnPos==null) if (cargoSpawnPos==null)
{ {
DebugConsole.ThrowError("Couldn't spawn items for cargo mission, cargo spawnpoint not found"); DebugConsole.ThrowError("Couldn't spawn items for cargo mission, cargo spawnpoint not found");
@@ -19,7 +19,7 @@ namespace Barotrauma
public void CreateItems() public void CreateItems()
{ {
WayPoint wp = WayPoint.GetRandom(SpawnType.Cargo); WayPoint wp = WayPoint.GetRandom(SpawnType.Cargo, null, Submarine.MainSub);
if (wp==null) if (wp==null)
{ {
@@ -377,6 +377,7 @@ namespace Barotrauma.Items.Components
hullIds[0] = hulls[0].ID; hullIds[0] = hulls[0].ID;
hullIds[1] = hulls[1].ID; hullIds[1] = hulls[1].ID;
gap.DisableHullRechecks = true;
gapId = gap.ID; gapId = gap.ID;
item.linkedTo.Add(gap); item.linkedTo.Add(gap);
+4
View File
@@ -30,6 +30,9 @@ namespace Barotrauma
private float higherSurface; private float higherSurface;
private float lowerSurface; private float lowerSurface;
//if set to true, hull connections of this gap won't be updated when changes are being done to hulls
public bool DisableHullRechecks;
public float Open public float Open
{ {
get { return open; } get { return open; }
@@ -119,6 +122,7 @@ namespace Barotrauma
{ {
foreach (Gap g in GapList) foreach (Gap g in GapList)
{ {
if (g.DisableHullRechecks) continue;
g.FindHulls(); g.FindHulls();
} }
} }
+2 -1
View File
@@ -631,12 +631,13 @@ namespace Barotrauma
if (!wayPoint2.linkedTo.Contains(this)) wayPoint2.linkedTo.Add(this); if (!wayPoint2.linkedTo.Contains(this)) wayPoint2.linkedTo.Add(this);
} }
public static WayPoint GetRandom(SpawnType spawnType = SpawnType.Human, Job assignedJob = null) public static WayPoint GetRandom(SpawnType spawnType = SpawnType.Human, Job assignedJob = null, Submarine sub = null)
{ {
List<WayPoint> wayPoints = new List<WayPoint>(); List<WayPoint> wayPoints = new List<WayPoint>();
foreach (WayPoint wp in WayPointList) foreach (WayPoint wp in WayPointList)
{ {
if (sub != null && wp.Submarine != sub) continue;
if (wp.spawnType != spawnType) continue; if (wp.spawnType != spawnType) continue;
if (assignedJob != null && wp.assignedJob != assignedJob.Prefab) continue; if (assignedJob != null && wp.assignedJob != assignedJob.Prefab) continue;