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

◆ CreateAttachmentPosition()

map< int, vector > AttachmentsOutOfReach::CreateAttachmentPosition ( EntityAI entity)
inlinestaticprotected

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

81 {
82 map<int, vector> ret_val = new map<int, vector>();
83
84 string type_name = entity.GetType();
85 TStringArray cfg_attachments = new TStringArray;
86
87 string cfg_path;
88
89 if ( GetGame().ConfigIsExisting(CFG_VEHICLESPATH+" "+type_name) )
90 {
91 cfg_path = CFG_VEHICLESPATH+" "+type_name+" attachments";
92 }
93 else if ( GetGame().ConfigIsExisting(CFG_WEAPONSPATH+" "+type_name) )
94 {
95 cfg_path = CFG_WEAPONSPATH+" "+type_name+" attachments";
96 }
97 else if ( GetGame().ConfigIsExisting(CFG_MAGAZINESPATH+" "+type_name) )
98 {
99 cfg_path = CFG_MAGAZINESPATH+" "+type_name+" attachments";
100 }
101
102 GetGame().ConfigGetTextArray(cfg_path, cfg_attachments);
103
104 int child_count = GetGame().ConfigGetChildrenCount("CfgNonAIVehicles");
105
106 for ( int x = 0; x < child_count; ++x )
107 {
108 string child_name;
109 GetGame().ConfigGetChildName("CfgNonAIVehicles",x , child_name);
110
111 string inventory_slot_name;
112 GetGame().ConfigGetText("CfgNonAIVehicles "+ child_name +" inventorySlot", inventory_slot_name);
113
114 if ( cfg_attachments.Find( inventory_slot_name ) > 0 )
115 {
116 string model_path;
117 GetGame().ConfigGetText("CfgNonAIVehicles "+ child_name +" model", model_path);
118
119 if ( model_path.Length() > 5 )
120 {
121 LOD lod = entity.GetLODByName(LOD.NAME_VIEW);
122
123 if ( lod )
124 {
125 model_path = model_path.Substring(0, model_path.Length() - 4);
126 model_path.ToLower();
127
128 array<Selection> selections = new array<Selection>();
129 lod.GetSelections(selections);
130
131 for ( int i = 0; i < selections.Count(); ++i )
132 {
133 string selection = selections[i].GetName();
134 selection.ToLower();
135
136 if ( selection.Contains(model_path) )
137 {
138 ret_val.Set(InventorySlots.GetSlotIdFromString( inventory_slot_name ), selections[i].GetVertexPosition(lod, 0));
139 }
140 }
141 }
142 }
143 }
144 }
145
146 return ret_val;
147 }
map
Определения ControlsXboxNew.c:4
Icon x
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 bool GetSelections(notnull out array< Selection > selections)
proto native CGame GetGame()
array< string > TStringArray
Определения EnScript.c:685
const string CFG_VEHICLESPATH
Определения constants.c:220
const string CFG_WEAPONSPATH
Определения constants.c:221
const string CFG_MAGAZINESPATH
Определения constants.c:222
proto native int Length()
Returns length of string.
bool Contains(string sample)
Returns true if sample is substring of string.
Определения EnString.c:286
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto int ToLower()
Changes string to lowercase. Returns length.

Перекрестные ссылки CFG_MAGAZINESPATH, CFG_VEHICLESPATH, CFG_WEAPONSPATH, CGame::ConfigGetChildName(), CGame::ConfigGetChildrenCount(), CGame::ConfigGetText(), CGame::ConfigGetTextArray(), string::Contains(), GetGame(), LOD::GetSelections(), InventorySlots::GetSlotIdFromString(), string::Length(), LOD::NAME_VIEW, string::Substring(), string::ToLower() и x.

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