|
| 1 | +_vehicle = false; |
1 | 2 | _mounted_veh = vehicle player; |
| 3 | +_uav = false; |
| 4 | +_connected_uav = getConnectedUAV player; |
| 5 | +_distanceFromHQ = 0; |
2 | 6 |
|
3 | | -if (commandpointsblu1<2) exitWith |
| 7 | +if (commandpointsblu1<2) exitWith |
4 | 8 | { |
5 | 9 | ["info",["Not enough command points","Not enough Command Points (2CP required)"]] call bis_fnc_showNotification; |
6 | 10 | }; |
7 | 11 |
|
8 | | -if (_mounted_veh==player) exitWith { |
9 | | -Hint "You must be inside a vehicle to refit it." |
| 12 | +if(_mounted_veh == player) then { // No vehicle to refit |
| 13 | + if(!isNull _connected_uav) then { // UAV to refit |
| 14 | + _uav = true; |
| 15 | + _distanceFromHQ = hq_blu1 distance _connected_uav; |
| 16 | + }; |
| 17 | +} else { // Vehicle takes priority over UAV; |
| 18 | + _vehicle = true; |
| 19 | + _distanceFromHQ = hq_blu1 distance _mounted_veh; |
10 | 20 | }; |
11 | 21 |
|
12 | | -// check if near the officer |
13 | | -if ((hq_blu1 distance player)>100) exitWith { |
14 | | -["veh_refit_hint",["Too far away","Your vehicle must be near the base"]] call bis_fnc_showNotification; |
| 22 | +if(!_vehicle && !_uav) exitWith { |
| 23 | + hint "You must be connected to or inside a vehicle to refit it"; |
| 24 | +}; |
| 25 | + |
| 26 | +if (_distanceFromHQ > 100) exitWith { |
| 27 | + ["veh_refit_hint",["Too far away","Your vehicle must be near the base"]] call bis_fnc_showNotification; |
| 28 | +}; |
| 29 | + |
| 30 | +if(_vehicle) then { |
| 31 | + _mounted_veh setDamage 0; |
| 32 | + _mounted_veh setFuel 1; |
| 33 | + _mounted_veh setVehicleAmmoDef 1; |
| 34 | +}; |
| 35 | + |
| 36 | +if(_uav) then { // If refitting UAV, check UAV distance from HQ. |
| 37 | + _connected_uav setDamage 0; |
| 38 | + _connected_uav setFuel 1; |
| 39 | + _connected_uav setVehicleAmmoDef 1; |
15 | 40 | }; |
16 | 41 |
|
17 | 42 | commandpointsblu1 = commandpointsblu1 - 2; |
18 | 43 | publicVariable "commandpointsblu1"; |
19 | | -_mounted_veh setDamage 0; |
20 | | -_mounted_veh setFuel 1; |
21 | | -_mounted_veh setVehicleAmmoDef 1; |
22 | 44 | ["veh_refit_hint",["Vehicle ready !","Your vehicle has been rearmed, refueled and repaired"]] call bis_fnc_showNotification; |
23 | | - |
|
0 commit comments