Fix for launchers not being deleted

Still have to do something about the launcher rounds which persist for some reason.
This commit is contained in:
Chris Cardozo 2020-10-31 11:38:46 -04:00
parent 498e7e06e1
commit 1e6d4aeabe

View File

@ -11,21 +11,22 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_launcher","_launcherRounds"];
params["_unit"]; // = _this select 0;
_launcher = _unit getVariable ["Launcher",""];
_unit removeWeapon _Launcher;
if (_launcher != "") then
private _loadout = _unit getVariable["launcher",[[],[]]];
{
_unit removeWeapon _Launcher;
{
if (_launcher in weaponCargo _x) exitWith {
deleteVehicle _x;
};
} forEach ((getPosATL _unit) nearObjects ["WeaponHolderSimulated",10]);
_launcherRounds = getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines"); //0;
{
if(_x in _launcherRounds) then {_unit removeMagazine _x;};
} count magazines _unit;
unit removeMagazineGlobal _x;
} forEach (_loadout select 1);
private _launcher = _loadout select 0;
if !(_launcher isEqualTo []) then
{
if (_launcher in (weapons _unit)) then {
_unit removeWeapon _launcher;
} else {
{
if (_launcher in (weaponCargo _x)) exitWith {deleteVehicle _x};
} forEach (_unit nearObjects ["WeaponHolderSimulated",10]);
};
};