-
Notifications
You must be signed in to change notification settings - Fork 736
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
Added interaction to quickly pass a magazine #2390
Conversation
_filterFunc = compile format ["((_this select 0) in %1) && (!(_this select 2))", _compatibleMags]; | ||
_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter); | ||
|
||
if (count _filteredMags > 0) then { |
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.
if (_filteredMags isEqualTo [])
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.
- Has to be inverted
- Why? Count is fine imho
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.
count is slower as isEqualTo and yes posible
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.
I tested both with empty and non-empty arrays, with the added ! the performance difference is always around 0.0003ms. I think that's fine...
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.
I love how you guys discuss count == 0
vs isEqualTo []
and completely ignore the compile
.
_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter); | ||
|
||
//select magazine with most ammo | ||
_magToPass = _filteredMags select 0; |
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.
You can use params
for this
I'm in two minds about this addition. Passing a magazine to someone in close proximity can be done already with the inventory and being honest I can use the inventory much quicker than I can use the interaction menu on a person 😛 |
agree on the other hand IRL you could "throw" magazines much further |
If neither you nor the other person have a backpack and you're in tall grass, dropping and picking up magazines becomes a pita. Without backpacks I'm pretty sure this would be way faster. |
And I can't use Arma 3's inventory system at all on remote units in MP. Half of the time nothing happens and I have to close and re-open the menu. Sometimes I have to use drag and drop, other times it only works with right-clicking. Occasionally the item disappears (especially magazines) or duplicates pop up. With |
Both points seem reasonable 👍 |
Make it optional then. |
Isn't it inherently optional? :P |
No need to make this optional. If you think the other way is faster, don't use the interaction menu. |
It still clogs up the interaction menu though, not really a problem, I just like it clean. 😁 |
({_target canAdd (_x select 0)} count _filteredMags) > 0 | ||
} else { | ||
false | ||
}; |
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.
could be simplified to:
!(_filteredMags isEqualTo []) && {{_target canAdd (_x select 0)} count _filteredMags > 0}
true | ||
} else { | ||
false | ||
}; |
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.
if (BOOL) then {true} else {false}
: - )
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.
BOOL :D !(_filteredMags isEqualTo []) && {{_target canAdd (_x select 0)} count _filteredMags > 0}
without if
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.
duh
How about this? |
Merge conflicts have been resolved, also fixed an error in a header. This is no more WIP unless you see something wrong with it. |
@@ -35,6 +35,32 @@ class CfgVehicles { | |||
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; | |||
selection = "pelvis"; | |||
|
|||
class ACE_PassMagazine { | |||
displayName = CSTRING(PassMagazine); | |||
condition = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(canPassMagazine) || [ARR_3(_player,_target,handgunWeapon _target)] call FUNC(canPassMagazine)); |
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.
Parent condition can be empty string or just true
.
If there are no children, it won't show because statement is {}
Will save checking the conditions twice.
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.
Fixed
I guess I wouldn't mind this simplified down to |
Thanks for the change @BaerMitUmlaut 👍 |
Added interaction to quickly pass a magazine
This adds an interaction that lets you quickly pass a magazine to another player (or AI unit). It automatically chooses the magazine that still has the most ammo, fits into the other units weapon and also still fits into his inventory.
I have not added the possibility to pass on ammunition for launchers, since this is more for when somebody runs out of ammo in combat, and I don't think you can't really quickly pass on a rocket. It would be easy to add though if so desired.