8 override void CreateConditionComponents()
14 override ActionData CreateActionData()
23 if (targetEntity && item)
29 int slotsCount = item.GetInventory().GetSlotIdCount();
31 targetEntity.GetActionComponentNameList(target.GetComponentIndex(), selections);
33 foreach (
string selection : selections)
36 if (!targetEntity.TranslateSlotFromSelection(selection, slotId))
42 for (
int i=0; i < slotsCount; ++i)
44 int itemSlotId = item.GetInventory().GetSlotId(i);
45 if (slotId == itemSlotId)
48 if (currentAttachment)
50 if (currentAttachment.CanBeCombined(item))
67 override bool SetupAction(
PlayerBase player, ActionTarget target,
ItemBase item, out ActionData action_data,
Param extra_data = null)
70 if (!
GetGame().IsDedicatedServer() )
72 attSlotId = FindSlotIdToAttachOrCombine(player, target, item);
75 if (super.SetupAction( player, target, item, action_data, extra_data))
77 if (!
GetGame().IsDedicatedServer())
82 action_data_a.m_AttSlot = attSlotId;
101 if (target.GetObject() && target.GetObject().CanUseConstruction())
104 return FindSlotIdToAttachOrCombine(player, target, item) !=
InventorySlots.INVALID;
107 override void OnExecuteServer( ActionData action_data )
117 if (action_data.m_Target.IsProxy())
119 entity =
EntityAI.Cast(action_data.m_Target.GetParent());
123 entity =
EntityAI.Cast(action_data.m_Target.GetObject());
126 if (entity && action_data.m_MainItem)
128 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(entity, action_data_a.m_MainItem, action_data_a.m_AttSlot);
132 override void OnExecuteClient(ActionData action_data)
136 EntityAI itemEntity = action_data.m_MainItem;
140 ItemBase attachment =
ItemBase.Cast(targetEntity.GetInventory().FindAttachment(action_data_a.m_AttSlot));
143 attachment.CombineItemsClient(itemEntity);
148 float stackable = item_base.GetTargetQuantityMax( action_data_a.m_AttSlot );
150 if (stackable == 0 || stackable >= item_base.GetQuantity())
152 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(targetEntity, itemEntity, action_data_a.m_AttSlot);
154 else if (stackable != 0 && stackable < item_base.GetQuantity())
156 item_base.SplitIntoStackMaxClient(targetEntity, action_data_a.m_AttSlot);