Browse Source

first working prototype

thefloff 4 years ago
parent
commit
b86d6b3b0c

+ 4 - 1
addons - Copy/RD501_Main/XEH_postinit.sqf

@@ -22,4 +22,7 @@ RD501_FORCE_WALK_WEAPONS = [macro_quote(macro_new_weapon_nofam(z1000))];
 
 //Auto Reload On Equip
 RD501_AUTO_RELOAD_ON_EQUIP = [QWEAP_NOFAM(z1000),QWEAP_LAUNCH(RPS_Disposable)];
-["weapon", macro_fnc_name(reloadWeaponOnFirstSelected)] call CBA_fnc_addPlayerEventHandler;
+["weapon", macro_fnc_name(reloadWeaponOnFirstSelected)] call CBA_fnc_addPlayerEventHandler;
+
+// Magclamp
+call macro_fnc_name(magclamp);

+ 3 - 0
addons - Copy/RD501_Main/XEH_preInit.sqf

@@ -65,6 +65,9 @@ macro_prep_xeh(init\aat.sqf,aatInit)
 //nightvision
 macro_prep_xeh(nightvision.sqf,nightvision)
 
+//magclamp
+macro_prep_xeh(magclamp\magclamp.sqf,magclamp)
+
 //HUD color
 macro_prep_xeh(hud_color_change.sqf,change_hud_color)
 

+ 41 - 0
addons - Copy/RD501_Main/functions/magclamp/magclamp.sqf

@@ -0,0 +1,41 @@
+#include "\a3\editor_f\Data\Scripts\dikCodes.h"
+#include "../../config_macros.hpp"
+
+
+//handle button press
+macro_grp_fnc_name(magclamp,handle_left_pressed) = {
+    if(isNull vehicle player) exitWith {};
+    systemChat "left clamp";
+};
+
+macro_grp_fnc_name(magclamp,handle_center_pressed) = {
+    if(isNull vehicle player) exitWith {};
+    systemChat "center clamp";
+};
+
+macro_grp_fnc_name(magclamp,handle_right_pressed) = {
+    _vehicle = vehicle player;
+    if(isNull _vehicle) exitWith {};
+    _attached = _vehicle getVariable["RD501_mc_attached_right",objNull];
+    if(isNull _attached) then {
+    	_objects = nearestObjects [player, ["Car","Tank","Air","Ship","Object"], 20];
+	    _target = _objects select 1;
+	    _target attachTo [_vehicle, [7,-2,-2.5]];
+	    _vehicle setVariable["RD501_mc_attached_right",_target,true];
+	} else {
+	    detach _attached;
+	    _vehicle setVariable["RD501_mc_attached_right",objNull,true];
+	}
+};
+
+
+//add keybinds
+["RD501 Magclamp","Left Clamp",["Left","Activate/Deactivate left magclamp"],{
+    [player] call macro_grp_fnc_name(magclamp,handle_left_pressed);
+},"",[DIK_7,[false,false,false]],false] call cba_fnc_addKeybind;
+["RD501 Magclamp","Center Clamp",["Center","Activate/Deactivate center magclamp"],{
+    [player] call macro_grp_fnc_name(magclamp,handle_center_pressed);
+},"",[DIK_8,[false,false,false]],false] call cba_fnc_addKeybind;
+["RD501 Magclamp","Right Clamp",["Right","Activate/Deactivate right magclamp"],{
+    [player] call macro_grp_fnc_name(magclamp,handle_right_pressed);
+},"",[DIK_9,[false,false,false]],false] call cba_fnc_addKeybind;