Skip to content
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

Merged
merged 16 commits into from
Sep 17, 2018
Merged

Arsenal - Add Default Loadouts API #6558

merged 16 commits into from
Sep 17, 2018

Conversation

654wak654
Copy link
Contributor

@654wak654 654wak654 commented Sep 2, 2018

When merged this pull request will:

  • Add a addDefaultLoadout function to arsenal so addon and mission makers can add default loadouts through script easier.
  • Change other loadout related arsenal functions to use findIf like the new function.

Copy link
Contributor

@alganthe alganthe left a 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.

@@ -8,6 +8,7 @@ PREP_RECOMPILE_START;
PREP_RECOMPILE_END;

// Arsenal
GVAR(defaultLoadoutsList) = [];
Copy link
Contributor

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];
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis for readability.

@dedmen
Copy link
Contributor

dedmen commented Sep 2, 2018

#6558 (comment)
No it's not. preInit runs before the 3DEN code. Meaning either the 3DEN code doesn't run and the list is empty. or it runs and overwrites the old value.

@PabstMirror PabstMirror added this to the 3.13.0 milestone Sep 3, 2018
@PabstMirror PabstMirror added the kind/enhancement Release Notes: **IMPROVED:** label Sep 3, 2018
@bux
Copy link
Member

bux commented Sep 3, 2018

lacks documentation :)

@654wak654 654wak654 changed the title Add Arsenal Default Loadouts API Arsenal - Add Default Loadouts API Sep 3, 2018
@@ -8,7 +8,7 @@ class Cfg3DEN {
class GVAR(DefaultLoadoutsListAttribute) {
property = QGVAR(DefaultLoadoutsListAttribute);
value = 0;
expression = "if !(is3DEN) then {ace_arsenal_defaultLoadoutsList = _value};";
Copy link
Contributor Author

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?

Copy link
Contributor

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};

Copy link
Contributor Author

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.

Copy link
Member

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).

@PabstMirror PabstMirror merged commit db6a40f into acemod:master Sep 17, 2018
@654wak654 654wak654 deleted the add-default-loadouts branch September 18, 2018 04:31
Grey-Soldierman pushed a commit to Grey-Soldierman/ACE3 that referenced this pull request Sep 18, 2018
* 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
@dedmen
Copy link
Contributor

dedmen commented Oct 9, 2018

Just tried to use this and wondered why it doesn't work. Turns out, it's not released yet :U I need this tho

@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.12.4 Nov 9, 2018
BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants