4 override void CreateConditionComponents()
15 override typename GetInputType()
30 if ( player && target_entity )
33 target_entity.GetActionComponentNameList( target.GetComponentIndex(),selections );
35 if ( target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 )
37 for(
int i = 0; i < selections.Count(); i++ )
39 int target_slot_id =
InventorySlots.GetSlotIdFromString( selections[i] );
40 EntityAI att = target_entity.GetInventory().FindAttachment(target_slot_id);
42 if ( att && player.GetInventory().CanAddEntityIntoHands(att) )
44 if ( att.CanDetachAttachment( target_entity ) && target_entity.CanReleaseAttachment( att ) )
45 return target_slot_id;
56 if (!
GetGame().IsDedicatedServer() )
58 attSlotId = FindSlotIdToDetach(player, target, item);
61 if ( super.SetupAction( player, target, item, action_data, extra_data))
63 if (!
GetGame().IsDedicatedServer())
68 action_data_a.m_AttSlot = attSlotId;
80 if (
GetGame().IsMultiplayer() &&
GetGame().IsServer() )
return true;
82 return FindSlotIdToDetach(player, target, item) !=
InventorySlots.INVALID);
87 int target_slot_id = FindSlotIdToDetach(player, target,
null);
92 return target_entity.GetInventory().FindAttachment(target_slot_id);
97 override void OnExecuteClient(
ActionData action_data )
102 override void OnExecuteServer(
ActionData action_data )
105 Process(action_data);
113 EntityAI target_entity =
EntityAI.Cast( action_data_a.m_Target.GetObject() );
115 ItemBase attachment =
ItemBase.Cast(target_entity.GetInventory().FindAttachment(action_data_a.m_AttSlot));
119 float stackable = attachment.GetTargetQuantityMax();
120 if( stackable == 0 || stackable >= attachment.GetQuantity() )
123 action_data.m_Player.PredictiveTakeEntityToHands( attachment );
125 else if( stackable != 0 && stackable < attachment.GetQuantity() )
128 attachment.SplitIntoStackMaxHandsClient( action_data.m_Player );
142 if ( player && target_entity )
145 target_entity.GetActionComponentNameList( target.GetComponentIndex(),selections );
147 if ( target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 )
149 for(
int i = 0; i < selections.Count(); i++ )
153 int target_slot_id =
InventorySlots.GetSlotIdFromString( selections[i] );
154 EntityAI att = target_entity.GetInventory().FindAttachment(target_slot_id);
156 if ( att && player.GetInventory().CanAddEntityIntoHands(att) )
158 if ( att.CanDetachAttachment( target_entity ) && target_entity.CanReleaseAttachment( att ) )
159 return target_slot_id;
171 string m_slotsToDetach;
177 if ( player && target_entity )
180 target_entity.GetActionComponentNameList( target.GetComponentIndex(),selections );
182 if ( target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 )
184 for(
int i = 0; i < selections.Count(); i++ )
188 int target_slot_id =
InventorySlots.GetSlotIdFromString( selections[i] );
189 EntityAI att = target_entity.GetInventory().FindAttachment(target_slot_id);
191 if ( att && player.GetInventory().CanAddEntityIntoHands(att) )
193 if ( att.CanDetachAttachment( target_entity ) && target_entity.CanReleaseAttachment( att ) )
194 return target_slot_id;