-
Notifications
You must be signed in to change notification settings - Fork 736
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
Arsenal - Add Default Loadouts API #6558
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.
just needs to remove a line and it's good.
addons/arsenal/XEH_preInit.sqf
Outdated
@@ -8,6 +8,7 @@ PREP_RECOMPILE_START; | |||
PREP_RECOMPILE_END; | |||
|
|||
// Arsenal | |||
GVAR(defaultLoadoutsList) = []; |
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.
You're breaking default loadouts, this variable already exists whatever happens due to https://github.com/acemod/ACE3/blob/master/addons/arsenal/Cfg3DEN.hpp#L11
|
||
params [["_name", "", [""]], ["_loadout", [], [[]], 10]]; | ||
|
||
GVAR(defaultLoadoutsList) append [_name, _loadout]; |
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.
Maybe some check to not add same name twice? Not sure if that matters.
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.
true, completely forgot about that too, you definitely need name checking in there.
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 uses the display name for identifying a loadout? You know that's evil.
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.
I can't identify loadouts by magic, I had to use something (plus it makes sense)
GVAR(defaultLoadoutsList) = []; | ||
}; | ||
if (is3DEN) then { | ||
GVAR(defaultLoadoutsList) append (QGVAR(DummyCategory) get3DENMissionAttribute QGVAR(DefaultLoadoutsListAttribute)); |
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.
parenthesis for readability.
This reverts commit a53d210.
#6558 (comment) |
lacks documentation :) |
@@ -8,7 +8,7 @@ class Cfg3DEN { | |||
class GVAR(DefaultLoadoutsListAttribute) { | |||
property = QGVAR(DefaultLoadoutsListAttribute); | |||
value = 0; | |||
expression = "if !(is3DEN) then {ace_arsenal_defaultLoadoutsList = _value};"; |
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.
@alganthe Was there a reason this was like this? Could I break something by using QUOTE?
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.
expression = QUOTE(if !(is3DEN) then {GVAR(defaultLoadoutsList) = _value});
works, and so does
expression = if !(is3DEN) then {GVAR(defaultLoadoutsList) = _value};
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.
I'll keep the verbose one with QUOTE
, but good point. Might abuse it later.
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.
Second one just gets auto-quoted, and will throw missing quotations warning with armake (unless that warning is disabled).
* Add addDefaultLoadout function * Initialize defaultLoadoutsList by default * Close params bracket * Revert "Initialize defaultLoadoutsList by default" This reverts commit a53d210. * Add isNil check * Remove tab * Overwrite loadout if it exists * Fix file name typo * Use findIf and copy array * Add override note to header * Make btnImport use new function instead of duplicating code * Use GVAR * Use findIf * Fix spacing * Add documentation * Improve documentation
Just tried to use this and wondered why it doesn't work. Turns out, it's not released yet :U I need this tho |
* Add addDefaultLoadout function * Initialize defaultLoadoutsList by default * Close params bracket * Revert "Initialize defaultLoadoutsList by default" This reverts commit a53d210. * Add isNil check * Remove tab * Overwrite loadout if it exists * Fix file name typo * Use findIf and copy array * Add override note to header * Make btnImport use new function instead of duplicating code * Use GVAR * Use findIf * Fix spacing * Add documentation * Improve documentation
When merged this pull request will:
addDefaultLoadout
function to arsenal so addon and mission makers can add default loadouts through script easier.findIf
like the new function.