Skip to content

Commit d71ddd3

Browse files
committed
Rearranged rearm logic to include UAVs but still prioritise others
1 parent a61f7f5 commit d71ddd3

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

source/support/veh_refit.sqf

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,44 @@
1+
_vehicle = false;
12
_mounted_veh = vehicle player;
3+
_uav = false;
4+
_connected_uav = getConnectedUAV player;
5+
_distanceFromHQ = 0;
26

3-
if (commandpointsblu1<2) exitWith
7+
if (commandpointsblu1<2) exitWith
48
{
59
["info",["Not enough command points","Not enough Command Points (2CP required)"]] call bis_fnc_showNotification;
610
};
711

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;
1020
};
1121

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;
1540
};
1641

1742
commandpointsblu1 = commandpointsblu1 - 2;
1843
publicVariable "commandpointsblu1";
19-
_mounted_veh setDamage 0;
20-
_mounted_veh setFuel 1;
21-
_mounted_veh setVehicleAmmoDef 1;
2244
["veh_refit_hint",["Vehicle ready !","Your vehicle has been rearmed, refueled and repaired"]] call bis_fnc_showNotification;
23-

0 commit comments

Comments
 (0)