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

◆ SpawnItems()

void SpawnItems ( ItemBase ingredients[],
PlayerBase player,
array< ItemBase > spawned_objects )
protected

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

216 {
217 spawned_objects.Clear();//just to make sure
218 EntityAI object = NULL;
219
220 for (int i = 0; i < m_NumberOfResults; i++)
221 {
222 string item_to_spawn = m_ItemsToCreate[i];
223
224 if (m_ResultInheritsColor[i] != -1)
225 {
226 ItemBase item = ingredients[m_ResultInheritsColor[i]];
227 string color = item.ConfigGetString("color");
228 string new_class_name = m_ItemsToCreate[i] + color;
229 item_to_spawn = new_class_name;
230 }
231
232 if (m_ResultToInventory[i] == -1)
233 {
234 Debug.Log(" = "+m_ResultToInventory[i].ToString(),"recipes");
235 /*
236 InventoryLocation inv_loc = new InventoryLocation;
237 if (player.GetInventory().FindFirstFreeLocationForNewEntity(item_to_spawn, FindInventoryLocationType.ANY, inv_loc))
238 {
239 object = SpawnItemOnLocation(item_to_spawn, inv_loc, false);
240 }
241 */
242 object = player.GetInventory().CreateInInventory(item_to_spawn);
243 }
244 else if (m_ResultToInventory[i] >= 0)
245 {
246 /*
247 object = player.SpawnEntityOnGroundOnCursorDir(item_to_spawn, 0.5);
248
249 ItemBase item_swap_with = ingredients[m_ResultToInventory[i]];
250 player.SwapEntities(true, item_swap_with, EntityAI.Cast(object));
251 */
252 }
253
254 //spawning in inventory failed, spawning on the ground instead.....
255 if (!object)
256 {
257 object = player.SpawnEntityOnGroundRaycastDispersed(item_to_spawn,m_ResultSpawnDistance[i]);
258
259 if (!object)
260 Error("failed to spawn entity "+item_to_spawn+" , make sure the classname exists and item can be spawned");
261 }
262 spawned_objects.Insert(ItemBase.Cast(object));
263 object = null;
264 }
265 }
proto string ToString()
int m_ResultToInventory[MAXIMUM_RESULTS]
Определения RecipeBase.c:59
string m_ItemsToCreate[MAXIMUM_RESULTS]
Определения RecipeBase.c:23
int m_ResultInheritsColor[MAXIMUM_RESULTS]
Определения RecipeBase.c:61
int m_NumberOfResults
Определения RecipeBase.c:36
float m_ResultSpawnDistance[MAXIMUM_RESULTS]
Определения RecipeBase.c:58
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Определения 3_Game/tools/Debug.c:122
Определения 3_Game/tools/Debug.c:2
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки Error(), Debug::Log(), m_ItemsToCreate, m_NumberOfResults, m_ResultInheritsColor, m_ResultSpawnDistance, m_ResultToInventory и ToString().