From 8ecdabc6b3785229d717c3b4acfc495806e94ba8 Mon Sep 17 00:00:00 2001 From: Alicecomma Date: Fri, 21 Feb 2020 23:19:45 +0100 Subject: [PATCH] Fix for #1038 - 17 months ago, during RW version change, the code in the method was changed to generateCommonality from a completely different tag which doesn't exist anymore - generateAllowChance is commonly used to prevent things from being generated, while generateCommonality is not for preventing, just for weighting - All CE XML uses generateAllowChance, not generateCommonality - Therefore, this code change is necessary --- .../CombatExtended/Defs/LoadoutPropertiesExtension.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/Defs/LoadoutPropertiesExtension.cs b/Source/CombatExtended/CombatExtended/Defs/LoadoutPropertiesExtension.cs index f6f56046ba..e59edf148a 100644 --- a/Source/CombatExtended/CombatExtended/Defs/LoadoutPropertiesExtension.cs +++ b/Source/CombatExtended/CombatExtended/Defs/LoadoutPropertiesExtension.cs @@ -158,8 +158,8 @@ private void LoadWeaponWithRandAmmo(ThingWithComps gun) return; } // Determine ammo - IEnumerable availableAmmo = compAmmo.Props.ammoSet.ammoTypes.Where(a => a.ammo.alwaysHaulable).Select(a => a.ammo); //Running out of options. alwaysHaulable does exist in xml. - AmmoDef ammoToLoad = availableAmmo.RandomElementByWeight(a => a.generateCommonality); + IEnumerable availableAmmo = compAmmo.Props.ammoSet.ammoTypes.Where(a => a.ammo.alwaysHaulable && a.ammo.generateAllowChance > 0f).Select(a => a.ammo); //Running out of options. alwaysHaulable does exist in xml. + AmmoDef ammoToLoad = availableAmmo.RandomElementByWeight(a => a.generateAllowChance); compAmmo.ResetAmmoCount(ammoToLoad); }