more immersive dogtag interaction (#4446)

* more immersive dogtag interaction

* fix indent and macro usage

* move dogtag interaction point to neck
This commit is contained in:
commy2 2016-09-21 09:07:45 +02:00 committed by GitHub
parent 58bd6467b2
commit 03d83b633f
6 changed files with 89 additions and 37 deletions

View File

@ -2,30 +2,29 @@ class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_Actions {
class ACE_MainActions {
class ACE_Dogtag {
displayName = CSTRING(itemName);
condition = "";
statement = "";
class ACE_Dogtag {
displayName = CSTRING(itemName);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeDogtag));
statement = "";
showDisabled = 0;
distance = 1.75;
icon = QPATHTOF(data\dogtag_icon_ca.paa);
selection = "neck";
class ACE_CheckDogtag {
displayName = CSTRING(checkDogtag);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckDogtag));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkDogtag));
showDisabled = 0;
priority = 3;
icon = QPATHTOF(data\dogtag_icon_ca.paa);
};
class ACE_TakeDogtag {
displayName = CSTRING(takeDogtag);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeDogtag));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(takeDogtag));
showDisabled = 0;
priority = 3;
icon = QPATHTOF(data\dogtag_icon_ca.paa);
class ACE_CheckDogtag {
displayName = CSTRING(checkDogtag);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckDogtag));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkDogtag));
showDisabled = 0;
priority = 3;
icon = QPATHTOF(data\dogtag_icon_ca.paa);
};
class ACE_TakeDogtag {
displayName = CSTRING(takeDogtag);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeDogtag));
statement = QUOTE([ARR_2(_player,_target)] call FUNC(takeDogtag));
showDisabled = 0;
priority = 3;
icon = QPATHTOF(data\dogtag_icon_ca.paa);
};
};
};
};

View File

@ -10,25 +10,27 @@
// - Adding actions via config would create a dependency
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
if (hasInterface) then {
private _checkTagAction = [
"ACE_CheckDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(checkDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(checkDogtag)},
{!isNil {_target getVariable QGVAR(dogtagData)}}
] call ace_interact_menu_fnc_createAction;
"ACE_CheckDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(checkDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(checkDogtag)},
{!isNil {_target getVariable QGVAR(dogtagData)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _checkTagAction] call EFUNC(interact_menu,addActionToClass);
private _takeTagAction = [
"ACE_TakeDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(takeDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(takeDogtag)},
{(!isNil {_target getVariable QGVAR(dogtagData)}) && {((_target getVariable [QGVAR(dogtagTaken), objNull]) != _target)}}
] call ace_interact_menu_fnc_createAction;
"ACE_TakeDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(takeDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(takeDogtag)},
{(!isNil {_target getVariable QGVAR(dogtagData)}) && {((_target getVariable [QGVAR(dogtagTaken), objNull]) != _target)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _takeTagAction] call EFUNC(interact_menu,addActionToClass);
};
if (isServer) then {
["ace_placedInBodyBag", {
params ["_target", "_bodyBag"];

View File

@ -24,4 +24,8 @@ if (_item == "") exitWith {};
_dogtagData params ["_nickName"];
private _displayText = format [localize LSTRING(takeDogtagSuccess), _nickName];
[_displayText] call EFUNC(common,displayText);
// display message
[{
[_this, 2.5] call EFUNC(common,displayTextStructured);
}, _displayText, DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -18,7 +18,26 @@
params ["_player", "_target"];
// animation
_player call EFUNC(common,goKneeling);
// sound
private _position = AGLToASL (_target modelToWorld (_target selectionPosition "neck"));
playSound3D [
selectRandom RUSTLING_SOUNDS,
objNull,
false,
_position,
1,
1,
50
];
// display dogtag
private _doubleTags = (_target getVariable [QGVAR(dogtagTaken), objNull]) != _target;
private _dogTagData = [_target] call FUNC(getDogTagData);
[QGVAR(showDogtag), [_dogTagData, _doubleTags]] call CBA_fnc_localEvent;
[{
[QGVAR(showDogtag), _this] call CBA_fnc_localEvent;
}, [_dogTagData, _doubleTags], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -19,8 +19,27 @@
params ["_player", "_target"];
// animation
_player call EFUNC(common,goKneeling);
// sound
private _position = AGLToASL (_target modelToWorld (_target selectionPosition "neck"));
playSound3D [
selectRandom RUSTLING_SOUNDS,
objNull,
false,
_position,
1,
1,
50
];
// display message
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
[localize LSTRING(dogtagAlreadyTaken)] call EFUNC(common,displayText);
[{
[_this, 2.5] call EFUNC(common,displayTextStructured);
}, localize LSTRING(dogtagAlreadyTaken), DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
} else {
_target setVariable [QGVAR(dogtagTaken), _target, true];
[QGVAR(getDogtagItem), [_player, _target]] call CBA_fnc_serverEvent;

View File

@ -16,3 +16,12 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define DOGTAG_SHOW_DELAY 1
#define RUSTLING_SOUNDS [\
"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",\
"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWrflDnon_medic.wss",\
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWpstDnon_medic.wss",\
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWrflDnon_medic.wss"\
]