Преглед изворни кода

add option to switch ammo usage on and off;

thefloff пре 4 година
родитељ
комит
6ff9b80795
1 измењених фајлова са 29 додато и 9 уклоњено
  1. 29 9
      addons - Copy/RD501_Main/functions/fortify_tool/fortify_tool.sqf

+ 29 - 9
addons - Copy/RD501_Main/functions/fortify_tool/fortify_tool.sqf

@@ -5,26 +5,46 @@
 
 macro_grp_fnc_name(fortify,handleObjectPlaced) = {
 	params ["_player", "_side", "_objectPlaced"];
-	_player removeItem AMMOITEM;
+	if (RD501_Fortify_useAmmo) then
+	{
+		_player removeItem AMMOITEM;
+	};
 };
 
 macro_grp_fnc_name(fortify,handleObjectDeleted) = {
 	params ["_player", "_side", "_objectDeleted"];
-	_player addItem AMMOITEM;
+	if (RD501_Fortify_useAmmo) then
+	{
+		_player addItem AMMOITEM;
+	};
 };
 
 macro_grp_fnc_name(fortify,deployHandler) = {
     params ["_unit", "_object", "_cost"];
-
-	private _can_fortify = AMMOITEM in (_unit call ACEFUNC(common,uniqueItems));
-	if (!_can_fortify) then
+	if (RD501_Fortify_useAmmo) then
+	{
+		private _can_fortify = AMMOITEM in (_unit call ACEFUNC(common,uniqueItems));
+		if (!_can_fortify) then
+		{
+			private _item_name = (configFile >> "CfgWeapons" >> AMMOITEM >> "displayName") call BIS_fnc_getCfgData;
+			systemChat format ["You need at least 1 %1 to use the Fortify Tool!", _item_name];
+		};
+		_can_fortify;
+	}else
 	{
-		private _item_name = (configFile >> "CfgWeapons" >> AMMOITEM >> "displayName") call BIS_fnc_getCfgData;
-		systemChat format ["You need at least 1 %1 to use the Fortify Tool!", _item_name];
+		true;
 	};
-	_can_fortify;
 };
 
 [macro_grp_fnc_name(fortify,deployHandler)] call acex_fortify_fnc_addDeployHandler;
 ["acex_fortify_objectPlaced", macro_grp_fnc_name(fortify,handleObjectPlaced)] call CBA_fnc_addEventHandler;
-["acex_fortify_objectDeleted", macro_grp_fnc_name(fortify,handleObjectDeleted)] call CBA_fnc_addEventHandler;
+["acex_fortify_objectDeleted", macro_grp_fnc_name(fortify,handleObjectDeleted)] call CBA_fnc_addEventHandler;
+
+private _item_name = (configFile >> "CfgWeapons" >> AMMOITEM >> "displayName") call BIS_fnc_getCfgData;
+[
+    "RD501_Fortify_useAmmo",
+    "CHECKBOX",
+    ["Use item as Ammo", format["Additionally to Money, require 1 %1 to use the Fortify Tool",_item_name]],
+    "ACEX Fortify",
+    false
+] call CBA_settings_fnc_init;