Browse Source

Add missing ;, Fix ACE_MainActions inherit, add progress bar thing, battery gvar

m3ales 4 years ago
parent
commit
21d4449dcf

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

@@ -5,4 +5,5 @@
 	[] spawn compile preprocessFileLineNumbers 'macro_mod_script_path\jumppack\jumppack.sqf';
 	sleep 0.5;
 	call compile preprocessFileLineNumbers 'macro_mod_script_path\jumppack\jumppack_effects.sqf';
-};
+};
+RD501_DRONE_BATTERY = "lightsaberG_swing";

+ 2 - 1
addons - Copy/RD501_Main/XEH_preInit.sqf

@@ -86,4 +86,5 @@ macro_prep_xeh(medical_notification\add_med_notification.sqf,add_med_notificatio
 
 //R-2 Recon Drone
 macro_prep_xeh(infantry_uav\fnc_getRefuelMagazine.sqf,getRefuelMagazine)
-macro_prep_xeh(infantry_uav\fnc_refuelUAVDrone.sqf,refuelUAVDrone)
+macro_prep_xeh(infantry_uav\fnc_refuelUAVDrone.sqf,refuelUAVDrone)
+macro_prep_xeh(infantry_uav\fnc_canRefuel.sqf,canRefuel)

+ 2 - 0
addons - Copy/RD501_Main/functions/infantry_uav/fnc_canRefuel.sqf

@@ -0,0 +1,2 @@
+params ["_player", "_target", "_params"];
+(RD501_DRONE_BATTERY in (magazines _player)) && {(fuel _target) < 1} && {(speed _target) < 1} && {!(isEngineOn _target)} && {(_target distance _player) <= 4}

+ 7 - 9
addons - Copy/RD501_Main/functions/infantry_uav/fnc_getRefuelMagazine.sqf

@@ -1,11 +1,9 @@
-params["_unit", "_validRefuelOptions"];
+params[["_unit", player, [player]]];
 _hasItem = false;
-_items = (backpackMagazines _unit) + (uniformMagazines _unit) + (vestMagazines _unit);
+_items = magazines _unit;
+if (RD501_DRONE_BATTERY in _items) then
 {
-	if (_x in _validRefuelOptions) exitWith
-	{
-		_unit removeMagazine _x;
-		_hasItem = true;
-	};
-} forEach _items;
-_hasItem
+	_unit removeItem RD501_DRONE_BATTERY;
+	_hasItem = true;
+};
+_hasItem

+ 17 - 13
addons - Copy/RD501_Main/functions/infantry_uav/fnc_refuelUAVDrone.sqf

@@ -1,14 +1,18 @@
 params["_player", "_target", "_params"];
-if(vehicle _target == _target) then
-{
-	_canRefuel = [_player, ["lightsaberG_swing"]] call rd501_fnc_getRefuelMagazine;
-	if(_canRefuel) then {
-		_target setFuel 100;
-		[format["Refuelled %1", _target], true, 2, 0] call ACE_common_fnc_displayText;
-	}else
-	{
-		[format["No fuel", _target], true, 2, 0] call ACE_common_fnc_displayText;
-	};
-}else{
-	["Cannot refuel this", true, 2, 0] call ACE_common_fnc_displayText;
-};
+if (!(_this call rd501_fnc_canRefuel)) exitWith {};
+
+private _onFinish = {
+    (_this select 0) params ["_player", "_target"];
+    _player removeItem "ACE_UAVBattery";
+	["ace_common_setFuel", [_target, 1], [_target]] call CBA_fnc_targetEvent;
+	[format["Refuelled %1", _target], true, 2, 0] call ace_common_fnc_displayText;
+};
+
+private _onFailure = {
+    (_this select 0) params ["_player", "_target"];
+    [_player, "AmovPknlMstpSrasWrflDnon", 1] call ace_common_fnc_doAnimation;
+};
+
+[_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call ace_common_fnc_doAnimation;
+
+[10, [_player, _target], _onFinish, _onFailure, ("Refueling"), {(_this select 0) call rd501_fnc_canRefuel}] call ace_common_fnc_progressBar;

+ 5 - 5
addons - Copy/RD501_Vehicles/air/drones/config.cpp

@@ -154,6 +154,7 @@ class CfgVehicles
 			assembleTo = macro_new_vehicle(drone,Clone_Recon_Droid)
 		};
 	};
+	#define ARR_2(a,b) a,b
 	class macro_new_vehicle(drone,Clone_Recon_Droid): swclonerecondroid
 	{
 		author = "RD501";
@@ -164,7 +165,7 @@ class CfgVehicles
         altNoForce = 1000;
         fuelCapacity = 90;
         fuelConsumptionRate = 1;
-		faction = macro_republic_faction
+		faction = macro_republic_faction;
 /*		model = "\SW_CloneWarsWeapons\Recon\swclonerecon.p3d";
 		hiddenSelections[]=
         {
@@ -179,12 +180,11 @@ class CfgVehicles
 				condition = macro_quote(true);
                 class RD501_Drone_Refuel
 				{
-					distance = 4;
 					displayName = "Refuel Drone";
-					condition = macro_quote(true);
-					statement = macro_quote(_this call macro_fnc_name(refuelUAVDrone));
+					distance = 4;
+					condition = macro_quote([ARR_2(_player,_target)] call macro_fnc_name(canRefuel));
+					statement = macro_quote([ARR_2(_player,_target)] call macro_fnc_name(refuelUAVDrone));
 					position = macro_quote(call ace_interaction_fnc_getVehiclePos);
-
 				};
             };
         };

+ 16 - 5
addons - Copy/RD501_Vehicles/air/drones/inheritance.hpp

@@ -1,15 +1,23 @@
-class ACE_Actions;
-class ACE_MainActions;
 class Air;
 class Helicopter: Air {
-    
+    class ACE_Actions
+	{
+		class ACE_MainActions { }
+	}
 };
 class Helicopter_Base_F:Helicopter {
-    
+	class ACE_Actions : ACE_Actions
+	{
+		class ACE_MainActions : ACE_MainActions { }
+	}
 };
 class UAV_01_base_F:Helicopter_Base_F 
 {
 	
+	class ACE_Actions : ACE_Actions
+	{
+		class ACE_MainActions : ACE_MainActions { }
+	}
 };
 class JLTS_UAV_prowler_gar_backpack;
 class Bag_Base;
@@ -46,7 +54,10 @@ class SWOP_Rebel_Dio_Droid:B_UAV_01_F
 };
 class swclonerecondroid: UAV_01_base_F
 {
-	
+	class ACE_Actions : ACE_Actions
+	{
+		class ACE_MainActions : ACE_MainActions { }
+	}
 };
 
 class UAV;