(6e187d247) Fixed contained items' status effects being added twice to the list of an ItemContainer's active status effects when swapping items. For example, when swapping a fuel rod with another one, the status effect that increases AvailableFuel would be applied twice, causing the reactor to act as if there were 2 rods in it. Closes #1643 + merge fix

This commit is contained in:
Joonas Rikkonen
2019-06-15 20:24:01 +03:00
parent f68c16d944
commit 87a0ee21eb
52 changed files with 497 additions and 983 deletions
@@ -1274,6 +1274,8 @@ namespace Barotrauma
}
}
DebugConsole.Log("Generating level resources...");
for (int i = 0; i < generationParams.ItemCount; i++)
{
var selectedPrefab = ToolBox.SelectWeightedRandom(
@@ -1286,6 +1288,7 @@ namespace Barotrauma
var selectedEdge = selectedCell.Edges.GetRandom(e => e.IsSolid && !e.OutsideLevel, Rand.RandSync.Server);
if (selectedEdge == null) continue;
float edgePos = Rand.Range(0.0f, 1.0f, Rand.RandSync.Server);
Vector2 selectedPos = Vector2.Lerp(selectedEdge.Point1, selectedEdge.Point2, edgePos);
Vector2 edgeNormal = selectedEdge.GetNormal(selectedCell);
@@ -1306,6 +1309,8 @@ namespace Barotrauma
#endif
}
}
DebugConsole.Log("Level resources generated");
}
public Vector2 GetRandomItemPos(PositionType spawnPosType, float randomSpread, float minDistFromSubs, float offsetFromWall = 10.0f)