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

◆ SpawnEntityOnGroundPatternGrid()

void PluginBase::SpawnEntityOnGroundPatternGrid ( PlayerBase player,
string item_name,
int count,
float health,
float quantity,
int rows,
int columns,
float gapRow = 1,
float gapColumn = 1,
bool special = false,
bool withPhysics = false )
inlineprotected

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

341 {
342 if (!item_name)
343 {
344 return;
345 }
346 if ( GetGame().IsServer() )
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 );
365 EntityAI ent = SpawnEntityOnGroundPos(player, item_name, hlth, quantity, placement, special );
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 }
class LogManager EntityAI
ERPCs
Определения ERPCs.c:2
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string item_name, float health, float quantity, vector pos, bool special=false, bool withPhysics=false)
spawns entity on exact position
Определения PluginDeveloper.c:428
vector Perpend()
Returns perpendicular vector. Perpendicular vector is computed as cross product between input vector ...
Определения EnConvert.c:209
proto native CGame GetGame()

Перекрестные ссылки Class::CastTo(), GetGame(), vector::Perpend() и SpawnEntityOnGroundPos().

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