-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add CBA_fnc_canAddItem #1330
Add CBA_fnc_canAddItem #1330
Conversation
CBA_fnc_canAddItem? |
I thought about it or even just |
The purpose is the same as the canAdd command though, and it is obvious that they behave differently, since one is a command, the other a function from CBA. |
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This has the same issue as canAdd command. Yes you can add the 30 items, but canAdd returns false. My idea for the solution would be to not check if count of items fits, but instead for uniform/vest/backpack instead count how many of the items could fit into each of them. in my case instead of what you and canAdd command are doing uniform: 12 < 30, false I also want to make this change to the canAdd command someday. |
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.
What Ded said.
|
I think instead of all the seperate exitWiths and stuff, its easier to just count up the total that fit and do one check at the end. |
lgtm. |
I thought about it. But for 3 containers I decided it's not worth it. |
This comment has been minimized.
This comment has been minimized.
Even if you hate it, I am having fun. #define CAN_ADD_TO(CONTAINER) _check##CONTAINER && {\
DOUBLES(TYPE,CONTAINER) in _allowedSlots && {\
_mass == 0 || {\
_count = _count - floor (getContainerMaxLoad CONTAINER _unit * (1 - load##CONTAINER _unit) / _mass);\
_count <= 0\
}\
}\
}
CAN_ADD_TO(UNIFORM) || {CAN_ADD_TO(VEST) || {CAN_ADD_TO(BACKPACK)}} |
This has already been merged, but this problem seems to be tied to this: https://feedback.bistudio.com/T154476
|
Sure, but this does not change anything in this PR, does it? |
Not really, just adding additional details. Depending on whether the ticket is fixed later, this function may become redundant or invalid, though I wouldn't hold my breath at this stage of the game. |
When merged this pull request will:
canAdd*
commands can returnfalse
even if there is free space in unit inventory (see this ticket and other aboutcanAdd
). These commands take current unit load into account. Sometimes we don't need to check unit load e.g. when taking out ACE Earplugs or weapon accessories.As usually function and variables names are subject to discuss.