9 if (!spawnGearPresetFiles || (spawnGearPresetFiles && spawnGearPresetFiles.Count() == 0))
50 for (
int j = 0;
j <
p.spawnWeight;
j++)
73 if (!
data.HasAttachmentSlotSetsDefined())
75 Debug.
Log(
"No non-empty 'attachmentSlotItemSets' array found. Skipping slot spawns",
"n/a",
"n/a",
"ProcessSlotsEquipment");
102 for (
int j = 0;
j <
dis.spawnWeight;
j++)
116 if (!
data.HasDiscreteUnsortedItemSetsDefined())
118 Debug.
Log(
"No non-empty 'discreteUnsortedItemSets' array found. Skipping cargo spawns",
"n/a",
"n/a",
"ProcessCargoEquipment");
128 int count =
data.discreteUnsortedItemSets.Count();
132 csd =
data.discreteUnsortedItemSets[
i];
136 for (
int j = 0;
j <
csd.spawnWeight;
j++)
170 else if (
dis.itemType !=
string.Empty)
182 if (!
data.complexChildrenTypes ||
data.complexChildrenTypes.Count() < 1)
188 if (
cct.itemType ==
string.Empty)
190 Debug.
Log(
"Empty item type found in 'complexChildrenTypes' of parent : " + parent,
"n/a",
"n/a",
"SpawnSimpleChildrenItems");
200 Debug.
Log(
"FAILED spawning item: " +
cct.itemType +
" of parent: " + parent,
"n/a",
"n/a",
"SpawnComplexChildrenItems");
208 if (!
data || !
data.simpleChildrenTypes ||
data.simpleChildrenTypes.Count() < 1)
211 int count =
data.simpleChildrenTypes.Count();
215 itemType =
data.simpleChildrenTypes[
i];
216 if (itemType ==
string.
Empty)
218 Debug.
Log(
"Empty item type found at idx: " +
i.ToString() +
" of 'simpleChildrenTypes' array. Skipping",
"n/a",
"n/a",
"SpawnSimpleChildrenItems");
227 if (!
data.simpleChildrenUseDefaultAttributes)
231 Debug.
Log(
"FAILED spawning item type: " + itemType +
" to parent: " + parent,
"n/a",
"n/a",
"SpawnSimpleChildrenItems");
254 int count =
player.GetInventory().AttachmentCount();
258 Debug.
Log(
"FAILED spawning item: " + type +
", it fits in no cargo or attachment on any worn item",
"n/a",
"n/a",
"CreateChildItem");
267 return wep.SpawnAttachedMagazine(type);
270 return parent.GetInventory().CreateInInventory(type);
282 if (
item.IsMagazine())
static TStringArray GetPlayerSpawnGearPresetFiles()
Super root of all classes in Enforce script.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
static bool IsInitialized()
static bool SpawnDiscreteSlotItemSet(PlayerBase player, PlayerSpawnPresetDiscreteItemSetSlotData dis, int slotID)
static void ProcessSlotsEquipment(PlayerBase player, PlayerSpawnPreset data)
iterates over each object and spawns alternatives
static void ApplyAttributes(ItemBase item, PlayerSpawnAttributesData attributes)
static ref PlayerSpawnJsonData m_Data
static bool SpawnSimpleChildrenItems(EntityAI parent, PlayerSpawnPresetItemSetBase data)
static bool SpawnDiscreteCargoItemSet(PlayerBase player, PlayerSpawnPresetDiscreteCargoSetData csd)
static bool SpawnComplexChildrenItems(EntityAI parent, notnull PlayerSpawnPresetItemSetBase data)
could spawn other items recursively. Parent item is guaranteed here.
static bool SelectAndSpawnSlotEquipment(PlayerBase player, PlayerSpawnPresetSlotData slotData)
selects weighted slot equipment variant
static bool ProcessEquipmentData(PlayerBase player, PlayerSpawnPreset data)
equips character with the chosen preset
static bool SelectAndSpawnCargoSet(PlayerBase player, PlayerSpawnPreset data)
static void ProcessCargoEquipment(PlayerBase player, PlayerSpawnPreset data)
chooses one object from the array
static bool m_Initialized
static void HandleNewItem(notnull ItemBase item, PlayerSpawnPresetItemSetBase data)
static PlayerSpawnPreset GetRandomCharacterPreset()
static EntityAI CreateChildItem(EntityAI parent, string type)
used for specific hierarchical child spawning
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static proto float Round(float f)
Returns mathematical round of value.