remove proxy weapon function

This commit is contained in:
Salluci 2023-07-13 21:01:02 +03:00
parent d221755915
commit 5b3f77d756
3 changed files with 1 additions and 60 deletions

View File

@ -27,7 +27,7 @@ class CfgVehicles {
}; };
class Mortar_01_base_F: StaticMortar { class Mortar_01_base_F: StaticMortar {
class ace_csw { class ace_csw {
proxyWeapon = QFUNC(csw_getProxyWeapon); proxyWeapon = "ACE_mortar_82mm";
magazineLocation = "_target selectionPosition 'usti hlavne'"; magazineLocation = "_target selectionPosition 'usti hlavne'";
}; };
class Turrets: Turrets { class Turrets: Turrets {

View File

@ -1,5 +1,4 @@
PREP(csw_getProxyWeapon);
PREP(handleFired); PREP(handleFired);
PREP(handlePlayerVehicleChanged); PREP(handlePlayerVehicleChanged);
PREP(moduleInit); PREP(moduleInit);

View File

@ -1,58 +0,0 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Compatibility With ACE_CSW (will be called by ace_csw, no dependency)
* Setting Init has finished, and this runs before csw attempts to unload weapon, should replicate functionality of mk6_fnc_mortarInit
*
* Arguments:
* 0: static <OBJECT>
* 1: Turret <ARRAY>
* 2: current weapon <STRING>
* 3: need proxy weapon (either assembly mode is true, or weapon has been emptied and is being reloaded) <BOOL>
*
* Return Value:
* Proxy Weapon <STRING>
*
* Example:
* [mortar, "mortar_82mm", true] call ace_mk6mortar_fnc_csw_getProxyWeapon
*
* Public: No
*/
params ["_mortar", "_turret", "_currentWeapon", "_proxyWeaponNeeded"];
TRACE_4("csw_getProxyWeapon",_mortar,_turret,_currentWeapon,_proxyWeaponNeeded);
private _newWeapon = "";
if (GVAR(useAmmoHandling)) then {
if (_currentWeapon != "mortar_82mm") exitWith { ERROR_2("unknown weapon [%1 - %2]",typeOf _mortar,_currentWeapon); };
// Replace weapon with fast reloading version
_newWeapon = "ace_mortar_82mm";
TRACE_1("replacing weapon",_newWeapon);
// need to convert 8rnd mags to 1rnd mags for new weapon (we need to do this so the weapon is loaded with a compatible mag)
private _magsToRemove = [];
private _convertedMags = [];
{
_x params ["_xMag", "_xTurret", "_xAmmo"];
if (_xTurret isEqualTo _turret) then {
private _replaceMag = GVAR(ammoHandlingMagazineReplacement) getOrDefault [_xMag, ""];
if (_replaceMag != "") then {
_magsToRemove pushBackUnique [_xMag, _xTurret];
TRACE_3("replacing",_xMag,_replaceMag,_xAmmo);
for "_i" from 1 to _xAmmo do {
_convertedMags pushBack [_replaceMag, _xTurret, 1];
};
} else {
WARNING_1("unknown mag %1", _xMag);
};
};
} forEach (magazinesAllTurrets _mortar);
// remove orignal mags and add 1rnd versions:
{ _mortar removeMagazinesTurret _x; } forEach _magsToRemove;
{ _mortar addMagazineTurret _x; } forEach _convertedMags;
};
_newWeapon