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)
70 if (!
GetGame().IsDedicatedServer() )
75 if (super.SetupAction( player, target, item, action_data, extra_data))
77 if (!
GetGame().IsDedicatedServer())
101 if (target.GetObject() && target.GetObject().CanUseConstruction())
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);
136 EntityAI itemEntity = action_data.m_MainItem;
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);
class ActionTargets ActionTarget
override void CreateConditionComponents()
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=null)
int FindSlotIdToAttachOrCombine(PlayerBase player, ActionTarget target, ItemBase item)
void ActionAttachOnSelection()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnExecuteServer(ActionData action_data)
override ActionData CreateActionData()
override void OnExecuteClient(ActionData action_data)
ref CCIBase m_ConditionItem
void ClearInventoryReservationEx(ActionData action_data)
ref CCTBase m_ConditionTarget
void ActionSingleUseBase()
proto native bool CanAddAttachment(notnull EntityAI e)
Check if attachment can be added to any slot.
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
script counterpart to engine's class Inventory
const int INVALID
Invalid slot (-1)
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()