Handle when fillCamora()
cannot find camora slots in weapons modPool
This commit is contained in:
parent
9638288381
commit
8ee176b9d8
@ -46,7 +46,7 @@
|
|||||||
"bot-weapon_missing_mod_slot": "Slot: {{modSlot}}' does not exist for weapon: {{weaponId}} {{weaponName}} on {{botRole}}",
|
"bot-weapon_missing_mod_slot": "Slot: {{modSlot}}' does not exist for weapon: {{weaponId}} {{weaponName}} on {{botRole}}",
|
||||||
"bot-weapons_required_slot_missing_item": "Required slot '{{modSlot}}' on {{modName}} {{slotId}} was empty on {{botRole}}",
|
"bot-weapons_required_slot_missing_item": "Required slot '{{modSlot}}' on {{modName}} {{slotId}} was empty on {{botRole}}",
|
||||||
"bot-item_missing_props_property": "Item {{itemTpl}} {{name}} is missing a _props property",
|
"bot-item_missing_props_property": "Item {{itemTpl}} {{name}} is missing a _props property",
|
||||||
"bot-unable_to_fill_camora_slot_mod_pool_empty": "Unable to fill weapon camora slot for {{weaponId}} {{weaponName}} mod pool for item was empty",
|
"bot-unable_to_fill_camora_slot_mod_pool_empty": "Unable to fill weapon camora slots for {{weaponId}} - {{weaponName}}. Mod pool for was empty, attempting to generate dynamically",
|
||||||
"bot-unable_to_edit_limits_of_unknown_map": "Unable to edit bot limits of map: %s as it cannot be found",
|
"bot-unable_to_edit_limits_of_unknown_map": "Unable to edit bot limits of map: %s as it cannot be found",
|
||||||
"bot-unable_to_find_loot_n_value_for_bot": "Unable to find loot N value for bot: %s, using scav n value instead",
|
"bot-unable_to_find_loot_n_value_for_bot": "Unable to find loot N value for bot: %s, using scav n value instead",
|
||||||
"bot-unable_to_find_bot_in_cache": "Unable to find bot in cache with name: %s",
|
"bot-unable_to_find_bot_in_cache": "Unable to find bot in cache with name: %s",
|
||||||
|
@ -787,17 +787,25 @@ export class BotEquipmentModGenerator
|
|||||||
* Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots.
|
* Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots.
|
||||||
* This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine"
|
* This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine"
|
||||||
* @param items The items where the CylinderMagazine's camora are appended to
|
* @param items The items where the CylinderMagazine's camora are appended to
|
||||||
* @param modPool modPool which should include available cartrigdes
|
* @param modPool modPool which should include available cartridges
|
||||||
* @param parentId The CylinderMagazine's UID
|
* @param parentId The CylinderMagazine's UID
|
||||||
* @param parentTemplate The CylinderMagazine's template
|
* @param parentTemplate The CylinderMagazine's template
|
||||||
*/
|
*/
|
||||||
protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void
|
protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void
|
||||||
{
|
{
|
||||||
const itemModPool = modPool[parentTemplate._id];
|
let itemModPool = modPool[parentTemplate._id];
|
||||||
|
|
||||||
if (!itemModPool)
|
if (!itemModPool)
|
||||||
{
|
{
|
||||||
this.logger.error(this.localisationService.getText("bot-unable_to_fill_camora_slot_mod_pool_empty", {weaponId: parentTemplate._id, weaponName: parentTemplate._name}));
|
this.logger.warning(this.localisationService.getText("bot-unable_to_fill_camora_slot_mod_pool_empty", {weaponId: parentTemplate._id, weaponName: parentTemplate._name}));
|
||||||
|
const camoraSlots = parentTemplate._props.Slots.filter(x => x._name.startsWith("camora"));
|
||||||
|
|
||||||
|
// Attempt to generate camora slots for item
|
||||||
|
modPool[parentTemplate._id] = {};
|
||||||
|
for (const camora of camoraSlots)
|
||||||
|
{
|
||||||
|
modPool[parentTemplate._id][camora._name] = camora._props.filters[0].Filter;
|
||||||
|
}
|
||||||
|
itemModPool = modPool[parentTemplate._id];
|
||||||
}
|
}
|
||||||
|
|
||||||
let exhaustableModPool = null;
|
let exhaustableModPool = null;
|
||||||
@ -843,10 +851,10 @@ export class BotEquipmentModGenerator
|
|||||||
const modSlotId = slot._name;
|
const modSlotId = slot._name;
|
||||||
const modId = this.hashUtil.generate();
|
const modId = this.hashUtil.generate();
|
||||||
items.push({
|
items.push({
|
||||||
"_id": modId,
|
_id: modId,
|
||||||
"_tpl": modTpl,
|
_tpl: modTpl,
|
||||||
"parentId": parentId,
|
parentId: parentId,
|
||||||
"slotId": modSlotId
|
slotId: modSlotId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user