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

◆ SpawnEntityOnCursorDir()

EntityAI PluginBase::SpawnEntityOnCursorDir ( PlayerBase player,
string item_name,
float quantity,
float distance,
float health = -1,
bool special = false,
string presetName = "",
bool withPhysics = false )
inlineprotected

spawns entity in direction of cursor at specified distance

Аргументы
[in]healthhealth of the item
[in]quantityquantity to set if item.HasQuantity() (-1 == set to max)
[in]distancedistance of the item from player
Возвращает
entity if ok, null otherwise

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

460 {
461
462 if ( GetGame().IsServer() )
463 {
464 // Client -> Server Spawning: Server Side
465 EntityAI entity = player.SpawnEntityOnGroundOnCursorDir(item_name, distance);
466
467 if ( entity )
468 {
469 if ( !entity.IsBuilding() && health < 0 && entity.GetMaxHealth() > 0)//check for default (-1)
470 {
471 health = entity.GetMaxHealth();
472 }
473 SetupSpawnedEntity( player,entity, health, quantity, special, presetName );
474 }
475 else
476 OnSpawnErrorReport( item_name );
477
478 InventoryItem item;
479 if (Class.CastTo(item, entity) && withPhysics)
480 item.ThrowPhysically(null, "0 0 0");
481
482 return entity;
483 }
484 else
485 {
486 // Client -> Server Spawning: Client Side
487 Param7<string, float, float, float, bool, string, bool> params = new Param7<string, float, float, float, bool, string, bool>(item_name, quantity, distance, health, special, presetName, withPhysics);
488 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_ITEM_ON_CURSOR, params, true);
489 }
490 return NULL;
491 }
class LogManager EntityAI
ERPCs
Определения ERPCs.c:2
override bool IsBuilding()
Определения Building.c:219
void OnSpawnErrorReport(string name)
Определения PluginDeveloper.c:294
void SetupSpawnedEntity(PlayerBase player, EntityAI entity, float health, float quantity=-1, bool special=false, string presetName="")
Определения PluginDeveloper.c:301
proto native CGame GetGame()

Перекрестные ссылки Class::CastTo(), GetGame(), EntityAI::IsBuilding(), OnSpawnErrorReport() и SetupSpawnedEntity().

Используется в OnRPCSpawnEntityOnCursorDir() и SpawnFromClipboard().