(cad2b1306) Fix the camera issue on turrets.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Barotrauma
|
||||
public bool IsShootable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[Serialize(false, false)]
|
||||
public bool RequireAimToUse
|
||||
@@ -250,6 +250,15 @@ namespace Barotrauma
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If true, the user has to hold the "aim" key before secondary use is registered. True by default.
|
||||
/// </summary>
|
||||
[Serialize(true, false)]
|
||||
public bool RequireAimToSecondaryUse
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return spriteColor; }
|
||||
|
||||
Reference in New Issue
Block a user