-
Notifications
You must be signed in to change notification settings - Fork 739
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 - Improve base backpack checking #10479
Open
LinkIsGrim
wants to merge
1
commit into
master
Choose a base branch
from
arsenal-basebackpack
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: LinkIsGrim | ||
* Returns base backpack for a preset (loaded/AI) backpack variant | ||
* Basically CBA_fnc_getNonPresetClass with model checking, as some backpacks don't have variants with no cargo (#10346) | ||
* | ||
* Arguments: | ||
* 0: Backpack classname <STRING> | ||
* | ||
* Return Value: | ||
* Most viable base backpack class, "" if not a backpack <STRING> | ||
* | ||
* Example: | ||
* "B_Kitbag_rgr_Exp" call ace_arsenal_fnc_baseBackpack | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [["_item", "", [""]]]; | ||
|
||
TRACE_1("looking up base backpack",_item); | ||
|
||
(uiNamespace getVariable QGVAR(baseBackpackCache)) getOrDefaultCall [toLowerANSI _item, { | ||
private _config = configFile >> "CfgVehicles" >> _item; | ||
// TODO: handle file extension differences (implicit vs explicit .p3d) | ||
// model could have missing file extension in a variant and present in parent, but that's stupid, bad config. | ||
// It'll be inherited and match 99% of the time. Good enough until it burns, see texture checking below. | ||
private _model = getText (_config >> "model"); | ||
|
||
// Texture checking is a can of worms: we'd have to create a hashmap nConfigs + 1 times and see if they match... | ||
// ...and it wouldn't handle small things like custom patches or name tags | ||
// If this ever comes up (it likely will), we'll burn that bridge when we get to it. | ||
// private _textures = getArray (_config >> "hiddenSelectionsTextures"); | ||
|
||
while { | ||
(isClass _config) && | ||
{getNumber (_config >> "scope") > 0} && // Some preset backpacks are scope = 1 | ||
{getText (_config >> "model") == _model} | ||
// && {getArray (_config >> "hiddenSelectionsTextures") isEqualTo _textures} | ||
} do { | ||
if ( | ||
(count (_config >> "TransportItems") == 0) && | ||
{count (_config >> "TransportMagazines") == 0} && | ||
{count (_config >> "TransportWeapons") == 0} | ||
) then { | ||
break; | ||
}; | ||
_config = inheritsFrom _config; | ||
}; | ||
|
||
configName _config // return, will be "" if not a backpack | ||
}, true] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
Probably just need to move this around