Skip to content

Issue 3353 - Improved arsenal's default sort behaviour - #3951

Open
DairyProductsz wants to merge 2 commits into
official-antistasi-community:unstablefrom
DairyProductsz:issue-3353_headgear_sorting
Open

Issue 3353 - Improved arsenal's default sort behaviour#3951
DairyProductsz wants to merge 2 commits into
official-antistasi-community:unstablefrom
DairyProductsz:issue-3353_headgear_sorting

Conversation

@DairyProductsz

@DairyProductsz DairyProductsz commented Jun 12, 2026

Copy link
Copy Markdown

What type of PR is this.

  1. Bug
  2. Change
  3. Enhancement

What have you changed and why?

1. Default sort
Currently when opening the arsenal, pre-unlocked rebel items may appear in an unsorted manner by default (e.g. as noted in issue #3353, headgear appears loaded initially in a random order), although looted items will appear in the order they were obtained. However if you select some different sorting options and then click again on the "default" sort option, the lbSort call will sort items by the text of the _ctrlList items. This sorting works fine actually, since it effectively sorts items first by amount and then alphabetically, though it is also inconsistent behaviour to what you see when you initially open the arsenal.

This PR makes the default sort acts as a slightly modified lbSort. As specified in #3353, the Antistasi berets will appear first in the list if you are viewing the headgear section with the "default" sort, while everything else will sort itself by its text (i.e. by amount) as occurs with regular lbSort. The modified lbSort will also be called when initially loading the arsenal as well for consistency.

A small caveat to this solution is that when opening the arsenal, items won't appear in the order they were obtained/looted, but I think sorting by amount + name is still a good default sorting behaviour. If the original behaviour is important to maintain though, I'll make further changes.

2. Fixed sort by amount
In the case for sorting items by amount, lbSortByValue _ctrlList; was called inside the for loop, which occasionally caused items to be listed in the wrong order. I moved it outside the for loop, and everything seems fixed now.

Please specify which Issue this PR Resolves.

closes #3353

Please verify the following and ensure all checks are completed.

  1. Have you loaded the mission in LAN host?
  2. Have you loaded the mission on a dedicated server?

Is further testing or are further changes required?

  1. No
  2. Yes (Please provide further detail below.)

How can the changes be tested?

Steps: Open the arsenal and verify the items are sorted properly. Check the headgear in the "default" sort, and the Antistasi berets should be the first items in that list.


Notes:
N/A.

Currently when opening the arsenal, items may appear in an unsorted manner by default (e.g. as noted in issue official-antistasi-community#3353, headgear appears loaded initially in a random order). Clicking on the "default" sort option also doesn't do any sorting, and items will stay listed in the last way they were sorted in.

This PR makes the "default" sort option alphabetical, and items will now be displayed alphabetically when the arsenal is initially loaded as well as when "default" is selected. Also, as specified in official-antistasi-community#3353, the Antistasi berets will appear first in the list if you are viewing the headgear section with the "default" sort.
@DairyProductsz

Copy link
Copy Markdown
Author

Made a mistake with this actually. Apparently when you open the arsenal by default, weapons are listed in the order you've obtained them in, and clicking the "default" sorting option functions correctly with them. The issue only seems to happen specifically with misc. items like headgear where everything was already unlocked, so some further changes are needed.

- Default sort now acts similarly to lbSort (current default sort method), with the exception of prioritizing the Antistasi beret items
- Restored original code for alphabetical sort
- Fixed bug with "amount" based sort; lbSortByValue call was inside of the for loop
@DairyProductsz

Copy link
Copy Markdown
Author

Did some more testing with looted items and made some changes, I think the sorting behaviour should be correct now. I updated the PR description with details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Cosmetic headwear should be sorted before added

1 participant