-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make X2SoldierClassTemplate::IsWeaponAllowedByClass()
more flexible
#1135
Make X2SoldierClassTemplate::IsWeaponAllowedByClass()
more flexible
#1135
Conversation
2ff5ce8
to
cd4a28a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add HL-Docs: ref:
to the changed calls
Doneso. |
Better compare: 0518418...5d6bfce |
Something went quite wrong with the generated docs: @robojumper any ideas? |
what would you expect given the documentation comments? the body of |
I see (wasn't aware of that behaviour). @Iridar mind adjusting so that the generated docs page is sanely readable? |
Sure, I'll try. |
Do you mind giving me a link where I can preview the docs? |
Better compare: 0518418...cfcc538 |
b470f3b
to
ee3ed07
Compare
Adjusted based on feedback and discord conversation, rebased to have just two commits. |
…and `GetAllowedClassForWeapon_CH()`
a4df699
to
23be844
Compare
Closes #1057
This replaces all instances of
IsWeaponAllowedByClass()
with a new wrapper in existing CHL and base game code.I've tested the PR and it works as intended, e.g. if a
Pistol
weapon category is added to soldier class' AllowedWeapons, then the event listener forOverrideShowItemInLockerList
is all that's required to equip it in-game.The
IsWeaponAllowedByClass_CH()
in this listener itself is optional; if omitted then pistols will show up for all soldier classes, but the in-game UI will forbid equipping them, mentioning that they are "sharpshooter only", or whichever soldier class is found byGetAllowedClassForWeapon_CH()
first.Note: the
HeavyWeaponTemplate.InventorySlot == eInvSlot_HeavyWeapon
check inXCGS_Unit::GetBestHeavyWeaponTemplates()
is not useless, even though the originalX2SoldierClassTemplate::IsWeaponAllowedByClass()
allows any weapons that are not primary or secondary weapons, nothing is stopping mods from creating their own soldier classes that would restrict the use of heavy weapons.