Fix init issue

This commit is contained in:
VKing 2015-12-19 18:22:54 +01:00
parent a37d97103f
commit 85270e4521
2 changed files with 9 additions and 3 deletions

View File

@ -16,7 +16,6 @@ class CfgWeapons {
class CannonCore; class CannonCore;
class mortar_82mm: CannonCore { class mortar_82mm: CannonCore {
class Single1; class Single1;
GVAR(replaceWith) = "ACE_mortar_82mm";
}; };
class ACE_mortar_82mm: mortar_82mm { class ACE_mortar_82mm: mortar_82mm {
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);

View File

@ -16,6 +16,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_mortar"]; params ["_mortar"];
private ["_newWeapon","_currentWeapon"];
if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {}; 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 // Replace current weapon with ammo handling weapon
private _currentWeapon = _mortar weaponsTurret [0] select 0; _currentWeapon = _mortar weaponsTurret [0] select 0;
private _newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith));
if (_currentWeapon == "mortar_82mm") then {
_newWeapon = "ace_mortar_82mm"
} else {
_newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith));
};
if (_newWeapon != "") then { if (_newWeapon != "") then {
_mortar removeWeaponGlobal _currentWeapon; _mortar removeWeaponGlobal _currentWeapon;
_mortar addWeaponGlobal _newWeapon; _mortar addWeaponGlobal _newWeapon;