summaryrefslogtreecommitdiffstats
path: root/Common/Functions/Common_RearmVehicle.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
commita3a91d4f45b22fd487ecbc954ad979be5d03efdd (patch)
treea554ab159a347dcd6c00ca1c7c26c1ec3ac0a6bd /Common/Functions/Common_RearmVehicle.sqf
downloada2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.tar.gz
a2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.tar.bz2
a2wf_chernarus-a3a91d4f45b22fd487ecbc954ad979be5d03efdd.zip
Diffstat (limited to 'Common/Functions/Common_RearmVehicle.sqf')
-rw-r--r--Common/Functions/Common_RearmVehicle.sqf39
1 files changed, 39 insertions, 0 deletions
diff --git a/Common/Functions/Common_RearmVehicle.sqf b/Common/Functions/Common_RearmVehicle.sqf
new file mode 100644
index 0000000..58ed35c
--- /dev/null
+++ b/Common/Functions/Common_RearmVehicle.sqf
@@ -0,0 +1,39 @@
+Private["_amount","_get","_isAir","_isArtillery","_magazines","_side","_type","_vehicle"];
+
+_vehicle = _this select 0;
+_side = _this select 1;
+_type = typeOf _vehicle;
+_isAir = if (_vehicle isKindOf "Air") then {true} else {false};
+
+//rearming turrets.
+{_vehicle removeMagazine _x} forEach magazines _vehicle;
+
+_magazines = getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "Magazines");
+_magazines = _magazines + getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Magazines");
+
+{_vehicle addMagazine _x} forEach _magazines;
+
+/* CM Parameter */
+if (paramCounterMeasures && _isAir) then {
+ _amount = if (_vehicle isKindOf "Plane") then {'WFBE_COUNTERMEASUREPLANES' Call GetNamespace} else {'WFBE_COUNTERMEASURECHOPPERS' Call GetNamespace};
+ _vehicle setVariable ["FlareCount", _amount];
+};
+
+_vehicle setVehicleAmmo 1;
+reload _vehicle;
+
+/* Are we dealing with an artillery unit ? */
+_isArtillery = -1;
+if (_side == west || _side == east) then {_isArtillery = [_type,_side] Call IsArtillery};
+if (_isArtillery != -1) then {[_vehicle,_isArtillery,_side] Call EquipArtillery};
+
+/* Balanced Unit */
+if (_type in ('WFBE_BALANCEDUNITS' Call GetNamespace) && paramBalancing) then {[_vehicle] Call BalanceInit};
+
+/* EASA Module */
+if (paramEASA) then {
+ if (_type in ('WFBE_EASA_Vehicles' Call GetNamespace)) then {
+ _get = _vehicle getVariable 'WFBE_EASA_Setup';
+ if !(isNil '_get') then {[_vehicle,0] Call EASA_Equip};
+ };
+};