6 [
Attribute(
"0", UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EGadgetType) )]
7 private EGadgetType m_eGadgetType;
9 protected const float TIMEOUT_S = 6.0;
11 protected IEntity m_OwnerEntity;
12 protected CharacterControllerComponent m_CharacterController;
13 protected SCR_InventoryStorageManagerComponent m_InventoryMgr;
16 protected IEntity m_ItemEntity;
17 protected bool m_bWaiting;
18 protected float m_fTimer_s;
20 protected static const string PORT_ITEM =
"ItemOut";
23 protected static ref TStringArray s_aVarsOut = {
28 override TStringArray GetVariablesOut()
34 override void OnInit(AIAgent owner)
38 m_InventoryMgr = SCR_InventoryStorageManagerComponent.Cast(
m_OwnerEntity.FindComponent(SCR_InventoryStorageManagerComponent));
43 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
46 return ENodeResult.FAIL;
50 if (IsItemEquipped(m_ItemEntity))
52 SetVariableOut(PORT_ITEM, m_ItemEntity);
54 return ENodeResult.SUCCESS;
56 else if (m_fTimer_s > TIMEOUT_S)
58 ClearVariable(PORT_ITEM);
60 return ENodeResult.FAIL;
65 return ENodeResult.RUNNING;
70 IEntity item = FindItem();
73 return ENodeResult.FAIL;
77 return ENodeResult.RUNNING;
80 if (EquipInventoryItem(item))
85 return ENodeResult.RUNNING;
88 return ENodeResult.FAIL;
95 protected void Reset()
103 override void OnAbort(AIAgent owner, Node nodeCausingAbort)
115 SCR_HoldableItemPredicate predicate =
new SCR_HoldableItemPredicate();
117 item = m_InventoryMgr.FindItem(predicate);
128 bool EquipInventoryItem(IEntity item)
137 bool IsItemEquipped(IEntity item)
144 return itemAtSlot == item;
148 protected override string GetNodeMiddleText()
153 return string.Format(
"Gadget type: %1",
typename.EnumToString(EGadgetType,
m_eGadgetType));
157 protected override bool VisibleInPalette()
163 protected override bool CanReturnRunning()
169 protected override string GetOnHoverDescription()
171 return "Equips inventory item, returns success when done and item ref.";