8 override void CreateConditionComponents()
23 if (targetEntity && item)
25 if (!targetEntity.GetInventory())
28 int slotsCount = item.GetInventory().GetSlotIdCount();
30 targetEntity.GetActionComponentNameList(target.GetComponentIndex(), selections);
32 foreach (
string selection : selections)
35 if (!targetEntity.TranslateSlotFromSelection(selection, slotId))
41 for (
int i=0; i < slotsCount; ++i)
43 int itemSlotId = item.GetInventory().GetSlotId(i);
44 if (slotId == itemSlotId)
46 ItemBase currentAttachment =
ItemBase.Cast(targetEntity.GetInventory().FindAttachment(slotId));
47 if (currentAttachment)
49 if (currentAttachment.CanBeCombined(item))
54 if (targetEntity.GetInventory() && targetEntity.GetInventory().CanAddAttachment(item))
69 if (!
GetGame().IsDedicatedServer() )
71 attSlotId = FindSlotIdToAttachOrCombine(player, target, item);
74 if (super.SetupAction( player, target, item, action_data, extra_data))
76 if (!
GetGame().IsDedicatedServer())
81 action_data_a.m_AttSlot = attSlotId;
100 if (target.GetObject() && target.GetObject().CanUseConstruction())
103 return FindSlotIdToAttachOrCombine(player, target, item) !=
InventorySlots.INVALID;
106 override void OnExecuteServer(
ActionData action_data )
116 if (action_data.m_Target.IsProxy())
118 entity =
EntityAI.Cast(action_data.m_Target.GetParent());
122 entity =
EntityAI.Cast(action_data.m_Target.GetObject());
125 if (entity && action_data.m_MainItem)
127 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(entity, action_data_a.m_MainItem, action_data_a.m_AttSlot);
131 override void OnExecuteClient(
ActionData action_data)
135 EntityAI itemEntity = action_data.m_MainItem;
139 ItemBase attachment =
ItemBase.Cast(targetEntity.GetInventory().FindAttachment(action_data_a.m_AttSlot));
142 attachment.CombineItemsClient(itemEntity);
147 float stackable = item_base.GetTargetQuantityMax( action_data_a.m_AttSlot );
149 if (stackable == 0 || stackable >= item_base.GetQuantity())
151 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(targetEntity, itemEntity, action_data_a.m_AttSlot);
153 else if (stackable != 0 && stackable < item_base.GetQuantity())
155 item_base.SplitIntoStackMaxClient(targetEntity, action_data_a.m_AttSlot);