2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-04 01:08:21 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Fire Vehicle Smoke Launcher.
|
|
|
|
*
|
2015-08-08 12:40:23 +00:00
|
|
|
* Arguments:
|
2015-08-04 01:08:21 +00:00
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
*
|
2015-08-08 12:40:23 +00:00
|
|
|
* Return Value:
|
2015-08-04 01:08:21 +00:00
|
|
|
* None
|
2015-08-08 12:40:23 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [vehicle player] call ace_weaponselect_fnc_fireSmokeLauncher
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-04 01:08:21 +00:00
|
|
|
*/
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2015-08-04 01:08:21 +00:00
|
|
|
params ["_vehicle"];
|
2015-01-17 17:26:51 +00:00
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
private _turret = _vehicle call EFUNC(common,getTurretCommander);
|
|
|
|
private _weapons = _vehicle weaponsTurret _turret;
|
2015-01-17 17:26:51 +00:00
|
|
|
|
|
|
|
if (
|
|
|
|
count _weapons > 1
|
2024-04-06 18:57:08 +00:00
|
|
|
|| {_weapons isNotEqualTo [] && {!(_weapons select 0 in ["SmokeLauncher", "BWA3_SmokeLauncher"])}} // @todo somebody might use custom smoke launcher weapons aswell, maybe ...
|
2015-01-17 17:26:51 +00:00
|
|
|
) then {
|
|
|
|
//This doesn't work reliably for vehilces with additional weapons for the commander. Select smoke launcher instead.
|
|
|
|
|
|
|
|
// avoid infinite loop
|
|
|
|
if !("SmokeLauncher" in _weapons) exitWith {};
|
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
private _index = 0;
|
|
|
|
|
2015-01-17 17:26:51 +00:00
|
|
|
while {
|
|
|
|
_vehicle currentWeaponTurret _turret != "SmokeLauncher"
|
|
|
|
} do {
|
|
|
|
[commander _vehicle, _vehicle, _index] call FUNC(selectWeaponVehicle);
|
|
|
|
_index = _index + 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// fire away!
|
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
|
2015-09-27 12:55:36 +00:00
|
|
|
|
2015-01-17 17:26:51 +00:00
|
|
|
_logic action ["useWeapon", _vehicle, commander _vehicle, 0];
|
2015-09-27 12:55:36 +00:00
|
|
|
|
2015-01-17 17:26:51 +00:00
|
|
|
deleteVehicle _logic;
|
|
|
|
};
|