Arsenal - Fix the arsenal overfill prevention function#10946
Arsenal - Fix the arsenal overfill prevention function#10946Drofseh merged 12 commits intoacemod:masterfrom
Conversation
- 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
left a comment
There was a problem hiding this comment.
Tabs need to be changed to spaces
Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
- Fixed indentation as per ACE code guidelines.
|
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. |
- Added support for backpack item type as well. Thanks to @OverlordZorn & @Andx667 for pointing it out.
| private _currentContainer = _x; | ||
| { | ||
| _currentContainer addItemCargoGlobal [_x, -1]; | ||
| private _cargoTypes = ["Weapon", "Magazine", "Item", "Backpack"]; |
There was a problem hiding this comment.
Move outside of the loop, no need to reassign it every iteration.
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>
| private _currentContainer = _x; | ||
| { | ||
| _currentContainer addItemCargoGlobal [_x, -1]; | ||
| private _cargoTypes = ["Weapon", "Magazine", "Item", "Backpack"]; |
|
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 😅 |
* 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>


When merged this pull request will:
AUTHORS.txt.IMPORTANT
Component - Add|Fix|Improve|Change|Make|Remove {changes}.