Try to fill the chamber.
930 {
931 bool didSomething = false;
932 bool chamberFullRng = (flags & WeaponWithAmmoFlags.CHAMBER_RNG_SPORADIC);
933 bool chamberRng = (flags & WeaponWithAmmoFlags.CHAMBER_RNG);
934 bool chamber = (flags & WeaponWithAmmoFlags.CHAMBER);
935
936
937 if (chamber || chamberFullRng)
938 {
939
940 if (ammoType != "")
941 {
942 if (!AmmoTypesAPI.MagazineTypeToAmmoType(ammoType, ammoType))
943 return false;
944 }
945 else if (!(flags & WeaponWithAmmoFlags.AMMO_CHAMBER_RNG))
946 {
947 ammoType = GetRandomChamberableAmmoTypeName(0);
948 }
949
950
951 int muzzCount = GetMuzzleCount();
952 int amountToChamber = muzzCount;
953
954 if (chamberRng)
955 amountToChamber = Math.RandomIntInclusive(0, muzzCount);
956
957
958 for (int m = 0; m < muzzCount; ++m)
959 {
960 if (chamberFullRng)
961 chamber = Math.RandomIntInclusive(0, 1);
962
963 if (chamber)
964 {
966 {
967 didSomething = true;
968 amountToChamber--;
969 if (amountToChamber <= 0)
970 break;
971 }
972 }
973 }
974 }
975
976 if (!didSomething)
977 return false;
978
979
982
983 return true;
984 }
bool FillSpecificChamber(int muzzleIndex, float dmg=0, string ammoType="")
void RandomizeFSMState()
With the parameters given, selects a random suitable state for the FSM of the weapon @WARNING: Weapon...