From 130265fd9fef594cbbe891fe580daf41458e83da Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 10 Oct 2016 19:35:34 +0200 Subject: [PATCH] add function to disable dogtags for factions, and disable for civilians --- addons/dogtags/XEH_PREP.hpp | 2 ++ addons/dogtags/XEH_postInit.sqf | 3 +++ .../dogtags/functions/fnc_canCheckDogtag.sqf | 3 +++ .../dogtags/functions/fnc_canTakeDogtag.sqf | 3 +++ .../functions/fnc_disableFactionDogtags.sqf | 24 +++++++++++++++++++ 5 files changed, 35 insertions(+) create mode 100644 addons/dogtags/functions/fnc_disableFactionDogtags.sqf diff --git a/addons/dogtags/XEH_PREP.hpp b/addons/dogtags/XEH_PREP.hpp index 33e42ba191..5917600139 100644 --- a/addons/dogtags/XEH_PREP.hpp +++ b/addons/dogtags/XEH_PREP.hpp @@ -1,3 +1,4 @@ + PREP(addDogtagActions); PREP(addDogtagItem); PREP(bloodType); @@ -11,3 +12,4 @@ PREP(sendDogtagData); PREP(showDogtag); PREP(ssn); PREP(takeDogtag); +PREP(disableFactionDogtags); diff --git a/addons/dogtags/XEH_postInit.sqf b/addons/dogtags/XEH_postInit.sqf index b0352c39ef..6a50ce61cf 100644 --- a/addons/dogtags/XEH_postInit.sqf +++ b/addons/dogtags/XEH_postInit.sqf @@ -45,3 +45,6 @@ if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then { }] call CBA_fnc_addEventHandler; }; }; + +// disable dogtags for civilians +"CIV_F" call FUNC(disableFactionDogtags); diff --git a/addons/dogtags/functions/fnc_canCheckDogtag.sqf b/addons/dogtags/functions/fnc_canCheckDogtag.sqf index 66a25c94b0..b31911a0c6 100644 --- a/addons/dogtags/functions/fnc_canCheckDogtag.sqf +++ b/addons/dogtags/functions/fnc_canCheckDogtag.sqf @@ -20,4 +20,7 @@ params ["_player", "_target"]; if (isNull _target) exitWith {false}; +// check if disabled for faction +if ([GVAR(disabledFactions) getVariable faction _target] param [0, false]) exitWith {false}; + (!alive _target) || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/dogtags/functions/fnc_canTakeDogtag.sqf b/addons/dogtags/functions/fnc_canTakeDogtag.sqf index 33a3ef055f..37163f68c7 100644 --- a/addons/dogtags/functions/fnc_canTakeDogtag.sqf +++ b/addons/dogtags/functions/fnc_canTakeDogtag.sqf @@ -20,4 +20,7 @@ params ["_player", "_target"]; if (isNull _target) exitWith {false}; +// check if disabled for faction +if ([GVAR(disabledFactions) getVariable faction _target] param [0, false]) exitWith {false}; + (!alive _target) || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/dogtags/functions/fnc_disableFactionDogtags.sqf b/addons/dogtags/functions/fnc_disableFactionDogtags.sqf new file mode 100644 index 0000000000..3100ffb269 --- /dev/null +++ b/addons/dogtags/functions/fnc_disableFactionDogtags.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Disable this faction from using dogtags. + * + * Arguments: + * 0: Faction + * + * Return Value: + * None + * + * Example: + * "CIV_F" call ace_dogtags_fnc_disableFactionDogtags + * + * Public: Yes + */ +#include "script_component.hpp" + +params [["_faction", "", [""]]]; + +if (isNil QGVAR(disabledFactions)) then { + GVAR(disabledFactions) = [] call CBA_fnc_createNamespace; +}; + +GVAR(disabledFactions) setVariable [_faction, true];