Try to fill the inner magazine.
840 {
841
842 if (!HasInternalMagazine(-1))
843 return false;
844
845
846 if (ammoType != "")
847 {
848 if (!AmmoTypesAPI.MagazineTypeToAmmoType(ammoType, ammoType))
849 return false;
850 }
851
852
853 bool didSomething = false;
854 bool needUpdateStateMachine = false;
855 int muzzCount = GetMuzzleCount();
856
857 bool ammoRng = ammoType == "";
858 bool ammoFullRng = ammoRng && (flags & WeaponWithAmmoFlags.AMMO_MAG_RNG);
859
860
861 if (ammoRng && !ammoFullRng)
862 ammoType = GetRandomChamberableAmmoTypeName(0);
863
864
865 for (int i = 0; i < muzzCount; ++i)
866 {
867 bool loadAnyBullet = false;
868 int ammoCount = GetInternalMagazineMaxCartridgeCount(i);
869
870
871 if ( flags & WeaponWithAmmoFlags.QUANTITY_RNG )
872 ammoCount = Math.RandomIntInclusive(0, ammoCount);
873
874
875 if (ammoCount > 0)
876 {
877
878 for (int j = 0; j < ammoCount; ++j)
879 {
880
881 if ( ammoFullRng )
882 ammoType = GetRandomChamberableAmmoTypeName(i);
883
884 PushCartridgeToInternalMagazine(i, 0, ammoType);
885 loadAnyBullet = true;
886 didSomething = true;
887 }
888
890 {
891 if ( ammoFullRng )
892 ammoType = GetRandomChamberableAmmoTypeName(i);
893
895 needUpdateStateMachine = true;
896
897 }
898 }
899 }
900
901
902 bool chamber = (flags & WeaponWithAmmoFlags.CHAMBER) || (flags & WeaponWithAmmoFlags.CHAMBER_RNG);
904 {
905 didSomething = true;
906 }
907
908
909 if (!didSomething)
910 return false;
911
912 if( needUpdateStateMachine )
913 {
914
917 }
918
919 return true;
920 }
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...
bool FillChamber(string ammoType="", int flags=WeaponWithAmmoFlags.CHAMBER)
Try to fill the chamber.
bool MustBeChambered(int muzzleIndex)