v0.13.0.11
This commit is contained in:
@@ -130,12 +130,15 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
powerIndicator = new GUIProgressBar(new RectTransform(new Vector2(0.18f, 0.03f), GUI.Canvas, Anchor.TopCenter)
|
||||
powerIndicator = new GUIProgressBar(new RectTransform(new Vector2(0.18f, 0.03f), GUI.Canvas, Anchor.BottomCenter)
|
||||
{
|
||||
MinSize = new Point(100,20),
|
||||
MinSize = new Point(100, 20),
|
||||
RelativeOffset = new Vector2(0.0f, 0.01f)
|
||||
},
|
||||
barSize: 0.0f, style: "DeviceProgressBar");
|
||||
},
|
||||
barSize: 0.0f, style: "DeviceProgressBar")
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
@@ -497,9 +500,15 @@ namespace Barotrauma.Items.Components
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
if (!(e is Item linkedItem)) { continue; }
|
||||
availableAmmo.AddRange(linkedItem.ContainedItems);
|
||||
}
|
||||
|
||||
var itemContainer = linkedItem.GetComponent<ItemContainer>();
|
||||
if (itemContainer == null) { continue; }
|
||||
availableAmmo.AddRange(itemContainer.Inventory.AllItems);
|
||||
for (int i = 0; i < itemContainer.Inventory.Capacity - itemContainer.Inventory.AllItems.Count(); i++)
|
||||
{
|
||||
availableAmmo.Add(null);
|
||||
}
|
||||
}
|
||||
|
||||
float chargeRate =
|
||||
powerConsumption <= 0.0f ?
|
||||
1.0f :
|
||||
@@ -531,15 +540,16 @@ namespace Barotrauma.Items.Components
|
||||
if (ShowProjectileIndicator)
|
||||
{
|
||||
Point slotSize = (Inventory.SlotSpriteSmall.size * Inventory.UIScale).ToPoint();
|
||||
int spacing = 5;
|
||||
Point spacing = new Point(GUI.IntScale(5), GUI.IntScale(20));
|
||||
int slotsPerRow = Math.Min(availableAmmo.Count, 6);
|
||||
int totalWidth = slotSize.X * slotsPerRow + spacing * (slotsPerRow - 1);
|
||||
Point invSlotPos = new Point(GameMain.GraphicsWidth / 2 - totalWidth / 2, (int)(60 * GUI.Scale));
|
||||
int totalWidth = slotSize.X * slotsPerRow + spacing.X * (slotsPerRow - 1);
|
||||
int rows = (int)Math.Ceiling(availableAmmo.Count / (float)slotsPerRow);
|
||||
Point invSlotPos = new Point(GameMain.GraphicsWidth / 2 - totalWidth / 2, powerIndicator.Rect.Y - (slotSize.Y + spacing.Y) * rows);
|
||||
for (int i = 0; i < availableAmmo.Count; i++)
|
||||
{
|
||||
// TODO: Optimize? Creates multiple new objects per frame?
|
||||
Inventory.DrawSlot(spriteBatch, null,
|
||||
new VisualSlot(new Rectangle(invSlotPos + new Point((i % slotsPerRow) * (slotSize.X + spacing), (int)Math.Floor(i / (float)slotsPerRow) * (slotSize.Y + spacing)), slotSize)),
|
||||
new VisualSlot(new Rectangle(invSlotPos + new Point((i % slotsPerRow) * (slotSize.X + spacing.X), (int)Math.Floor(i / (float)slotsPerRow) * (slotSize.Y + spacing.Y)), slotSize)),
|
||||
availableAmmo[i], -1, true);
|
||||
}
|
||||
if (flashNoAmmo)
|
||||
@@ -578,7 +588,7 @@ namespace Barotrauma.Items.Components
|
||||
//ID ushort.MaxValue = launched without a projectile
|
||||
if (projectileID == ushort.MaxValue)
|
||||
{
|
||||
Launch(null);
|
||||
Launch(null, user);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -587,7 +597,7 @@ namespace Barotrauma.Items.Components
|
||||
DebugConsole.ThrowError("Failed to launch a projectile - item with the ID \"" + projectileID + " not found");
|
||||
return;
|
||||
}
|
||||
Launch(projectile, launchRotation: newTargetRotation);
|
||||
Launch(projectile, user, launchRotation: newTargetRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user