43 {
44 int currentIndex = -1;
46
47 m_Body.Clear();
48
50 {
51 currentIndex = m_Body.Insert(
m_Atts.GetWrapper());
52 }
53
55 {
57 }
58
59 GameInventory inv =
m_Entity.GetInventory();
61 {
62 int slotIndex = -1;
63 int sortIndex = -1;
65 if(ent)
66 {
68 if(att)
69 {
71 {
73 }
74
75 if(bodyAttachmentSortIndex.Find(currentIndex, slotIndex))
76 {
77 if(slotIndex > sortIndex)
78 {
79 m_Body.InsertAt(att, currentIndex);
80 bodyAttachmentSortIndex.Set(currentIndex, sortIndex);
81 }
82 else
83 {
84 currentIndex = m_Body.Insert(att);
85 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
86 }
87 }
88 else
89 {
90 currentIndex = m_Body.Insert(att);
91 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
92 }
93 }
94
96 if(cargo)
97 {
99 {
100 sortIndex =
m_Atts.GetSlotsSorted().Find(cargo.GetAttachmentSlotID());
101 }
102
103 if (bodyAttachmentSortIndex.Find(currentIndex, slotIndex))
104 {
105 if(slotIndex > sortIndex)
106 {
107 m_Body.InsertAt(cargo, currentIndex);
108 bodyAttachmentSortIndex.Set(currentIndex, sortIndex);
109 }
110 else
111 {
112 currentIndex = m_Body.Insert(cargo);
113 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
114 }
115 }
116 else
117 {
118 currentIndex = m_Body.Insert(cargo);
119 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
120 }
121 }
122 }
123 }
124
125 bodyAttachmentSortIndex.Clear();
126 }
int GetAttachmentSlotID()
Attachments m_Attachments
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
ref map< EntityAI, ref AttachmentsWrapper > m_AttachmentAttachmentsContainers
ref CargoContainer m_CargoGrid
proto native EntityAI GetAttachmentFromIndex(int index)
proto native int AttachmentCount()
Returns count of attachments attached to this item.