by Setzer » Sun May 03, 2009 8:23 pm
I apologize if this post is rather convoluted. I can deliver a summed-up version if needed.
Most current methods of creating reloading weapons involve two ammo types: an ammo reservoir (e.g. "Clip") and a loaded clip which counts the bullets currently in the weapon itself. A common oddity in this system, however, is that usually the clip count is defined as AmmoType2 and the reservoir as AmmoType1. This lends itself better to being properly displayed on the default HUD, but this usually means that the primary fire generally takes away from AmmoType2 (via A_TakeInventory) when firing normally.
This winds up causing some trouble when ammo becomes scarce. In the event that the player loads the last of his or her ammo into their gun (resulting in zero spare ammo but a few shots left in the clip), the engine notices the zero ammo count and will suddenly switch the gun away when attempting to fire, thinking that the weapon is empty when in reality it is not. The common solution I have seen has been to simply add +AMMO_OPTIONAL to the weapon definition, but while it fixes the zero-ammo problem, it also allows the weapon to be selected even when its ammo supply has been completely exhausted. Needless to say, this botches up auto-switching entirely, which can quickly become a major hassle. This issue manifests itself most noticably in mods such as Zen Dynamics, in which any weapon is inconveniently selectable at any time regardless of whether the weapon is empty or not.
A noble fix: the AMMO_CHECKBOTH flag. This flag, if checked, will disallow auto-switching until both AmmoTypes are depleted. The above scenario will be mended perfectly, as the engine will autoswitch if both the ammo reservoir and current clip are empty but not until then. In further practice, this would also allow a weapon that uses, say, "Clip" for AmmoType1 and "Shell" for AmmoType2 to stay selected if one ammo type is empty while the other is full. I always found it odd that such a weapon is switched away if I run out of Clips and accidentally tap my primary fire key, even though I still have a plethra of Shells remaining.
A lengthy explanation, but hopefully a justified one.
I apologize if this post is rather convoluted. I can deliver a summed-up version if needed.
Most current methods of creating reloading weapons involve two ammo types: an ammo reservoir (e.g. "Clip") and a loaded clip which counts the bullets currently in the weapon itself. A common oddity in this system, however, is that usually the clip count is defined as AmmoType2 and the reservoir as AmmoType1. This lends itself better to being properly displayed on the default HUD, but this usually means that the primary fire generally takes away from AmmoType2 (via A_TakeInventory) when firing normally.
This winds up causing some trouble when ammo becomes scarce. In the event that the player loads the last of his or her ammo into their gun (resulting in zero spare ammo but a few shots left in the clip), the engine notices the zero ammo count and will suddenly switch the gun away when attempting to fire, thinking that the weapon is empty when in reality it is not. The common solution I have seen has been to simply add +AMMO_OPTIONAL to the weapon definition, but while it fixes the zero-ammo problem, it also allows the weapon to be selected even when its ammo supply has been completely exhausted. Needless to say, this botches up auto-switching entirely, which can quickly become a major hassle. This issue manifests itself most noticably in mods such as Zen Dynamics, in which any weapon is inconveniently selectable at any time regardless of whether the weapon is empty or not.
A noble fix: the AMMO_CHECKBOTH flag. This flag, if checked, will disallow auto-switching until [i]both[/i] AmmoTypes are depleted. The above scenario will be mended perfectly, as the engine will autoswitch if [i]both[/i] the ammo reservoir and current clip are empty but not until then. In further practice, this would also allow a weapon that uses, say, "Clip" for AmmoType1 and "Shell" for AmmoType2 to stay selected if one ammo type is empty while the other is full. I always found it odd that such a weapon is switched away if I run out of Clips and accidentally tap my primary fire key, even though I still have a plethra of Shells remaining.
A lengthy explanation, but hopefully a justified one.