ACE3/addons/mk6mortar/functions/fnc_mortarInit.sqf

37 lines
953 B
Plaintext
Raw Normal View History

2015-12-19 01:18:35 +00:00
/*
* Author: VKing
* Initializes mortar for use with ammunition handling magazines.
*
* Arguments:
* 0: Mortar <OBJECT>
*
* Return Value:
* None
*
* Example:
* [mortar1] call ace_mk6mortar_fnc_mortarInit
*
* Public: No
*/
#include "script_component.hpp"
params ["_mortar"];
2015-12-19 01:18:35 +00:00
if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {};
2015-12-19 01:18:35 +00:00
// Remove all magazines
if (count magazines _mortar > 0) then {
{_mortar removeMagazineGlobal _x} forEach magazines _mortar;
};
// Replace current weapon with ammo handling weapon
private _currentWeapon = _mortar weaponsTurret [0] select 0;
private _newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith));
if (_newWeapon != "") then {
2015-12-19 01:18:35 +00:00
_mortar removeWeaponGlobal _currentWeapon;
_mortar addWeaponGlobal _newWeapon;
};
_mortar setVariable [QGVAR(initialized),true,true];
TRACE_1("Init complete",_mortar);