mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added ability to pass a magazine
This commit is contained in:
parent
da423672cf
commit
c26107bc5c
@ -32,6 +32,32 @@ class CfgVehicles {
|
|||||||
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
|
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
|
||||||
selection = "pelvis";
|
selection = "pelvis";
|
||||||
|
|
||||||
|
class ACE_PassMagazine {
|
||||||
|
displayName = CSTRING(PassMagazine);
|
||||||
|
condition = QUOTE([ARR_2(_player,primaryWeapon _target)] call FUNC(canPassMagazine) || [ARR_2(_player,handgunWeapon _target)] call FUNC(canPassMagazine));
|
||||||
|
statement = "";
|
||||||
|
showDisabled = 0;
|
||||||
|
priority = 3.3;
|
||||||
|
icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\cargomag_ca.paa";
|
||||||
|
|
||||||
|
class ACE_PassMagazinePrimary {
|
||||||
|
displayName = CSTRING(PassMagazinePrimary);
|
||||||
|
condition = QUOTE([ARR_2(_player,primaryWeapon _target)] call FUNC(canPassMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(passMagazine));
|
||||||
|
showDisabled = 0;
|
||||||
|
priority = 3;
|
||||||
|
icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\primaryweapon_ca.paa";
|
||||||
|
};
|
||||||
|
class ACE_PassMagazineHandgun {
|
||||||
|
displayName = CSTRING(PassMagazineHandgun);
|
||||||
|
condition = QUOTE([ARR_2(_player,handgunWeapon _target)] call FUNC(canPassMagazine));
|
||||||
|
statement = QUOTE([ARR_3(_player,_target,handgunWeapon _target)] call FUNC(passMagazine));
|
||||||
|
showDisabled = 0;
|
||||||
|
priority = 1;
|
||||||
|
icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\handgun_ca.paa";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
class ACE_TeamManagement {
|
class ACE_TeamManagement {
|
||||||
displayName = CSTRING(TeamManagement);
|
displayName = CSTRING(TeamManagement);
|
||||||
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {GVAR(EnableTeamManagement)});
|
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {GVAR(EnableTeamManagement)});
|
||||||
|
@ -10,6 +10,7 @@ PREP(canBecomeLeader);
|
|||||||
PREP(canInteractWithCivilian);
|
PREP(canInteractWithCivilian);
|
||||||
PREP(canJoinGroup);
|
PREP(canJoinGroup);
|
||||||
PREP(canJoinTeam);
|
PREP(canJoinTeam);
|
||||||
|
PREP(canPassMagazine);
|
||||||
PREP(canTapShoulder);
|
PREP(canTapShoulder);
|
||||||
PREP(doBecomeLeader);
|
PREP(doBecomeLeader);
|
||||||
PREP(getDoor);
|
PREP(getDoor);
|
||||||
@ -27,6 +28,7 @@ PREP(onSelectMenuDblClick);
|
|||||||
PREP(openDoor);
|
PREP(openDoor);
|
||||||
PREP(openMenuSelectUI);
|
PREP(openMenuSelectUI);
|
||||||
PREP(openSelectMenu);
|
PREP(openSelectMenu);
|
||||||
|
PREP(passMagazine);
|
||||||
PREP(prepareSelectMenu);
|
PREP(prepareSelectMenu);
|
||||||
PREP(push);
|
PREP(push);
|
||||||
PREP(removeTag);
|
PREP(removeTag);
|
||||||
|
25
addons/interaction/functions/fnc_canPassMagazine.sqf
Normal file
25
addons/interaction/functions/fnc_canPassMagazine.sqf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Checks if unit has a spare magazine for the specified weapon.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit that gets searched <OBJECT>
|
||||||
|
* 1: Weapon classname <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_player, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
params ["_player", "_weapon"];
|
||||||
|
private ["_compatibleMags", "_filterFunc"];
|
||||||
|
|
||||||
|
_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
|
||||||
|
_filterFunc = compile format ["((_this select 0) in %1) && (!(_this select 2))", _compatibleMags];
|
||||||
|
|
||||||
|
count ([magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter)) > 0
|
50
addons/interaction/functions/fnc_passMagazine.sqf
Normal file
50
addons/interaction/functions/fnc_passMagazine.sqf
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Pass spare magazine for the specified weapon.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit that passes the magazine <OBJECT>
|
||||||
|
* 1: Unit to pass the magazine to <OBJECT>
|
||||||
|
* 2: Weapon classname <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_magToPassazine
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
params ["_player", "_target", "_weapon"];
|
||||||
|
private ["_compatibleMags", "_filterFunc", "_filteredMags", "_magToPass", "_magToPassIndex"];
|
||||||
|
|
||||||
|
_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
|
||||||
|
_filterFunc = compile format ["((_this select 0) in %1) && !(_this select 2)", _compatibleMags];
|
||||||
|
|
||||||
|
_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter);
|
||||||
|
|
||||||
|
//select magazine with most ammo
|
||||||
|
_magToPass = _filteredMags select 0;
|
||||||
|
_magToPassIndex = 0;
|
||||||
|
{
|
||||||
|
if ((_x select 1) > (_magToPass select 1)) then {
|
||||||
|
_magToPass = _x;
|
||||||
|
_magToPassIndex = _forEachIndex;
|
||||||
|
};
|
||||||
|
} foreach _filteredMags;
|
||||||
|
|
||||||
|
//remove all magazines and add them again, except the one to be passed
|
||||||
|
//needed because of missing commands, see http://feedback.arma3.com/view.php?id=12782
|
||||||
|
_player removeMagazines (_magToPass select 0);
|
||||||
|
{
|
||||||
|
if ((_x select 0) == (_magToPass select 0) && (_forEachIndex != _magToPassIndex)) then {
|
||||||
|
_player addMagazine [_x select 0, _x select 1];
|
||||||
|
};
|
||||||
|
} foreach _filteredMags;
|
||||||
|
|
||||||
|
_player playActionNow "PutDown";
|
||||||
|
|
||||||
|
_target addMagazine [_magToPass select 0, _magToPass select 1];
|
||||||
|
[[parseText format [CSTRING(PassMagazineHint), name _player, _magToPass select 0]], QUOTE(FUNC(common,displayTextStructured)), _target] call EFUNC(common,execRemoteFnc);
|
@ -816,5 +816,21 @@
|
|||||||
<Hungarian>A csapatkezelés engedélyezi a tagok színének meghatározását, a vezetés átvételét, és csapatoknál be-és kilépést.</Hungarian>
|
<Hungarian>A csapatkezelés engedélyezi a tagok színének meghatározását, a vezetés átvételét, és csapatoknál be-és kilépést.</Hungarian>
|
||||||
<Portuguese>O módulo de gestão de equipe é composto por: a atribuição de cores para os membros da equipe, comando das equipes, juntando-se / deixando equipes.</Portuguese>
|
<Portuguese>O módulo de gestão de equipe é composto por: a atribuição de cores para os membros da equipe, comando das equipes, juntando-se / deixando equipes.</Portuguese>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interaction_PassMagazine">
|
||||||
|
<English>Pass magazine</English>
|
||||||
|
<German>Magazin geben</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interaction_PassMagazinePrimary">
|
||||||
|
<English>Primary magazine</English>
|
||||||
|
<German>Gewehrmagazin</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interaction_PassMagazineHandgun">
|
||||||
|
<English>Pistol magazine</English>
|
||||||
|
<German>Pistolenmagazin</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Interaction_PassMagazineHint">
|
||||||
|
<English>%1 passed you a %2 magazine.</English>
|
||||||
|
<German>%1 hat dir ein %2 Magazin gegeben.</German>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user