mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Mortar init functions
This commit is contained in:
parent
579f861b8f
commit
2c4a25a6c0
@ -5,7 +5,7 @@ class Extended_PreInit_EventHandlers {
|
|||||||
};
|
};
|
||||||
class Extended_PostInit_EventHandlers {
|
class Extended_PostInit_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Extended_FiredBIS_EventHandlers {
|
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));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -16,6 +16,7 @@ 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);
|
||||||
|
5
addons/mk6mortar/XEH_initPost.sqf
Normal file
5
addons/mk6mortar/XEH_initPost.sqf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// if (GVAR(useAmmoHandling)) then {
|
||||||
|
_this call FUNC(mortarInit);
|
||||||
|
// };
|
@ -1,27 +1,21 @@
|
|||||||
#include "script_component.hpp"
|
#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 {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
|
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
|
||||||
["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] 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);
|
|
@ -15,6 +15,7 @@ PREP(handlePlayerVehicleChanged);
|
|||||||
PREP(loadMagazine);
|
PREP(loadMagazine);
|
||||||
PREP(loadMagazineTimer);
|
PREP(loadMagazineTimer);
|
||||||
PREP(moduleInit);
|
PREP(moduleInit);
|
||||||
|
PREP(mortarInit);
|
||||||
PREP(rangeTableCanUse);
|
PREP(rangeTableCanUse);
|
||||||
PREP(rangeTableOpen);
|
PREP(rangeTableOpen);
|
||||||
PREP(rangeTablePageChange);
|
PREP(rangeTablePageChange);
|
||||||
|
36
addons/mk6mortar/functions/fnc_mortarInit.sqf
Normal file
36
addons/mk6mortar/functions/fnc_mortarInit.sqf
Normal 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);
|
Loading…
Reference in New Issue
Block a user