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

◆ CreateChildItem()

static EntityAI PlayerSpawnHandler::CreateChildItem ( EntityAI parent,
string type )
inlinestaticprivate

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

283 {
284 PlayerBase player;
285 ItemBase newItem;
286 if (Class.CastTo(player,parent)) //special behavior
287 {
288 if (Class.CastTo(newItem,player.GetInventory().CreateInInventory(type)))
289 return newItem;
290
291 Debug.Log("FAILED spawning item: " + type + ", it fits in no cargo or attachment on any worn item","n/a","n/a","CreateChildItem");
292 return null;
293 }
294
295 //weapon magazine exception
296 if (GetGame().ConfigIsExisting(CFG_MAGAZINESPATH + " " + type) && parent.IsWeapon())
297 {
298 Weapon_Base wep
299 if (Class.CastTo(wep,parent) && wep.SpawnAmmo(type) && !wep.HasInternalMagazine(-1)) //assuming weps with internal magazine don't attach external magazines
300 {
301 Magazine mag;
302 int muzzleCount = wep.GetMuzzleCount();
303 for (int i = 0; i < muzzleCount; i++)
304 {
305 if (Class.CastTo(mag,wep.GetMagazine(i)) && mag.GetType() == type)
306 return mag;
307 }
308 }
309
310 return null;
311 }
312
313 return parent.GetInventory().CreateInInventory(type);
314 }
class GP5GasMask extends MaskBase ItemBase
void Debug()
Определения UniversalTemperatureSource.c:349
proto native CGame GetGame()
const string CFG_MAGAZINESPATH
Определения 3_Game/constants.c:222

Перекрестные ссылки Class::CastTo(), CFG_MAGAZINESPATH, GetGame() и Debug::Log().

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