(d7ca2a2a8) Lock inventory when using a controller
This commit is contained in:
@@ -85,7 +85,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (character.Inventory != null)
|
||||
{
|
||||
if (!character.LockHands && character.Stun < 0.1f)
|
||||
if (!character.LockHands && character.Stun < 0.1f &&
|
||||
(character.SelectedConstruction == null || character.SelectedConstruction.GetComponent<Controller>() == null))
|
||||
{
|
||||
character.Inventory.Update(deltaTime, cam);
|
||||
}
|
||||
@@ -320,6 +321,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (character.Inventory != null && !character.LockHands)
|
||||
{
|
||||
character.Inventory.Locked = (character.SelectedConstruction != null && character.SelectedConstruction.GetComponent<Controller>() != null);
|
||||
character.Inventory.DrawOwn(spriteBatch);
|
||||
character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ?
|
||||
CharacterInventory.Layout.Default :
|
||||
|
||||
@@ -793,7 +793,7 @@ namespace Barotrauma
|
||||
|
||||
base.Draw(spriteBatch);
|
||||
|
||||
if (hideButton != null && hideButton.Visible)
|
||||
if (hideButton != null && hideButton.Visible && !Locked)
|
||||
{
|
||||
hideButton.DrawManually(spriteBatch, alsoChildren: true);
|
||||
}
|
||||
@@ -835,6 +835,7 @@ namespace Barotrauma
|
||||
color = Color.White;
|
||||
highlightedQuickUseSlot = slots[i];
|
||||
}
|
||||
if (Locked) { color *= 0.3f; }
|
||||
|
||||
var quickUseIndicator = Items[i].AllowedSlots.Any(a => a == InvSlotType.Any) ?
|
||||
EquipIndicator : DropIndicator;
|
||||
|
||||
@@ -820,8 +820,9 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
Sprite slotSprite = slot.SlotSprite ?? slotSpriteSmall;
|
||||
|
||||
spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slot.IsHighlighted ? Color.White : Color.White * 0.8f);
|
||||
Color slotColor = slot.IsHighlighted ? Color.White : Color.White * 0.8f;
|
||||
if (inventory != null && inventory.Locked) { slotColor = Color.Gray * 0.5f; }
|
||||
spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slotColor);
|
||||
|
||||
if (item != null && drawItem)
|
||||
{
|
||||
@@ -873,14 +874,17 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
||||
Color.DarkGray * 0.9f,
|
||||
(inventory != null && inventory.Locked) ? Color.DarkGray * 0.5f : Color.DarkGray * 0.9f,
|
||||
origin: indicatorSprite.size / 2,
|
||||
rotate: 0.0f,
|
||||
scale: indicatorScale);
|
||||
|
||||
|
||||
Color indicatorColor = ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green);
|
||||
if (inventory != null && inventory.Locked) { indicatorColor *= 0.5f; }
|
||||
|
||||
spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(),
|
||||
sourceRectangle: new Rectangle(indicatorSprite.SourceRect.Location, new Point((int)(indicatorSprite.SourceRect.Width * containedState), indicatorSprite.SourceRect.Height)),
|
||||
color: ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green),
|
||||
color: indicatorColor,
|
||||
rotation: 0.0f,
|
||||
origin: indicatorSprite.size / 2,
|
||||
scale: indicatorScale,
|
||||
@@ -920,6 +924,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Color spriteColor = sprite == item.Sprite ? item.GetSpriteColor() : item.GetInventoryIconColor();
|
||||
if (inventory != null && inventory.Locked) { spriteColor *= 0.5f; }
|
||||
if (CharacterHealth.OpenHealthWindow != null && !item.UseInHealthInterface)
|
||||
{
|
||||
spriteColor = Color.Lerp(spriteColor, Color.TransparentBlack, 0.5f);
|
||||
@@ -931,7 +936,10 @@ namespace Barotrauma
|
||||
sprite.Draw(spriteBatch, itemPos, spriteColor, rotation, scale);
|
||||
}
|
||||
|
||||
if (inventory != null && Character.Controlled?.Inventory == inventory && slot.QuickUseKey != Keys.None)
|
||||
if (inventory != null &&
|
||||
!inventory.Locked &&
|
||||
Character.Controlled?.Inventory == inventory &&
|
||||
slot.QuickUseKey != Keys.None)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, rect.Location.ToVector2(),
|
||||
slot.QuickUseKey.ToString().Substring(1, 1),
|
||||
|
||||
Reference in New Issue
Block a user