DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetAttachmentsFromSelection()

void ConstructionActionData::GetAttachmentsFromSelection ( EntityAI target,
string selection,
out array< EntityAI > attachments )
inlineprotected

См. определение в файле ConstructionActionData.c строка 300

301 {
302 attachments.Clear(); //clear output
303
304 string cfg_path = "cfgVehicles" + " " + target.GetType() + " "+ "GUIInventoryAttachmentsProps";
305 if ( GetGame().ConfigIsExisting( cfg_path ) )
306 {
307 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
308
309 for ( int i = 0; i < child_count; i++ )
310 {
311 string child_name;
312 GetGame().ConfigGetChildName( cfg_path, i, child_name );
313
314 string child_selection;
315 GetGame().ConfigGetText( cfg_path + " " + child_name + " " + "selection", child_selection );
316
317 if ( selection == child_selection )
318 {
319 ref array<string> attachment_slots = new array<string>;
320 GetGame().ConfigGetTextArray( cfg_path + " " + child_name + " " + "attachmentSlots", attachment_slots );
321
322 for ( int j = 0; j < attachment_slots.Count(); ++j )
323 {
324 int target_slot_id = InventorySlots.GetSlotIdFromString( attachment_slots.Get( j ) );
325
326 //is attached and can be detached
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 ) )
329 {
330 attachments.Insert( attachment );
331 }
332 }
333 }
334 }
335 }
336 }
class LogManager EntityAI
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native CGame GetGame()

Перекрестные ссылки CGame::ConfigGetChildName(), CGame::ConfigGetChildrenCount(), CGame::ConfigGetText(), CGame::ConfigGetTextArray(), GetGame() и InventorySlots::GetSlotIdFromString().

Используется в RefreshAttachmentsToDetach().