ACE3/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf
Glowbal b489750d5b Minor optimizations using private, params, and isEqualType (#4323)
* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
2016-09-04 16:44:22 +02:00

37 lines
1.1 KiB
Plaintext

/*
* Author: marc_book
* Starts refueling/recharging the 'Dartar' UAVs
*
* Arguments:
* 0: Player <OBJECT>
* 1: UAV <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player, theUAV] call ace_logistics_uavbattery_fnc_refuelUAV
*
* Public: No
*/
#include "script_component.hpp"
params ["_caller", "_target"];
if (!(_this call FUNC(canRefuelUAV))) exitWith {};
private _onFinish = {
(_this select 0) params ["_caller", "_target"];
_caller removeItem "ACE_UAVBattery";
playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10];
[QEGVAR(common,setFuel), [_target, 1], [_target]] call CBA_fnc_targetEvent; //setFuel is local
};
private _onFailure = {
(_this select 0) params ["_caller", "_target"];
[_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
};
[_caller, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
[10, [_caller, _target], _onFinish, _onFailure, (localize LSTRING(Battery_Recharge)), {(_this select 0) call FUNC(canRefuelUAV)}] call EFUNC(common,progressBar);