From 85270e4521e296082c97451cb14185f046390d7d Mon Sep 17 00:00:00 2001 From: VKing Date: Sat, 19 Dec 2015 18:22:54 +0100 Subject: [PATCH] Fix init issue --- addons/mk6mortar/CfgWeapons.hpp | 1 - addons/mk6mortar/functions/fnc_mortarInit.sqf | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp index 448bb55271..f535840e99 100644 --- a/addons/mk6mortar/CfgWeapons.hpp +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -16,7 +16,6 @@ class CfgWeapons { class CannonCore; class mortar_82mm: CannonCore { class Single1; - GVAR(replaceWith) = "ACE_mortar_82mm"; }; class ACE_mortar_82mm: mortar_82mm { author = ECSTRING(common,ACETeam); diff --git a/addons/mk6mortar/functions/fnc_mortarInit.sqf b/addons/mk6mortar/functions/fnc_mortarInit.sqf index 26ad0525fb..ec41c03b19 100644 --- a/addons/mk6mortar/functions/fnc_mortarInit.sqf +++ b/addons/mk6mortar/functions/fnc_mortarInit.sqf @@ -16,6 +16,7 @@ #include "script_component.hpp" params ["_mortar"]; +private ["_newWeapon","_currentWeapon"]; if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {}; @@ -25,8 +26,14 @@ if (count magazines _mortar > 0) then { }; // Replace current weapon with ammo handling weapon -private _currentWeapon = _mortar weaponsTurret [0] select 0; -private _newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith)); +_currentWeapon = _mortar weaponsTurret [0] select 0; + +if (_currentWeapon == "mortar_82mm") then { + _newWeapon = "ace_mortar_82mm" +} else { + _newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith)); +}; + if (_newWeapon != "") then { _mortar removeWeaponGlobal _currentWeapon; _mortar addWeaponGlobal _newWeapon;