Add dogtag actions to body bags

This commit is contained in:
PabstMirror 2016-06-21 12:13:32 -05:00
parent 7f39748ff0
commit 3972504d4a
4 changed files with 43 additions and 4 deletions

View File

@ -9,14 +9,14 @@ class CfgVehicles {
statement = "";
showDisabled = 0;
priority = 3;
icon = ""; //@todo
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 = ""; //@todo
icon = QPATHTOF(data\dogtag_icon_ca.paa);
};
class ACE_TakeDogtag {
displayName = CSTRING(takeDogtag);
@ -24,7 +24,7 @@ class CfgVehicles {
statement = QUOTE([ARR_2(_player,_target)] call FUNC(takeDogtag));
showDisabled = 0;
priority = 3;
icon = ""; //@todo
icon = QPATHTOF(data\dogtag_icon_ca.paa);
};
};
};

View File

@ -4,3 +4,42 @@
[QGVAR(sendDogtagData), DFUNC(sendDogtagData)] call CBA_fnc_addEventHandler;
[QGVAR(getDogtagItem), DFUNC(getDogtagItem)] call CBA_fnc_addEventHandler;
[QGVAR(addDogtagItem), DFUNC(addDogtagItem)] call CBA_fnc_addEventHandler;
//Add actions and event handlers only if ace_medical is loaded
// - 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_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_bodyBagObject", 0, ["ACE_MainActions"], _takeTagAction] call EFUNC(interact_menu,addActionToClass);
};
if (isServer) then {
["ace_placedInBodyBag", {
params ["_target", "_bodyBag"];
TRACE_2("ace_placedInBodyBag eh",_target,_bodyBag);
private _dogTagData = [_target] call FUNC(getDogtagData);
_bodyBag setVariable [QGVAR(dogtagData), _dogTagData, true];
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
_bodyBag setVariable [QGVAR(dogtagTaken), _bodyBag, true];
};
}] call CBA_fnc_addEventHandler;
};
};

Binary file not shown.

View File

@ -27,7 +27,7 @@ if (isNil QGVAR(bodiesToDelete)) then {GVAR(bodiesToDelete) = [];};
GVAR(bodiesToDelete) pushBack _target;
// Start up a loop to wait for bodies to be free to delete
if ((count GVAR(bodiesToDelete)) > 0) then {
if ((count GVAR(bodiesToDelete)) == 1) then {
[] call FUNC(bodyCleanupLoop);
};