Release v0.15.13.0

This commit is contained in:
Joonas Rikkonen
2021-11-02 13:19:48 +02:00
parent a52a23f8c2
commit 3a35dbfe6c
77 changed files with 509 additions and 224 deletions
@@ -516,6 +516,9 @@ namespace Barotrauma
}
}
private readonly static List<SlotReference> hideSubInventories = new List<SlotReference>();
private readonly static List<SlotReference> tempHighlightedSubInventorySlots = new List<SlotReference>();
public override void Update(float deltaTime, Camera cam, bool isSubInventory = false)
{
if (!AccessibleWhenAlive && !character.IsDead)
@@ -579,15 +582,17 @@ namespace Barotrauma
}
}
}
List<SlotReference> hideSubInventories = new List<SlotReference>();
hideSubInventories.Clear();
//remove highlighted subinventory slots that can no longer be accessed
highlightedSubInventorySlots.RemoveWhere(s =>
s.ParentInventory == this &&
((s.SlotIndex < 0 || s.SlotIndex >= slots.Length || slots[s.SlotIndex] == null) || (Character.Controlled != null && !Character.Controlled.CanAccessInventory(s.Inventory))));
//remove highlighted subinventory slots that refer to items no longer in this inventory
highlightedSubInventorySlots.RemoveWhere(s => s.Item != null && s.ParentInventory == this && s.Item.ParentInventory != this);
foreach (var highlightedSubInventorySlot in highlightedSubInventorySlots)
tempHighlightedSubInventorySlots.Clear();
tempHighlightedSubInventorySlots.AddRange(highlightedSubInventorySlots);
foreach (var highlightedSubInventorySlot in tempHighlightedSubInventorySlots)
{
if (highlightedSubInventorySlot.ParentInventory == this)
{
@@ -300,6 +300,8 @@ namespace Barotrauma.Items.Components
{
requiresRecipeText.RectTransform.RepositionChildInHierarchy(itemList.Content.RectTransform.GetChildIndex(firstRequiresRecipe.RectTransform));
}
HideEmptyItemListCategories();
}
private void DrawInputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
@@ -479,6 +481,13 @@ namespace Barotrauma.Items.Components
child.Visible = recipe.DisplayName.ToLower().Contains(filter);
}
HideEmptyItemListCategories();
return true;
}
private void HideEmptyItemListCategories()
{
//go through the elements backwards, and disable the labels ("insufficient skills to fabricate", "recipe required...") if there's no items below them
bool recipeVisible = false;
foreach (GUIComponent child in itemList.Content.Children.Reverse())
@@ -490,14 +499,12 @@ namespace Barotrauma.Items.Components
}
else
{
recipeVisible = child.Visible;
recipeVisible |= child.Visible;
}
}
itemList.UpdateScrollBarSize();
itemList.BarScroll = 0.0f;
return true;
}
public bool ClearFilter()
@@ -36,7 +36,7 @@ namespace Barotrauma.Items.Components
internal readonly struct MiniMapSprite
{
public readonly Sprite Sprite;
public readonly Sprite? Sprite;
public readonly Color Color;
public MiniMapSprite(JobPrefab prefab)
@@ -1302,6 +1302,8 @@ namespace Barotrauma.Items.Components
int i = 0;
foreach (MiniMapSprite info in cardsToDraw)
{
if (info.Sprite is null) { continue; }
float spriteSize = info.Sprite.size.X * (parentWidth / info.Sprite.size.X) + padding;
if (totalWidth + spriteSize > frame.Rect.Width) { break; }
@@ -1318,7 +1320,8 @@ namespace Barotrauma.Items.Components
foreach (MiniMapSprite info in cardsToDraw)
{
Sprite sprite = info.Sprite;
Sprite? sprite = info.Sprite;
if (sprite is null) { continue; }
float scale = parentWidth / sprite.size.X;
float spriteSize = sprite.size.X * scale;
float posX = adjustedCenterX + offset;
@@ -88,7 +88,7 @@ namespace Barotrauma.Items.Components
Vector2 startPos = GetSourcePos();
startPos.Y = -startPos.Y;
if (source is Item sourceItem)
if (source is Item sourceItem && !sourceItem.Removed)
{
var turret = sourceItem.GetComponent<Turret>();
var weapon = sourceItem.GetComponent<RangedWeapon>();
@@ -540,7 +540,7 @@ namespace Barotrauma
}
}*/
bool mouseOn = interactRect.Contains(PlayerInput.MousePosition) && !Locked && !mouseOnGUI && !slot.Disabled;
bool mouseOn = interactRect.Contains(PlayerInput.MousePosition) && !Locked && !mouseOnGUI && !slot.Disabled && IsMouseOnInventory;
// Delete item from container in sub editor
if (SubEditorScreen.IsSubEditor() && PlayerInput.IsCtrlDown())
@@ -863,6 +863,8 @@ namespace Barotrauma
{
return false;
}
if (GameSession.IsTabMenuOpen) { return false; }
if (CrewManager.IsCommandInterfaceOpen) { return false; }
if (Character.Controlled == null) { return false; }
@@ -1313,6 +1315,10 @@ namespace Barotrauma
private static bool CanSelectSlot(SlotReference selectedSlot)
{
if (!IsMouseOnInventory)
{
return false;
}
if (!selectedSlot.Slot.MouseOn())
{
return false;
@@ -1335,7 +1341,8 @@ namespace Barotrauma
if ((parentItem?.GetRootInventoryOwner() is Character ownerCharacter) &&
ownerCharacter == Character.Controlled &&
CharacterHealth.OpenHealthWindow?.Character != ownerCharacter &&
ownerCharacter.Inventory.IsInLimbSlot(parentItem, InvSlotType.HealthInterface))
ownerCharacter.Inventory.IsInLimbSlot(parentItem, InvSlotType.HealthInterface) &&
Screen.Selected != GameMain.SubEditorScreen)
{
highlightedSubInventorySlots.RemoveWhere(s => s.Item == parentItem);
return false;
@@ -543,6 +543,7 @@ namespace Barotrauma
partial void OnCollisionProjSpecific(float impact)
{
if (impact > 1.0f &&
Container == null &&
!string.IsNullOrEmpty(Prefab.ImpactSoundTag) &&
Timing.TotalTime > LastImpactSoundTime + ImpactSoundInterval)
{