(cdc68f306) Don't select items when aiming.
This commit is contained in:
@@ -318,24 +318,6 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle slotRect = inputContainer.Inventory.slots[slotIndex].Rect;
|
|
||||||
|
|
||||||
itemIcon.Draw(
|
|
||||||
spriteBatch,
|
|
||||||
slotRect.Center.ToVector2(),
|
|
||||||
color: requiredItem.ItemPrefab.InventoryIconColor * 0.3f,
|
|
||||||
scale: Math.Min(slotRect.Width / itemIcon.size.X, slotRect.Height / itemIcon.size.Y));
|
|
||||||
|
|
||||||
if (slotRect.Contains(PlayerInput.MousePosition))
|
|
||||||
{
|
|
||||||
string toolTipText = requiredItem.ItemPrefab.Name;
|
|
||||||
if (!string.IsNullOrEmpty(requiredItem.ItemPrefab.Description))
|
|
||||||
{
|
|
||||||
toolTipText += '\n' + requiredItem.ItemPrefab.Description;
|
|
||||||
}
|
|
||||||
tooltip = new Pair<Rectangle, string>(slotRect, toolTipText);
|
|
||||||
}
|
|
||||||
|
|
||||||
slotIndex++;
|
slotIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,14 +343,36 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool SelectItem(Character user, FabricationRecipe selectedItem)
|
||||||
|
{
|
||||||
|
selectedItemFrame.ClearChildren();
|
||||||
|
|
||||||
|
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), selectedItemFrame.RectTransform, Anchor.Center)) { RelativeSpacing = 0.03f, Stretch = true };
|
||||||
|
|
||||||
if (GameMain.Client != null)
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
FabricationRecipe recipe = child.UserData as FabricationRecipe;
|
inadequateSkills = selectedItem.RequiredSkills.FindAll(skill => user.GetSkillLevel(skill.Identifier) < skill.Level);
|
||||||
if (recipe?.DisplayName == null) { continue; }
|
|
||||||
child.Visible = recipe.DisplayName.ToLower().Contains(filter);
|
|
||||||
}
|
}
|
||||||
itemList.UpdateScrollBarSize();
|
|
||||||
itemList.BarScroll = 0.0f;
|
if (selectedItem.RequiredSkills.Any())
|
||||||
|
{
|
||||||
|
string text = TextManager.Get("FabricatorRequiredSkills") + ":\n";
|
||||||
|
foreach (Skill skill in selectedItem.RequiredSkills)
|
||||||
|
{
|
||||||
|
text += " - " + TextManager.Get("SkillName." + skill.Identifier) + " " + TextManager.Get("Lvl").ToLower() + " " + skill.Level;
|
||||||
|
if (skill != selectedItem.RequiredSkills.Last()) { text += "\n"; }
|
||||||
|
}
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), text,
|
||||||
|
textColor: inadequateSkills.Any() ? Color.Red : Color.LightGreen, font: GUI.SmallFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
float degreeOfSuccess = user == null ? 0.0f : DegreeOfSuccess(user, selectedItem.RequiredSkills);
|
||||||
|
if (degreeOfSuccess > 0.5f) { degreeOfSuccess = 1.0f; }
|
||||||
|
|
||||||
|
float requiredTime = user == null ? selectedItem.RequiredTime : GetRequiredTime(selectedItem, user);
|
||||||
|
string requiredTimeText = TextManager.Get("FabricatorRequiredTime") + ": " + ToolBox.SecondsToReadableTime(requiredTime);
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform),
|
||||||
|
requiredTimeText, textColor: ToolBox.GradientLerp(degreeOfSuccess, Color.Red, Color.Yellow, Color.LightGreen), font: GUI.SmallFont);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,16 +468,9 @@ namespace Barotrauma.Items.Components
|
|||||||
" Remoteplayer: " + c.IsRemotePlayer);
|
" Remoteplayer: " + c.IsRemotePlayer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (connection.Name == "set_state")
|
||||||
if (IsHorizontal)
|
|
||||||
{
|
{
|
||||||
if (body.SimPosition.X < doorRectSimPos.X || body.SimPosition.X > doorRectSimPos.X + doorRectSimSize.X) { return false; }
|
SetState(signal != "0", false, true);
|
||||||
diff = body.SimPosition.Y - item.SimPosition.Y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (body.SimPosition.Y > doorRectSimPos.Y || body.SimPosition.Y < doorRectSimPos.Y - doorRectSimSize.Y) { return false; }
|
|
||||||
diff = body.SimPosition.X - item.SimPosition.X;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SERVER
|
#if SERVER
|
||||||
|
|||||||
@@ -1371,20 +1371,40 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (forceSelectKey)
|
if (picker.IsKeyDown(InputType.Aim))
|
||||||
{
|
{
|
||||||
if (ic.PickKey == InputType.Select) pickHit = true;
|
pickHit = false;
|
||||||
if (ic.SelectKey == InputType.Select) selectHit = true;
|
selectHit = false;
|
||||||
}
|
|
||||||
else if (forceActionKey)
|
|
||||||
{
|
|
||||||
if (ic.PickKey == InputType.Use) pickHit = true;
|
|
||||||
if (ic.SelectKey == InputType.Use) selectHit = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pickHit = picker.IsKeyHit(ic.PickKey);
|
if (forceSelectKey)
|
||||||
selectHit = picker.IsKeyHit(ic.SelectKey);
|
{
|
||||||
|
if (ic.PickKey == InputType.Select) pickHit = true;
|
||||||
|
if (ic.SelectKey == InputType.Select) selectHit = true;
|
||||||
|
}
|
||||||
|
else if (forceActionKey)
|
||||||
|
{
|
||||||
|
if (ic.PickKey == InputType.Use) pickHit = true;
|
||||||
|
if (ic.SelectKey == InputType.Use) selectHit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pickHit = picker.IsKeyHit(ic.PickKey);
|
||||||
|
selectHit = picker.IsKeyHit(ic.SelectKey);
|
||||||
|
|
||||||
|
#if CLIENT
|
||||||
|
//if the cursor is on a UI component, disable interaction with the left mouse button
|
||||||
|
//to prevent accidentally selecting items when clicking UI elements
|
||||||
|
if (picker == Character.Controlled && GUI.MouseOn != null)
|
||||||
|
{
|
||||||
|
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
|
||||||
|
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
//if the cursor is on a UI component, disable interaction with the left mouse button
|
//if the cursor is on a UI component, disable interaction with the left mouse button
|
||||||
@@ -1398,9 +1418,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!pickHit && !selectHit) continue;
|
|
||||||
|
|
||||||
if (!ic.HasRequiredSkills(picker, out Skill tempRequiredSkill)) hasRequiredSkills = false;
|
if (!ic.HasRequiredSkills(picker, out Skill tempRequiredSkill)) hasRequiredSkills = false;
|
||||||
|
|
||||||
bool showUiMsg = false;
|
bool showUiMsg = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user