fortify_tool.sqf 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "../../config_macros.hpp"
  2. #include "\z\acex\addons\main\script_macros.hpp"
  3. #define AMMOITEM "MCC_bacon"
  4. macro_grp_fnc_name(fortify,handleObjectPlaced) = {
  5. params ["_player", "_side", "_objectPlaced"];
  6. if (RD501_Fortify_useAmmo) then
  7. {
  8. _player removeItem AMMOITEM;
  9. };
  10. };
  11. macro_grp_fnc_name(fortify,handleObjectDeleted) = {
  12. params ["_player", "_side", "_objectDeleted"];
  13. if (RD501_Fortify_useAmmo) then
  14. {
  15. _player addItem AMMOITEM;
  16. };
  17. };
  18. macro_grp_fnc_name(fortify,deployHandler) = {
  19. params ["_unit", "_object", "_cost"];
  20. if (RD501_Fortify_useAmmo) then
  21. {
  22. private _can_fortify = AMMOITEM in (_unit call ACEFUNC(common,uniqueItems));
  23. if (!_can_fortify) then
  24. {
  25. private _item_name = (configFile >> "CfgWeapons" >> AMMOITEM >> "displayName") call BIS_fnc_getCfgData;
  26. systemChat format ["You need at least 1 %1 to use the Fortify Tool!", _item_name];
  27. };
  28. _can_fortify;
  29. }else
  30. {
  31. true;
  32. };
  33. };
  34. [macro_grp_fnc_name(fortify,deployHandler)] call acex_fortify_fnc_addDeployHandler;
  35. ["acex_fortify_objectPlaced", macro_grp_fnc_name(fortify,handleObjectPlaced)] call CBA_fnc_addEventHandler;
  36. ["acex_fortify_objectDeleted", macro_grp_fnc_name(fortify,handleObjectDeleted)] call CBA_fnc_addEventHandler;
  37. private _item_name = (configFile >> "CfgWeapons" >> AMMOITEM >> "displayName") call BIS_fnc_getCfgData;
  38. [
  39. "RD501_Fortify_useAmmo",
  40. "CHECKBOX",
  41. ["Use item as Ammo", format["Additionally to Money, require 1 %1 to use the Fortify Tool",_item_name]],
  42. "ACEX Fortify",
  43. false
  44. ] call CBA_settings_fnc_init;