-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Add UI and supporting code to set custom loadouts for rebel troops #3392
base: unstable
Are you sure you want to change the base?
Add UI and supporting code to set custom loadouts for rebel troops #3392
Conversation
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.
LGTM
tooltip = ""; | ||
action = ""; | ||
tooltip = "Customize loadouts for rebel AI troops"; //$STR_antistasi_dialogs_commander_comm_customLoadouts_tooltip; | ||
action = "if (player == theBoss) then {closeDialog 0; createDialog ""A3A_customLoadoutsDialog""} else {[""Custom Loadouts"", ""Only commanders have access to this function""] call A3A_fnc_customHint}"; |
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.
// TODO: Localize
Or just localize it yourself.
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.
This will to a degree invalidate #3083, but i suppose it's fine.
the optics selection should probably be removed for now, or set to always display random until there's any particular way we want it to work
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.
actually, lgtm
To check I'm not missing something here, I don't see how it affects #3083, because the pistols are only used before a rifle is unlocked, and this UI only gives you any control once a rifle is unlocked? Going to put the fix for Tiny's click-spam bug in here too, otherwise it'll collide. |
Added the likely fix for #3449. It's not easy to prove because it depends on specific network & thread timings. |
if !(primaryWeapon _unit isEqualTo "") then { | ||
if (_weapon == primaryWeapon _unit) exitWith {}; | ||
private _magazines = getArray (configFile / "CfgWeapons" / (primaryWeapon _unit) / "magazines"); | ||
{_unit removeMagazines _x} forEach _magazines; // Broken, doesn't remove mags globally. Pain to fix. |
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.
{_unit removeMagazines _x} forEach _magazines; // Broken, doesn't remove mags globally. Pain to fix. | |
{ | |
_unit removePrimaryWeaponItem _x; | |
_unit removeMagazineGlobal _x; | |
} forEach _magazines; |
|
||
private _categories = _weapon call A3A_fnc_equipmentClassToCategories; | ||
|
||
if ("GrenadeLaunchers" in _categories && {"Rifles" in _categories} ) then { |
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.
if ("GrenadeLaunchers" in _categories && {"Rifles" in _categories} ) then { | |
if (_categories findAny ["GrenadeLaunchers", "Rifles"] isNotEqualTo -1) then { |
In my testing, the old seemed to average 20ms, while the new 15. Also the new one is way cleaner.
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.
It's wrong though. Should be comparing to -1
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.
Yeah, I only just now realized that mistake, which you beat me to. I keep forgetting this thing doesn't return boolean. Fixed.
_secWeapon lbSetCurSel 0; | ||
_curClass = _roleGear getOrDefault ["SecWeapon", "Random"]; | ||
if (_roleData#3 != "") then { [_secWeapon, _roleData#3, _curClass] call _fnc_addItems }; | ||
// disable if not valid? |
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.
// disable if not valid? | |
// TODO disable if not valid? |
What type of PR is this.
What have you changed and why?
Added a UI and supporting code to set partial custom loadouts for rebel troops. This is strictly vetted by unit type to avoid exploits: Only grenadiers can use grenade launchers, for example. Ammunition is only lightly configurable (choice of "normal" or "high"). If there aren't enough weapons of a type, they can't be selected although in some cases they may spawn with the "random" option. If you only want to force some aspects of a loadout and leave the rest random, this is also possible.
Optics button is a placeholder. Not sure whether to implement anything here. There's currently no vetting for item existence, so if you change modset within a saved game then you might need to reset the loadouts in the UI.
The button to access the UI is on the right in the commander menu. There was a free slot after I switched it to 2x5.
Please specify which Issue this PR Resolves.
closes #XXXX
Please verify the following and ensure all checks are completed.
Needs a DS test but it uses similar mechanics to A3A_rebelGear so it should be fine.
Is further testing or are further changes required?