Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fn_clearVehicleAmmo.sqf #734

Open
wants to merge 2 commits into
base: v5.X.X
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions Altis_Life.Altis/core/functions/fn_clearVehicleAmmo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,30 @@
private ["_vehicle","_veh"];
_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _vehicle) exitWith {};
_veh = typeOf _vehicle;

if (_veh isEqualTo "B_Boat_Armed_01_minigun_F") then {
_vehicle removeMagazinesTurret ["200Rnd_40mm_G_belt",[0]];
};

if (_veh isEqualTo "B_APC_Wheeled_01_cannon_F") then {
_vehicle removeMagazinesTurret ["60Rnd_40mm_GPR_Tracer_Red_shells",[0]];
_vehicle removeMagazinesTurret ["40Rnd_40mm_APFSDS_Tracer_Red_shells",[0]];
};

if (_veh isEqualTo "O_Heli_Attack_02_black_F") then {
_vehicle removeMagazinesTurret ["250Rnd_30mm_APDS_shells",[0]];
_vehicle removeMagazinesTurret ["8Rnd_LG_scalpel",[0]];
_vehicle removeMagazinesTurret ["38Rnd_80mm_rockets",[0]];
};

if (_veh isEqualTo "B_Heli_Transport_01_F") then {
_vehicle removeMagazinesTurret ["2000Rnd_65x39_Belt_Tracer_Red",[1]];
_vehicle removeMagazinesTurret ["2000Rnd_65x39_Belt_Tracer_Red",[2]];
};
private ["_vehicle","_veh"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've managed to duplicate these 3 lines twice. It'd be best to remove the BIS_fnc_param and the private ARRAY and replace with params (obviously removing the duplication).

_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _vehicle) exitWith {};

clearWeaponCargoGlobal _vehicle;
clearMagazineCargoGlobal _vehicle;
clearItemCargoGlobal _vehicle;
clearBackpackCargoGlobal _vehicle;

switch (typeOf _vehicle) do {
case "B_Boat_Armed_01_minigun_F": {
_vehicle removeMagazinesTurret ["200Rnd_40mm_G_belt",[0]];
};
case "B_APC_Wheeled_01_cannon_F": {
_vehicle removeMagazinesTurret ["60Rnd_40mm_GPR_Tracer_Red_shells",[0]];
_vehicle removeMagazinesTurret ["40Rnd_40mm_APFSDS_Tracer_Red_shells",[0]];
};
case "O_Heli_Attack_02_black_F": {
_vehicle removeMagazinesTurret ["250Rnd_30mm_APDS_shells",[0]];
_vehicle removeMagazinesTurret ["8Rnd_LG_scalpel",[0]];
_vehicle removeMagazinesTurret ["38Rnd_80mm_rockets",[0]];
};
case "B_Heli_Transport_01_F": {
_vehicle removeMagazinesTurret ["2000Rnd_65x39_Belt_Tracer_Red",[1]];
_vehicle removeMagazinesTurret ["2000Rnd_65x39_Belt_Tracer_Red",[2]];
};
};