10 string m_MainPartName;
11 string m_MainPartNameNoTool;
70 return m_MainPartName;
75 return m_MainPartNameNoTool;
90 m_TargetPart = target_part;
110 m_ActionInitiator = action_initiator;
115 return m_ActionInitiator;
135 if ( base_building_object )
137 string main_part_name = target.GetActionComponentName( component_index );
138 base_building_object.GetConstruction().GetConstructionPartsToBuild( main_part_name, m_BuildParts, tool, m_MainPartName,
true );
143 m_BuildParts.Clear();
150 m_BuildParts.Clear();
160 if ( base_building_object )
162 string main_part_name = target.GetActionComponentName( component_index );
163 base_building_object.GetConstruction().GetConstructionPartsToBuild( main_part_name, m_BuildPartsNoTool, null, m_MainPartNameNoTool,
false );
168 m_BuildPartsNoTool.Clear();
175 return m_BuildParts.Count();
186 if( m_BuildParts.Count() > idx )
188 return m_BuildParts.Get( idx );
195 if( m_BuildPartsNoTool.Count() > idx )
197 return m_BuildPartsNoTool.Get( idx );
207 return m_CombinationLock;
219 if ( m_CombinationLock )
221 string combination_text = m_CombinationLock.GetCombination().ToString();
224 int length_diff = m_CombinationLock.GetLockDigits() - combination_text.Length();
225 for (
int i = 0; i < length_diff; ++i )
227 combination_text =
"0" + combination_text;
231 for (
int j = 0; j < m_CombinationLock.GetLockDigits(); ++j )
233 if ( j == m_CombinationLock.GetDialIndex() )
235 dial_text +=
string.Format(
"[%1]", combination_text.Get( j ) );
239 dial_text +=
string.Format(
" %1 ", combination_text.Get( j ) );
252 string cfg_path =
"cfgVehicles" +
" " + target.GetType() +
" "+
"GUIInventoryAttachmentsProps";
254 if (
GetGame().ConfigIsExisting( cfg_path ) )
256 int child_count =
GetGame().ConfigGetChildrenCount( cfg_path );
258 for (
int i = 0; i < child_count; i++ )
261 GetGame().ConfigGetChildName( cfg_path, i, child_name );
263 string child_selection;
264 GetGame().ConfigGetText( cfg_path +
" " + child_name +
" " +
"selection", child_selection );
266 if ( selection == child_selection )
269 GetGame().ConfigGetTextArray( cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
271 for (
int j = 0; j < attachment_slots.Count(); ++j )
273 int target_slot_id =
InventorySlots.GetSlotIdFromString( attachment_slots.Get( j ) );
274 int item_slot_count = item_to_attach.GetInventory().GetSlotIdCount();
276 for (
int k = 0; k < item_slot_count; ++k )
278 int item_slot_id = item_to_attach.GetInventory().GetSlotId( k );
279 ItemBase attachment_item =
ItemBase.Cast( target.GetInventory().FindAttachment( item_slot_id ) );
281 if ( target_slot_id == item_slot_id )
283 if ( target.GetInventory().CanAddAttachmentEx( item_to_attach, item_slot_id ) && target.CanReceiveAttachment( item_to_attach, item_slot_id ) || attachment_item && attachment_item.CanBeCombined( item_to_attach ) )
285 if(target.CanDisplayAttachmentSlot(target_slot_id))
304 string cfg_path =
"cfgVehicles" +
" " + target.GetType() +
" "+
"GUIInventoryAttachmentsProps";
305 if (
GetGame().ConfigIsExisting( cfg_path ) )
307 int child_count =
GetGame().ConfigGetChildrenCount( cfg_path );
309 for (
int i = 0; i < child_count; i++ )
312 GetGame().ConfigGetChildName( cfg_path, i, child_name );
314 string child_selection;
315 GetGame().ConfigGetText( cfg_path +
" " + child_name +
" " +
"selection", child_selection );
317 if ( selection == child_selection )
320 GetGame().ConfigGetTextArray( cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
322 for (
int j = 0; j < attachment_slots.Count(); ++j )
324 int target_slot_id =
InventorySlots.GetSlotIdFromString( attachment_slots.Get( j ) );
327 EntityAI attachment = target.GetInventory().FindAttachment( target_slot_id );
328 if ( attachment && target.GetInventory().CanRemoveAttachmentEx( attachment, target_slot_id ) && !target.GetInventory().GetSlotLock( target_slot_id ) )
330 attachments.Insert( attachment );
340 if ( target.ConfigGetBool(
"canBeSplit" ) && item && !target.IsFullQuantity() )
342 int quantity_used = target.ComputeQuantityUsed( item,
true );
343 if( quantity_used != 0 )
345 target.AddQuantity( quantity_used );
346 item.AddQuantity( -quantity_used );
377 return m_Attachments.Count();
ref ActionTarget m_Target
static ActionVariantManager GetVariantManager(typename actionName)
ScriptInvoker GetOnUpdateInvoker()
void SetActionVariantCount(int count)
void ResetActionIndexes()
EntityAI GetActualAttachmentToDetach()
void SetCombinationLock(CombinationLock combination_lock)
void ConstructionActionData()
ConstructionPart GetCurrentBuildPart()
string GetDialNumberText()
CombinationLock GetCombinationLock()
int GetAttachmentsToDetachCount()
string GetMainPartNameNoTool()
ActionVariantManager m_ActionNoToolVariantManager
ConstructionPart GetBuildPartNoToolAtIndex(int idx)
void ~ConstructionActionData()
int GetConstructionPartsCount()
void CombineItems(ItemBase target, ItemBase item)
void RefreshPartsToBuild(string main_part_name, ItemBase tool, bool use_tool=true)
void SetTarget(Object target)
void OnUpdateActionsNoTool(Object item, Object target, int component_index)
int GetAttachmentSlotFromSelection(PlayerBase player, EntityAI target, ItemBase item_to_attach, string selection)
ActionVariantManager m_ActionVariantManager
void SetSlotId(int slot_id)
ConstructionPart GetBuildPartAtIndex(int idx)
void SetNextAttachmentIndex()
PlayerBase GetActionInitiator()
ConstructionPart GetTargetPart()
void GetAttachmentsFromSelection(EntityAI target, string selection, out array< EntityAI > attachments)
void SetActionInitiator(PlayerBase action_initiator)
void RefreshAttachmentsToDetach(EntityAI target, string main_part_name)
void OnUpdateActions(Object item, Object target, int component_index)
void SetTargetPart(ConstructionPart target_part)
provides access to slot configuration
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()