DayZ 1.29
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 строка 348

349 {
350 if (!item_name)
351 {
352 return;
353 }
354 if ( g_Game.IsServer() )
355 {
356 float rowDist = 0;
357 float columnDist = 0;
358
359 vector playerPos;
360 vector camDirForward;
361
362 GetCameraDirections(player, false, playerPos, camDirForward);
363
364 vector camDirRight = camDirForward.Perpend() * -1;
365 int countLoop = 0;
366 for (int i = 0; i < rows; i++)
367 {
368 vector posRow = playerPos + camDirForward * rowDist;
369 vector offsetSide;
370 columnDist = 0;
371 for (int j = 0; j < columns; j++)
372 {
373 offsetSide = camDirRight * columnDist;
374 vector placement = posRow + offsetSide;
375 float hlth = health * MiscGameplayFunctions.GetTypeMaxGlobalHealth( item_name );
376 EntityAI ent = SpawnEntityOnGroundPos(player, item_name, hlth, quantity, placement, special );
377 ent.PlaceOnSurface();
378
379 InventoryItem item;
380 if (Class.CastTo(item, ent) && withPhysics)
381 item.ThrowPhysically(null, "0 0 0");
382
383 countLoop++;
384 if (countLoop == count)
385 {
386 return;
387 }
388 columnDist += gapColumn;
389 }
390 rowDist += gapRow;
391 }
392 }
393 else
394 {
395 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);
396 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID, params, true);
397 }
398 }
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:3942
ERPCs
Определения ERPCs.c:2
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string object_name, vector pos)
Определения PluginDeveloper.c:429
void GetCameraDirections(Man player, bool allowFreeflight, out vector position, out vector direction)
Определения PluginDeveloper.c:410
vector Perpend()
Returns perpendicular vector. Perpendicular vector is computed as cross product between input vector ...
Определения EnConvert.c:222

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

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