DayZ 1.30
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 строка 397

398 {
399 if (!item_name)
400 {
401 return;
402 }
403 if ( g_Game.IsServer() )
404 {
405 float rowDist = 0;
406 float columnDist = 0;
407
408 vector playerPos;
409 vector camDirForward;
410
411 GetCameraDirections(player, false, playerPos, camDirForward);
412
413 vector camDirRight = camDirForward.Perpend() * -1;
414 int countLoop = 0;
415 for (int i = 0; i < rows; i++)
416 {
417 vector posRow = playerPos + camDirForward * rowDist;
418 vector offsetSide;
419 columnDist = 0;
420 for (int j = 0; j < columns; j++)
421 {
422 offsetSide = camDirRight * columnDist;
423 vector placement = posRow + offsetSide;
424 float hlth = health * MiscGameplayFunctions.GetTypeMaxGlobalHealth( item_name );
425 EntityAI ent = SpawnEntityOnGroundPos(player, item_name, hlth, quantity, placement, special );
426 ent.PlaceOnSurface();
427
428 InventoryItem item;
429 if (Class.CastTo(item, ent) && withPhysics)
430 item.ThrowPhysically(null, "0 0 0");
431
432 countLoop++;
433 if (countLoop == count)
434 {
435 return;
436 }
437 columnDist += gapColumn;
438 }
439 rowDist += gapRow;
440 }
441 }
442 else
443 {
444 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);
445 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID, params, true);
446 }
447 }
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:4074
ERPCs
Определения ERPCs.c:2
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string object_name, vector pos)
Определения PluginDeveloper.c:478
void GetCameraDirections(Man player, bool allowFreeflight, out vector position, out vector direction)
Определения PluginDeveloper.c:459
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().