diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs
index f3b542df7..2887ca22e 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs
@@ -318,6 +318,8 @@ namespace Barotrauma.Items.Components
return true;
}
+ Rectangle slotRect = inputContainer.Inventory.slots[slotIndex].Rect;
+
itemIcon.Draw(
spriteBatch,
slotRect.Center.ToVector2(),
@@ -359,7 +361,30 @@ 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 };
+
+ /*var itemIcon = selectedItem.TargetItem.InventoryIcon ?? selectedItem.TargetItem.sprite;
+ if (itemIcon != null)
+ {
+ GUIImage img = new GUIImage(new RectTransform(new Point(40, 40), paddedFrame.RectTransform),
+ itemIcon, scaleToFit: true)
+ {
+ Color = selectedItem.TargetItem.InventoryIconColor
+ };
+ }*/
+ var nameBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform),
+ selectedItem.TargetItem.Name, textAlignment: Alignment.CenterLeft);
+
if (GameMain.Client != null)
+ {
+ inadequateSkills = selectedItem.RequiredSkills.FindAll(skill => user.GetSkillLevel(skill.Identifier) < skill.Level);
+ }
+
+ if (selectedItem.RequiredSkills.Any())
{
string text = TextManager.Get("FabricatorRequiredSkills") + ":\n";
foreach (Skill skill in selectedItem.RequiredSkills)
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
index e986a8341..09cb6ab3b 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
@@ -1276,7 +1276,7 @@ namespace Barotrauma
if (i == 1 && selectedItems[0] == selectedItems[1]) { continue; }
var item = selectedItems[i];
if (item == null) { continue; }
- if (IsKeyDown(InputType.Aim))
+ if (IsKeyDown(InputType.Aim) || !item.RequireAimToSecondaryUse)
{
item.SecondaryUse(deltaTime, this);
}
@@ -1299,7 +1299,7 @@ namespace Barotrauma
if (SelectedConstruction != null)
{
- if (IsKeyDown(InputType.Aim))
+ if (IsKeyDown(InputType.Aim) || !SelectedConstruction.RequireAimToSecondaryUse)
{
SelectedConstruction.SecondaryUse(deltaTime, this);
}
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs
index 808337a05..d5490c63d 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs
@@ -355,7 +355,7 @@ namespace Barotrauma.Items.Components
return characterUsable || character == null;
}
- //called when the item is equipped and the "aim" key is pressed
+ //called when the item is equipped and the "aim" key is pressed or when the item is selected if it doesn't require aiming.
public virtual bool SecondaryUse(float deltaTime, Character character = null)
{
return false;
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs
index 6a24898c0..20f9540b7 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs
@@ -147,11 +147,6 @@ namespace Barotrauma.Items.Components
limb.PullJointEnabled = true;
limb.PullJointWorldAnchorB = limb.SimPosition + ConvertUnits.ToSimUnits(diff);
}
-
- if (!item.RequireAimToUse)
- {
- Control(deltaTime, character);
- }
}
public override bool Use(float deltaTime, Character activator = null)
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs
index 26d896afb..af9ba2ec3 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs
@@ -242,7 +242,7 @@ namespace Barotrauma
public bool IsShootable { get; set; }
///
- /// If true, the user has to hold the "aim" key before use is registered.
+ /// If true, the user has to hold the "aim" key before use is registered. False by default.
///
[Serialize(false, false)]
public bool RequireAimToUse
@@ -250,6 +250,15 @@ namespace Barotrauma
get; set;
}
+ ///
+ /// If true, the user has to hold the "aim" key before secondary use is registered. True by default.
+ ///
+ [Serialize(true, false)]
+ public bool RequireAimToSecondaryUse
+ {
+ get; set;
+ }
+
public Color Color
{
get { return spriteColor; }