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

◆ CreateChildItem()

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

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

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

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

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