Skip to content

Arsenal - Fix the arsenal overfill prevention function#10946

Merged
Drofseh merged 12 commits intoacemod:masterfrom
Nomas-X:arsenal_preventOverfilling_fix
Jun 11, 2025
Merged

Arsenal - Fix the arsenal overfill prevention function#10946
Drofseh merged 12 commits intoacemod:masterfrom
Nomas-X:arsenal_preventOverfilling_fix

Conversation

@Nomas-X
Copy link
Copy Markdown
Contributor

@Nomas-X Nomas-X commented Jun 4, 2025

When merged this pull request will:

  • This merge will fix issue Arsenal Overfill Prevention Does Not Prevent Magazine / Weapon Overfill #10945 and allow overfill prevention to work properly. Specifically instead of only removing items cargo when the overfill prevention function is called, weapons and magazines now also can be removed.
    • Replaced the original item cargo check here with one that checks for all cargo types of weapon, magazine, and items to ensure overfill prevention works properly.
    • A switch was added to go through all item types properly.
  • This merge adds the authors of the code and bug find / fix to the AUTHORS.txt.

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

Nomas-X and others added 5 commits June 4, 2025 03:50
- Added cargo removal and checking for all 3 cargo types:
  - weapon
  - magazine
  - item

- Used `call compile format` to avoid writing 3 extremely similar loops.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>
- Switching from `call compile` to switches as I was informed switches are much faster.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>
- Added Redwan S. / Nomas and Sky / Esmeray6 to the list of authors as per guideline.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>
- Improved readability and also because OCD.
- Added Redwan S. / Nomas & Sky / Esmeray6 to the list of function authors.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>
Drofseh
Drofseh previously requested changes Jun 4, 2025
Copy link
Copy Markdown
Contributor

@Drofseh Drofseh left a comment

Choose a reason for hiding this comment

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

Tabs need to be changed to spaces

Nomas-X and others added 2 commits June 4, 2025 05:34
Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
- Fixed indentation as per ACE code guidelines.
@Nomas-X Nomas-X requested review from DartRuffian and Drofseh June 4, 2025 02:41
@Andx667
Copy link
Copy Markdown
Contributor

Andx667 commented Jun 4, 2025

couldnt you technically also have a backpack inside a container, how would the current and the new script handle it?

@Nomas-X
Copy link
Copy Markdown
Contributor Author

Nomas-X commented Jun 4, 2025

couldnt you technically also have a backpack inside a container, how would the current and the new script handle it?

From what I know and have just tried in the editor you cannot store a backpack inside a player worn container. You can store a vest or uniform but not a backpack.

The uniform and vest are handled as "items" so all functions as intended.

@OverlordZorn
Copy link
Copy Markdown
Contributor

image
you can put backpacks inside a backpacks, but they need to be empty

- Added support for backpack item type as well. Thanks to @OverlordZorn & @Andx667 for pointing it out.
@Nomas-X
Copy link
Copy Markdown
Contributor Author

Nomas-X commented Jun 4, 2025

image you can put backpacks inside a backpacks, but they need to be empty

Oh, I never was able to put it in because I kept dragging onto the icon or right clicking, just had to drag it into the space...

Fixed now, thanks for pointing it out.

private _currentContainer = _x;
{
_currentContainer addItemCargoGlobal [_x, -1];
private _cargoTypes = ["Weapon", "Magazine", "Item", "Backpack"];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move outside of the loop, no need to reassign it every iteration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done as of 0f13645

Nomas-X and others added 4 commits June 5, 2025 00:39
Alphabetically ordered
- Moved `_cargoTypes` variable outside of loop, no need to redefine every iteration.
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@Nomas-X Nomas-X left a comment

Choose a reason for hiding this comment

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

Updated as per @johnb432 notes.

private _currentContainer = _x;
{
_currentContainer addItemCargoGlobal [_x, -1];
private _cargoTypes = ["Weapon", "Magazine", "Item", "Backpack"];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done as of 0f13645

@Nomas-X Nomas-X requested a review from johnb432 June 4, 2025 21:45
@Drofseh Drofseh requested review from Drofseh and removed request for DartRuffian and Drofseh June 4, 2025 22:03
@Nomas-X
Copy link
Copy Markdown
Contributor Author

Nomas-X commented Jun 5, 2025

Is there anything more I need to do besides wait?

I am in no rush, I'm asking because this is my first PR here, just to confirm I am not missing something obvious 😅

@Drofseh Drofseh dismissed their stale review June 5, 2025 18:03

outdated

@PabstMirror PabstMirror added this to the 3.20.0 milestone Jun 10, 2025
@PabstMirror PabstMirror added the kind/enhancement Release Notes: **IMPROVED:** label Jun 10, 2025
Copy link
Copy Markdown
Contributor

@PabstMirror PabstMirror left a comment

Choose a reason for hiding this comment

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

lgtm

@johnb432 johnb432 changed the title arsenal - Fix the arsenal overfill prevention function fnc_preventOverfilling.sqf Arsenal - Fix the arsenal overfill prevention function Jun 10, 2025
@Drofseh Drofseh merged commit 5dd9fd7 into acemod:master Jun 11, 2025
4 of 6 checks passed
OverlordZorn pushed a commit to OverlordZorn/ACE3 that referenced this pull request Jun 16, 2025
* Update fnc_preventOverfilling.sqf

- Added cargo removal and checking for all 3 cargo types:
  - weapon
  - magazine
  - item

- Used `call compile format` to avoid writing 3 extremely similar loops.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>

* Update fnc_preventOverfilling.sqf

- Switching from `call compile` to switches as I was informed switches are much faster.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>

* Update AUTHORS.txt

- Added Redwan S. / Nomas and Sky / Esmeray6 to the list of authors as per guideline.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>

* Update fnc_preventOverfilling.sqf

- Improved readability and also because OCD.

* Update fnc_preventOverfilling.sqf

- Added Redwan S. / Nomas & Sky / Esmeray6 to the list of function authors.

Co-Authored-By: Sky <22858781+Esmeray6@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>

* Update fnc_preventOverfilling.sqf

- Fixed indentation as per ACE code guidelines.

* Update fnc_preventOverfilling.sqf

- Added support for backpack item type as well. Thanks to @OverlordZorn & @Andx667 for pointing it out.

* Update AUTHORS.txt

Alphabetically ordered

* Update fnc_preventOverfilling.sqf

- Moved `_cargoTypes` variable outside of loop, no need to redefine every iteration.

* Update addons/arsenal/functions/fnc_preventOverfilling.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/arsenal/functions/fnc_preventOverfilling.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

---------

Co-authored-by: Sky <22858781+Esmeray6@users.noreply.github.com>
Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
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.

7 participants