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