BotGen bugfixes

This commit is contained in:
Chomp
2025-01-21 11:19:26 +00:00
parent 966b36715b
commit 37c1786018
4 changed files with 35 additions and 6 deletions
@@ -82,13 +82,19 @@ public class ExternalInventoryMagGen(
if (magazineTpl == defaultMagazineTpl)
{
// We were already on default - stop here to prevent infinite looping
// We were already on default - stop here to prevent infinite loop
break;
}
// Add failed magazine tpl to blacklist
attemptedMagBlacklist.Add(magazineTpl);
if (defaultMagazineTpl is null)
{
// No default to fall back to, stop trying to add mags
break;
}
// Set chosen magazine tpl to the weapons default magazine tpl and try to fit into inventory next loop
magazineTpl = defaultMagazineTpl;
magTemplate = _itemHelper.GetItem(magazineTpl).Value;
@@ -149,7 +149,7 @@ public class BotWeaponGeneratorHelper(
/// </summary>
/// <param name="weaponTemplate">Weapon to get default magazine for</param>
/// <returns>Tpl of magazine</returns>
public string GetWeaponsDefaultMagazineTpl(TemplateItem weaponTemplate)
public string? GetWeaponsDefaultMagazineTpl(TemplateItem weaponTemplate)
{
return weaponTemplate.Properties.DefMagType;
}
@@ -42,9 +42,13 @@ public class DurabilityLimitsHelper(
return GenerateMaxWeaponDurability("follower");
}
}
return GenerateMaxWeaponDurability(botRole);
var roleExistsInConfig = _botConfig.Durability.BotDurabilities.ContainsKey(botRole);
if (!roleExistsInConfig)
{
_logger.Warning($"{botRole} doesn't exist in bot config durability values, using default fallback");
}
return GenerateMaxWeaponDurability(roleExistsInConfig ? botRole : "default");
}
/// <summary>
@@ -105,7 +109,12 @@ public class DurabilityLimitsHelper(
}
}
return GenerateWeaponDurability(botRole, maxDurability);
var roleExistsInConfig = _botConfig.Durability.BotDurabilities.ContainsKey(botRole);
if (!roleExistsInConfig)
{
_logger.Warning($"{botRole} doesn't exist in bot config durability values, using default fallback");
}
return GenerateWeaponDurability(roleExistsInConfig ? botRole : "default", maxDurability);
}
/// <summary>
+15 -1
View File
@@ -274,7 +274,21 @@
"minDelta": 0,
"minLimitPercent": 15
}
}
},
"gifter": {
"armor": {
"maxDelta": 10,
"minDelta": 0,
"minLimitPercent": 15
},
"weapon": {
"lowestMax": 90,
"highestMax": 100,
"maxDelta": 10,
"minDelta": 0,
"minLimitPercent": 15
}
}
}
},
"lootItemResourceRandomization": {