Cargo spawning fix again: items are spawned slightly above the bottom of the cargo room (because the item is only inside the hull if pos.Y > hull.rect.bottom)

This commit is contained in:
Regalis
2016-10-09 17:33:51 +03:00
parent f4c5c5e542
commit f7e98ee6a8
4 changed files with 10 additions and 10 deletions

View File

@@ -5,14 +5,14 @@ namespace Barotrauma
{
class CargoManager
{
private List<MapEntityPrefab> purchasedItems;
private List<ItemPrefab> purchasedItems;
public CargoManager()
{
purchasedItems = new List<MapEntityPrefab>();
purchasedItems = new List<ItemPrefab>();
}
public void AddItem(MapEntityPrefab item)
public void AddItem(ItemPrefab item)
{
purchasedItems.Add(item);
}
@@ -35,11 +35,11 @@ namespace Barotrauma
return;
}
foreach (MapEntityPrefab prefab in purchasedItems)
foreach (ItemPrefab prefab in purchasedItems)
{
Vector2 position = new Vector2(
Rand.Range(cargoRoom.Rect.X + 20, cargoRoom.Rect.Right - 20),
Rand.Range(cargoRoom.Rect.Y - cargoRoom.Rect.Height, cargoRoom.Rect.Y));
cargoRoom.Rect.Y - cargoRoom.Rect.Height + prefab.Size.Y/2);
new Item(prefab as ItemPrefab, position, wp.Submarine);
}