IsWeaponAllowedByClass

Tracking Issue: #1057

Tags: compatibility

When the game needs to determine whether a weapon with particular category can be used by a particular soldier class, it calls the IsWeaponAllowedByClass() function, which checks whether the weapon is allowed in the inventory slot specified in the Weapon Template.

This is a problem, because there are other Highlander features that allow equipping items in slots other than the one specified in the Weapon Template, such as using secondary weapons as primaries or equipping them into special sidearm slots.

To address this issue, this feature introduces a new function: IsWeaponAllowedByClass_CH(), which checks whether the weapon is allowed in the inventory slot given to the function as an argument.

Compatibility

For the sake of consistency, it is preferable that mods call IsWeaponAllowedByClass_CH() rather than IsWeaponAllowedByClass() whenever possible.

GetAllowedClassForWeapon_CH()

Similarly to IsWeaponAllowedByClass_CH(), a GetAllowedClassForWeapon_CH() function was created to find a soldier class template of a class that is allowed to use a weapon of the specified template in the specified inventory slot, rather than in the slot specified in the weapon template itself.

Compatibility

For the sake of consistency, it is preferable that mods call GetAllowedClassForWeapon_CH() rather than GetAllowedClassForWeapon() whenever possible.

Source code references