Mortar init functions

This commit is contained in:
VKing 2015-12-19 02:18:35 +01:00
parent 579f861b8f
commit 2c4a25a6c0
6 changed files with 66 additions and 22 deletions

View File

@ -5,7 +5,7 @@ class Extended_PreInit_EventHandlers {
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
@ -15,3 +15,10 @@ class Extended_FiredBIS_EventHandlers {
};
};
};
class Extended_InitPost_EventHandlers {
class Mortar_01_base_F {
class ADDON {
init = QUOTE(_this call COMPILE_FILE(XEH_initPost));
};
};
};

View File

@ -16,6 +16,7 @@ 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);

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
// if (GVAR(useAmmoHandling)) then {
_this call FUNC(mortarInit);
// };

View File

@ -1,27 +1,21 @@
#include "script_component.hpp"
[QGVAR(addMagazine), {
params ["_static", "_magazine"];
_static addMagazineTurret [_magazine,[0]];
}] call EFUNC(common,addEventHandler);
[QGVAR(removeMagazine), {
params ["_static", "_magazine"];
_static removeMagazineTurret [_magazine,[0]];
}] call EFUNC(common,addEventHandler);
[QGVAR(setAmmo), {
params ["_static", "_magazine","_ammoCount"];
_static setMagazineTurretAmmo [_magazine, _ammoCount, [0]];
}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {};
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler);
[QGVAR(addMagazine), {
params ["_static", "_magazine"];
_static addMagazineTurret [_magazine,[0]];
}] call EFUNC(common,addEventHandler);
[QGVAR(removeMagazine), {
params ["_static", "_magazine"];
_static removeMagazineTurret [_magazine,[0]];
}] call EFUNC(common,addEventHandler);
[QGVAR(setAmmo), {
params ["_static", "_magazine","_ammoCount"];
_static setMagazineTurretAmmo [_magazine, _ammoCount, [0]];
}] call EFUNC(common,addEventHandler);

View File

@ -15,6 +15,7 @@ PREP(handlePlayerVehicleChanged);
PREP(loadMagazine);
PREP(loadMagazineTimer);
PREP(moduleInit);
PREP(mortarInit);
PREP(rangeTableCanUse);
PREP(rangeTableOpen);
PREP(rangeTablePageChange);

View File

@ -0,0 +1,36 @@
/*
* 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
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_1(_mortar);
if (_mortar getVariable [QGVAR(initialized),false]) exitWith {};
// 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;
if (getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith)) != "") then {
_mortar removeWeaponGlobal _currentWeapon;
_mortar addWeaponGlobal _newWeapon;
};
_mortar setVariable [QGVAR(initialized),true,true];
TRACE_1("Init complete",_mortar);