NPCs don't try to use depth charge tubes when given the "operate railgun" command
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<Sprite texture="Content/UI/uiIcons.png" sourcerect="192,0,64,64"/>
|
||||
</Order>
|
||||
|
||||
<Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="0.12,0.3,0.5,1.0">
|
||||
<Order name="Operate Railgun" doingtext="Operating Railgun" targetitemname="Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="0.12,0.3,0.5,1.0">
|
||||
<Sprite texture="Content/UI/uiIcons.png" sourcerect="0,64,64,64"/>
|
||||
</Order>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -71,8 +72,8 @@ namespace Barotrauma
|
||||
for (int n = 0; n<2; n++)
|
||||
{
|
||||
List<Order> orders = (n==0) ?
|
||||
Order.PrefabList.FindAll(o => o.ItemComponentType == null) :
|
||||
Order.PrefabList.FindAll(o=> o.ItemComponentType != null);
|
||||
Order.PrefabList.FindAll(o => o.ItemComponentType == null && string.IsNullOrEmpty(o.ItemName)) :
|
||||
Order.PrefabList.FindAll(o => o.ItemComponentType != null || !string.IsNullOrEmpty(o.ItemName));
|
||||
|
||||
int startX = -(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2;
|
||||
|
||||
@@ -81,9 +82,12 @@ namespace Barotrauma
|
||||
{
|
||||
int x = startX + (buttonWidth + spacing) * (i % orders.Count);
|
||||
|
||||
if (order.ItemComponentType!=null)
|
||||
if (order.ItemComponentType!=null || !string.IsNullOrEmpty(order.ItemName))
|
||||
{
|
||||
var matchingItems = Item.ItemList.FindAll(it => it.components.Find(ic => ic.GetType() == order.ItemComponentType) != null);
|
||||
List<Item> matchingItems = !string.IsNullOrEmpty(order.ItemName) ?
|
||||
Item.ItemList.FindAll(it => it.Name == order.ItemName) :
|
||||
Item.ItemList.FindAll(it => it.components.Any(ic => ic.GetType() == order.ItemComponentType));
|
||||
|
||||
int y2 = y;
|
||||
foreach (Item it in matchingItems)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,12 @@ namespace Barotrauma
|
||||
if (equip)
|
||||
{
|
||||
var pickable = targetItem.GetComponent<Pickable>();
|
||||
if (pickable == null)
|
||||
{
|
||||
canBeCompleted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
//check if all the slots required by the item are free
|
||||
foreach (InvSlotType slots in pickable.AllowedSlots)
|
||||
{
|
||||
@@ -112,8 +118,14 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
private void FindTargetItem()
|
||||
{
|
||||
float currDist = moveToTarget == null ? 0.0f : Vector2.DistanceSquared(moveToTarget.Position, character.Position);
|
||||
if (itemName == null)
|
||||
{
|
||||
if (targetItem == null) canBeCompleted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
float currDist = moveToTarget == null ? 0.0f : Vector2.DistanceSquared(moveToTarget.Position, character.Position);
|
||||
|
||||
for (int i = 0; i < 10 && currSearchIndex < Item.ItemList.Count - 2; i++)
|
||||
{
|
||||
currSearchIndex++;
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Barotrauma
|
||||
public readonly Sprite SymbolSprite;
|
||||
|
||||
public readonly Type ItemComponentType;
|
||||
public readonly string ItemName;
|
||||
|
||||
public readonly Color Color;
|
||||
|
||||
@@ -76,6 +77,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
ItemName = ToolBox.GetAttributeString(orderElement, "targetitemname", "");
|
||||
|
||||
Color = new Color(ToolBox.GetAttributeVector4(orderElement, "color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f)));
|
||||
|
||||
UseController = ToolBox.GetAttributeBool(orderElement, "usecontroller", false);
|
||||
|
||||
Reference in New Issue
Block a user