341 {
342 if (!item_name)
343 {
344 return;
345 }
347 {
348 float rowDist = 0;
349 float columnDist = 0;
350
351 vector playerPos = player.GetPosition();
352 vector camDirForward = player.GetDirection();
353 vector camDirRight = camDirForward.
Perpend() * -1;
354 int countLoop = 0;
355 for (int i = 0; i < rows; i++)
356 {
357 vector posRow = playerPos + camDirForward * rowDist;
358 vector offsetSide;
359 columnDist = 0;
360 for (int j = 0; j < columns; j++)
361 {
362 offsetSide = camDirRight * columnDist;
363 vector placement = posRow + offsetSide;
364 float hlth = health * MiscGameplayFunctions.GetTypeMaxGlobalHealth( item_name );
366 ent.PlaceOnSurface();
367
368 InventoryItem item;
369 if (Class.CastTo(item, ent) && withPhysics)
370 item.ThrowPhysically(null, "0 0 0");
371
372 countLoop++;
373 if (countLoop == count)
374 {
375 return;
376 }
377 columnDist += gapColumn;
378 }
379 rowDist += gapRow;
380 }
381 }
382 else
383 {
384 auto params = new Param10<string, int, float, float, int, int, float, float, bool, bool>(item_name, count, health, quantity, rows, columns, gapRow, gapColumn, special, withPhysics);
385 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID, params,
true);
386 }
387 }
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string item_name, float health, float quantity, vector pos, bool special=false, bool withPhysics=false)
spawns entity on exact position
vector Perpend()
Returns perpendicular vector. Perpendicular vector is computed as cross product between input vector ...
proto native CGame GetGame()