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 );
160 if ( base_building_object )
162 string main_part_name = target.GetActionComponentName( component_index );
225 for (
int i = 0; i < length_diff; ++i )
227 combination_text =
"0" + combination_text;
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 (
g_Game.ConfigIsExisting( cfg_path ) )
256 int child_count =
g_Game.ConfigGetChildrenCount( cfg_path );
258 for (
int i = 0; i < child_count; i++ )
261 g_Game.ConfigGetChildName( cfg_path, i, child_name );
263 string child_selection;
264 g_Game.ConfigGetText( cfg_path +
" " + child_name +
" " +
"selection", child_selection );
266 if ( selection == child_selection )
269 g_Game.ConfigGetTextArray( cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
271 for (
int j = 0; j < attachment_slots.Count(); ++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 (
g_Game.ConfigIsExisting( cfg_path ) )
307 int child_count =
g_Game.ConfigGetChildrenCount( cfg_path );
309 for (
int i = 0; i < child_count; i++ )
312 g_Game.ConfigGetChildName( cfg_path, i, child_name );
314 string child_selection;
315 g_Game.ConfigGetText( cfg_path +
" " + child_name +
" " +
"selection", child_selection );
317 if ( selection == child_selection )
320 g_Game.ConfigGetTextArray( cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
322 for (
int j = 0; j < attachment_slots.Count(); ++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 );
static ActionVariantManager GetVariantManager(typename actionName)
void CombineItems(ItemBase target, ItemBase item)
ActionVariantManager m_ActionVariantManager
void GetAttachmentsFromSelection(EntityAI target, string selection, out array< EntityAI > attachments)
ref array< ConstructionPart > m_BuildPartsNoTool
ref array< EntityAI > m_Attachments
void ResetActionIndexes()
void SetSlotId(int slot_id)
int GetAttachmentSlotFromSelection(PlayerBase player, EntityAI target, ItemBase item_to_attach, string selection)
ConstructionPart GetTargetPart()
ref array< ConstructionPart > m_BuildParts
string GetDialNumberText()
void RefreshAttachmentsToDetach(EntityAI target, string main_part_name)
void OnUpdateActionsNoTool(Object item, Object target, int component_index)
CombinationLock GetCombinationLock()
int GetAttachmentsToDetachCount()
void SetCombinationLock(CombinationLock combination_lock)
PlayerBase GetActionInitiator()
ActionVariantManager m_ActionNoToolVariantManager
int GetConstructionPartsCount()
EntityAI GetActualAttachmentToDetach()
void SetActionInitiator(PlayerBase action_initiator)
ConstructionPart GetBuildPartNoToolAtIndex(int idx)
ref ConstructionPart m_TargetPart
PlayerBase m_ActionInitiator
void ConstructionActionData()
void SetTargetPart(ConstructionPart target_part)
CombinationLock m_CombinationLock
string GetMainPartNameNoTool()
void ~ConstructionActionData()
void RefreshPartsToBuild(string main_part_name, ItemBase tool, bool use_tool=true)
void OnUpdateActions(Object item, Object target, int component_index)
ConstructionPart GetBuildPartAtIndex(int idx)
ConstructionPart GetCurrentBuildPart()
void SetNextAttachmentIndex()
void SetTarget(Object target)
string m_MainPartNameNoTool
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
proto string Get(int index)
Gets n-th character from string.
proto native int Length()
Returns length of string.