mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
CSW - Code cleanup (#9777)
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
parent
802560da8a
commit
ee79decb45
@ -4,7 +4,7 @@ class CfgVehicles {
|
|||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
class GVAR(deploy) {
|
class GVAR(deploy) {
|
||||||
displayName = CSTRING(PlaceTripod_displayName);
|
displayName = CSTRING(PlaceTripod_displayName);
|
||||||
condition = QUOTE(call FUNC(assemble_canDeployTripod));
|
condition = QUOTE(call FUNC(canDeployTripod));
|
||||||
statement = QUOTE(call FUNC(assemble_deployTripod));
|
statement = QUOTE(call FUNC(assemble_deployTripod));
|
||||||
exceptions[] = {};
|
exceptions[] = {};
|
||||||
};
|
};
|
||||||
@ -36,7 +36,7 @@ class CfgVehicles {
|
|||||||
condition = "true";
|
condition = "true";
|
||||||
class GVAR(pickUp) {
|
class GVAR(pickUp) {
|
||||||
displayName = CSTRING(Pickup_displayName);
|
displayName = CSTRING(Pickup_displayName);
|
||||||
condition = QUOTE(call FUNC(assemble_canPickupTripod));
|
condition = QUOTE(call FUNC(canPickupTripod));
|
||||||
statement = QUOTE(call FUNC(assemble_pickupTripod));
|
statement = QUOTE(call FUNC(assemble_pickupTripod));
|
||||||
};
|
};
|
||||||
class GVAR(mountWeapon) {
|
class GVAR(mountWeapon) {
|
||||||
@ -125,10 +125,11 @@ class CfgVehicles {
|
|||||||
class StaticWeapon: LandVehicle {
|
class StaticWeapon: LandVehicle {
|
||||||
class ACE_Actions {
|
class ACE_Actions {
|
||||||
class ACE_MainActions {
|
class ACE_MainActions {
|
||||||
|
// Workaround for static weapons' Get In memory point being at the front of the gun
|
||||||
class GVAR(getIn) {
|
class GVAR(getIn) {
|
||||||
displayName = CSTRING(GetIn_displayName);
|
displayName = CSTRING(GetIn_displayName);
|
||||||
condition = QUOTE(call FUNC(canGetIn));
|
condition = QUOTE(call FUNC(canGetIn));
|
||||||
statement = QUOTE(call FUNC(getIn));
|
statement = QUOTE(_player moveInTurret [ARR_2(_target,[0])]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -6,9 +6,9 @@ PREP(ai_handleFired);
|
|||||||
PREP(ai_handleGetIn);
|
PREP(ai_handleGetIn);
|
||||||
PREP(ai_reload);
|
PREP(ai_reload);
|
||||||
|
|
||||||
PREP(assemble_canDeployTripod);
|
PREP(canDeployTripod);
|
||||||
PREP(assemble_canDeployWeapon);
|
PREP(assemble_canDeployWeapon);
|
||||||
PREP(assemble_canPickupTripod);
|
PREP(canPickupTripod);
|
||||||
PREP(assemble_canPickupWeapon);
|
PREP(assemble_canPickupWeapon);
|
||||||
PREP(assemble_deployTripod);
|
PREP(assemble_deployTripod);
|
||||||
PREP(assemble_deployWeapon);
|
PREP(assemble_deployWeapon);
|
||||||
@ -17,13 +17,12 @@ PREP(assemble_pickupTripod);
|
|||||||
PREP(assemble_pickupWeapon);
|
PREP(assemble_pickupWeapon);
|
||||||
|
|
||||||
PREP(canGetIn);
|
PREP(canGetIn);
|
||||||
PREP(getIn);
|
|
||||||
|
|
||||||
PREP(getCarryMagazine);
|
PREP(getCarryMagazine);
|
||||||
PREP(proxyWeapon);
|
PREP(proxyWeapon);
|
||||||
|
|
||||||
PREP(reload_actionsLoad);
|
PREP(getLoadActions);
|
||||||
PREP(reload_actionsUnload);
|
PREP(getUnloadActions);
|
||||||
PREP(reload_canLoadMagazine);
|
PREP(reload_canLoadMagazine);
|
||||||
PREP(reload_canUnloadMagazine);
|
PREP(reload_canUnloadMagazine);
|
||||||
PREP(reload_getLoadableMagazines);
|
PREP(reload_getLoadableMagazines);
|
||||||
@ -33,5 +32,5 @@ PREP(reload_handleRemoveTurretMag);
|
|||||||
PREP(reload_handleReturnAmmo);
|
PREP(reload_handleReturnAmmo);
|
||||||
PREP(reload_loadMagazine);
|
PREP(reload_loadMagazine);
|
||||||
|
|
||||||
PREP(staticWeaponInit);
|
PREP(initVehicle);
|
||||||
PREP(staticWeaponInit_unloadExtraMags);
|
PREP(staticWeaponInit_unloadExtraMags);
|
||||||
|
@ -6,18 +6,27 @@ GVAR(vehicleMagCache) = createHashMap;
|
|||||||
TRACE_3("settingsInit",GVAR(defaultAssemblyMode),GVAR(handleExtraMagazines),GVAR(ammoHandling));
|
TRACE_3("settingsInit",GVAR(defaultAssemblyMode),GVAR(handleExtraMagazines),GVAR(ammoHandling));
|
||||||
["StaticWeapon", "Init", {
|
["StaticWeapon", "Init", {
|
||||||
// needs a small delay for network syncing, or we end up with duplicate mags with ammo handling
|
// needs a small delay for network syncing, or we end up with duplicate mags with ammo handling
|
||||||
[LINKFUNC(staticWeaponInit), _this, 1] call CBA_fnc_waitAndExecute;
|
[LINKFUNC(initVehicle), _this, 1] call CBA_fnc_waitAndExecute;
|
||||||
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
|
GVAR(quickmountEnabled) = (
|
||||||
|
missionNamespace getVariable [QEGVAR(quickmount,enabled), false] &&
|
||||||
|
{(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1,3]}
|
||||||
|
);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
["CBA_SettingChanged", {
|
||||||
|
GVAR(quickmountEnabled) = (
|
||||||
|
missionNamespace getVariable [QEGVAR(quickmount,enabled), false] &&
|
||||||
|
{(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1,3]}
|
||||||
|
);
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Event handlers:
|
// Event handlers:
|
||||||
[QGVAR(addTurretMag), LINKFUNC(reload_handleAddTurretMag)] call CBA_fnc_addEventHandler;
|
[QGVAR(addTurretMag), LINKFUNC(reload_handleAddTurretMag)] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(removeTurretMag), LINKFUNC(reload_handleRemoveTurretMag)] call CBA_fnc_addEventHandler;
|
[QGVAR(removeTurretMag), LINKFUNC(reload_handleRemoveTurretMag)] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(returnAmmo), LINKFUNC(reload_handleReturnAmmo)] call CBA_fnc_addEventHandler;
|
[QGVAR(returnAmmo), LINKFUNC(reload_handleReturnAmmo)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
call compile preprocessFileLineNumbers QPATHTOF(dev\checkStaticWeapons.sqf);
|
call compile preprocessFileLineNumbers QPATHTOF(dev\checkStaticWeapons.sqf);
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,14 +7,14 @@ INFO("Checking static weapons");
|
|||||||
|
|
||||||
private _staticWeaponConfigs = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(configName _x) isKindOf 'StaticWeapon'}", true];
|
private _staticWeaponConfigs = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(configName _x) isKindOf 'StaticWeapon'}", true];
|
||||||
private _staticPublic = _staticWeaponConfigs select {(getNumber (_x >> "scope")) == 2};
|
private _staticPublic = _staticWeaponConfigs select {(getNumber (_x >> "scope")) == 2};
|
||||||
INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic,{(getNumber (_x >> "ace_csw" >> "enabled")) == 1} count _staticPublic);
|
INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic,{(getNumber (_x >> QUOTE(ADDON) >> "enabled")) == 1} count _staticPublic);
|
||||||
|
|
||||||
INFO("------ Checking static weapons inheritance ------");
|
INFO("------ Checking static weapons inheritance ------");
|
||||||
private _explicitBases = [];
|
private _explicitBases = [];
|
||||||
private _inherited = [];
|
private _inherited = [];
|
||||||
{
|
{
|
||||||
private _config = _x;
|
private _config = _x;
|
||||||
private _configEnabled = (getNumber (_config >> "ace_csw" >> "enabled")) == 1;
|
private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1;
|
||||||
if (_configEnabled) then {
|
if (_configEnabled) then {
|
||||||
private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1;
|
private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1;
|
||||||
if (_configExplicit) then {
|
if (_configExplicit) then {
|
||||||
@ -69,7 +69,7 @@ private _logAll = false;
|
|||||||
|
|
||||||
{
|
{
|
||||||
//IGNORE_PRIVATE_WARNING ["_x", "_y"];
|
//IGNORE_PRIVATE_WARNING ["_x", "_y"];
|
||||||
INFO_2("[%1] has no carry varient - Used in %2",_x,_y);
|
INFO_2("[%1] has no carry variant - Used in %2",_x,_y);
|
||||||
} forEach _hash;
|
} forEach _hash;
|
||||||
|
|
||||||
INFO("------ End -------");
|
INFO("------ End -------");
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_staticWeapon", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
|
params ["_vehicle", "_weapon", "", "", "", "_magazine", "", "_gunner"];
|
||||||
TRACE_8("firedEH:",_staticWeapon,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_gunner);
|
TRACE_4("firedEH:",_vehicle,_weapon,_magazine,_gunner);
|
||||||
|
|
||||||
|
if (someAmmo _vehicle) exitWith {};
|
||||||
if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {};
|
if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {};
|
||||||
if (someAmmo _staticWeapon) exitWith {};
|
|
||||||
|
|
||||||
TRACE_2("need ammo",someAmmo _staticWeapon,magazinesAllTurrets _staticWeapon);
|
TRACE_1("need ammo",magazinesAllTurrets _vehicle);
|
||||||
|
|
||||||
[_staticWeapon, _gunner, _weapon, _magazine] call FUNC(ai_reload);
|
[_vehicle, _gunner, _weapon, _magazine] call FUNC(ai_reload);
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
params ["_staticWeapon", "_role", "_gunner"];
|
|
||||||
TRACE_3("getInEH:",_staticWeapon,_role,_gunner);
|
|
||||||
|
|
||||||
|
params ["_vehicle", "", "_gunner"];
|
||||||
|
TRACE_2("getInEH:",_vehicle,_gunner);
|
||||||
|
|
||||||
|
if (someAmmo _vehicle) exitWith {};
|
||||||
if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {};
|
if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {};
|
||||||
if (someAmmo _staticWeapon) exitWith {};
|
|
||||||
|
|
||||||
TRACE_2("need ammo",someAmmo _staticWeapon,magazinesAllTurrets _staticWeapon);
|
TRACE_1("need ammo",magazinesAllTurrets _vehicle);
|
||||||
|
|
||||||
[_staticWeapon, _gunner, currentWeapon _staticWeapon] call FUNC(ai_reload);
|
[_vehicle, _gunner, currentWeapon _vehicle] call FUNC(ai_reload);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_staticWeapon", "_gunner", "_weapon", ["_magazine", ""]];
|
params ["_staticWeapon", "_gunner", "_weapon", ["_magazine", ""]];
|
||||||
|
|
||||||
private _turretPath = [_gunner] call EFUNC(common,getTurretIndex);
|
private _turretPath = [_gunner] call EFUNC(common,getTurretIndex);
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
/*
|
|
||||||
* Author:tcvm
|
|
||||||
* Checks if the player can deploy the tripod.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Unit <OBJECT>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* Can deploy <BOOL>
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [player] call ace_csw_fnc_assemble_canDeployTripod
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
|
|
||||||
params ["_player"];
|
|
||||||
|
|
||||||
(getText(configFile >> "CfgWeapons" >> (secondaryWeapon _player) >> QUOTE(ADDON) >> "type") == "mount")
|
|
||||||
|
|
@ -22,4 +22,3 @@ if (isNil "_carryWeaponClassname") then { _carryWeaponClassname = secondaryWeapo
|
|||||||
// If the current launcher has a config-value that defines the tripod, it is a CSW
|
// If the current launcher has a config-value that defines the tripod, it is a CSW
|
||||||
(alive _target) &&
|
(alive _target) &&
|
||||||
{(getText(configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> (typeOf _target))) != ""}
|
{(getText(configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> (typeOf _target))) != ""}
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
/*
|
|
||||||
* Author:tcvm
|
|
||||||
* Checks if the player can pick-up the tripod.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Tripod <OBJECT>
|
|
||||||
* 1: Unit <OBJECT>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* Can pickup <BOOL>
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [tripod, player] call ace_csw_fnc_assemble_canPickupTripod
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
|
|
||||||
params ["_tripod", "_player"];
|
|
||||||
|
|
||||||
((secondaryWeapon _player) isEqualTo "") && {alive _tripod}
|
|
||||||
|
|
@ -23,4 +23,3 @@ private _notCrewed = (crew _staticWeapon) isEqualTo [];
|
|||||||
private _deadCrew = !(alive (gunner _staticWeapon)); // need to eject body???
|
private _deadCrew = !(alive (gunner _staticWeapon)); // need to eject body???
|
||||||
|
|
||||||
_assemblyMode && {_notCrewed || _deadCrew}
|
_assemblyMode && {_notCrewed || _deadCrew}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
_cswTripod setVariable [QGVAR(secondaryWeaponMagazine), _secondaryWeaponMagazine];
|
_cswTripod setVariable [QGVAR(secondaryWeaponMagazine), _secondaryWeaponMagazine];
|
||||||
};
|
};
|
||||||
if (!GVAR(defaultAssemblyMode)) then {
|
if (!GVAR(defaultAssemblyMode)) then {
|
||||||
[_cswTripod, "disableWeaponAssembly", "ace_csw", true] call EFUNC(common,statusEffect_set);
|
[_cswTripod, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _posATL = _player getRelPos [2, 0];
|
private _posATL = _player getRelPos [2, 0];
|
||||||
|
@ -44,4 +44,3 @@
|
|||||||
TRACE_3("",_pickupTime,typeOf _tripod,_tripodClassname);
|
TRACE_3("",_pickupTime,typeOf _tripod,_tripodClassname);
|
||||||
[TIME_PROGRESSBAR(_pickupTime), [_tripod, _player, _tripodClassname], _onFinish, {}, localize LSTRING(PickupTripod_progressBar), _condition] call EFUNC(common,progressBar);
|
[TIME_PROGRESSBAR(_pickupTime), [_tripod, _player, _tripodClassname], _onFinish, {}, localize LSTRING(PickupTripod_progressBar), _condition] call EFUNC(common,progressBar);
|
||||||
}, _this] call CBA_fnc_execNextFrame;
|
}, _this] call CBA_fnc_execNextFrame;
|
||||||
|
|
||||||
|
22
addons/csw/functions/fnc_canDeployTripod.sqf
Normal file
22
addons/csw/functions/fnc_canDeployTripod.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: tcvm
|
||||||
|
* Checks if the unit can deploy a tripod
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Can deploy <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* player call ace_csw_fnc_canDeployTripod
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
private _secondaryWeapon = secondaryWeapon _unit;
|
||||||
|
|
||||||
|
_secondaryWeapon != "" && {getText (configFile >> "CfgWeapons" >> _secondaryWeapon >> QUOTE(ADDON) >> "type") == "mount"} // return
|
@ -1,28 +1,23 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: tcvm
|
* Author: tcvm
|
||||||
* Checks if the player can get in the weapon
|
* Checks if it's possible to get in the CSW
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Static Weapon <OBJECT>
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [cursorObject] call ace_csw_fnc_canGetIn
|
* cursorObject call ace_csw_fnc_canGetIn
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// hide this action if quick mount is enabled
|
// Hide this action if quick mount is enabled
|
||||||
if ((missionNamespace getVariable [QEGVAR(quickmount,enabled), false]) && {(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1, 3]}) exitWith {
|
if (GVAR(quickmountEnabled)) exitWith {false};
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
params ["_staticWeapon"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
alive _staticWeapon
|
alive _vehicle && {!(alive (gunner _vehicle))} && {(locked _vehicle) < 2} && {!(_vehicle lockedTurret [0])} && {0.3 < ((vectorUp _vehicle) select 2)} // return
|
||||||
&& {!(alive (gunner _staticWeapon))}
|
|
||||||
&& {(locked _staticWeapon) < 2}
|
|
||||||
&& {0.3 < ((vectorUp _staticWeapon) select 2)}
|
|
||||||
|
21
addons/csw/functions/fnc_canPickupTripod.sqf
Normal file
21
addons/csw/functions/fnc_canPickupTripod.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: tcvm
|
||||||
|
* Checks if the unit can pickup the tripod
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Tripod <OBJECT>
|
||||||
|
* 1: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Can pickup <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [cursorObject, player] call ace_csw_fnc_canPickupTripod
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_tripod", "_unit"];
|
||||||
|
|
||||||
|
((secondaryWeapon _unit) == "") && {alive _tripod} // return
|
@ -1,24 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
/*
|
|
||||||
* Author:tcvm
|
|
||||||
* An action for the player to get in the CSW
|
|
||||||
* Due to the fact that the default static weapons "Get In" memory point is at the front of
|
|
||||||
* the gun and can't be acssesed from the back, I am implementing this to get around that issue.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Static Weapon <OBJECT>
|
|
||||||
* 1: Unit <OBJECT>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [cursorObject, player] call ace_csw_fnc_getIn
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
|
|
||||||
params ["_staticWeapon", "_player"];
|
|
||||||
TRACE_2("getIn",_staticWeapon,_player);
|
|
||||||
|
|
||||||
_player moveInTurret [_staticWeapon, [0]];
|
|
@ -1,42 +1,42 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: PabstMirror
|
* Author: PabstMirror
|
||||||
* Gets sub actions for what the player can load into the static weapon
|
* Gets sub actions for what the unit can load into the CSW
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Static Weapon <OBJECT>
|
* 0: Vehicle <OBJECT>
|
||||||
* 1: Player <OBJECT>
|
* 1: Unit <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Actions <ARRAY>
|
* Actions <ARRAY>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [cursorObject, player] call ace_csw_fnc_reload_actionsLoad
|
* [cursorObject, player] call ace_csw_fnc_getLoadActions
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_vehicle", "_player"];
|
params ["_vehicle", "_unit"];
|
||||||
|
|
||||||
private _actions = [];
|
private _loadableMagazines = [_vehicle, _unit] call FUNC(reload_getLoadableMagazines);
|
||||||
private _loadableMagazines = [_vehicle, _player] call FUNC(reload_getLoadableMagazines);
|
if (_loadableMagazines isEqualTo []) exitWith {[]};
|
||||||
|
|
||||||
private _statement = {
|
private _statement = {
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_args"];
|
||||||
_params params ["_carryMag", "_turretPath", "", "_magSource"];
|
_args params ["_carryMag", "_turretPath", "", "_magSource"];
|
||||||
|
|
||||||
[_target, _turretPath, _carryMag, _magSource, _player] call FUNC(reload_loadMagazine);
|
[_target, _turretPath, _carryMag, _magSource, _player] call FUNC(reload_loadMagazine);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _condition = {
|
private _condition = {
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_args"];
|
||||||
_params params ["_carryMag", "_turretPath", "", "_magSource"];
|
_args params ["_carryMag", "_turretPath", "", "_magSource"];
|
||||||
|
|
||||||
([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0
|
([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0
|
||||||
};
|
};
|
||||||
|
|
||||||
private _cfgMagazines = configFile >> "CfgMagazines"; // micro-optimization
|
private _cfgMagazines = configFile >> "CfgMagazines"; // micro-optimization
|
||||||
|
private _actions = [];
|
||||||
{
|
{
|
||||||
_x params ["_carryMag", "", "_loadInfo"];
|
_x params ["_carryMag", "", "_loadInfo"];
|
||||||
_loadInfo params ["", "", "", "_isBeltLinking"];
|
_loadInfo params ["", "", "", "_isBeltLinking"];
|
74
addons/csw/functions/fnc_getUnloadActions.sqf
Normal file
74
addons/csw/functions/fnc_getUnloadActions.sqf
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Gets sub actions for what can be unloaded from the CSW
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Vehicle <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Actions <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* cursorObject call ace_csw_fnc_getUnloadActions
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_vehicle"];
|
||||||
|
|
||||||
|
private _statement = {
|
||||||
|
params ["_target", "_player", "_args"];
|
||||||
|
_args params ["_vehMag", "_turretPath", "_carryMag"];
|
||||||
|
TRACE_5("starting unload",_target,_turretPath,_player,_carryMag,_vehMag);
|
||||||
|
|
||||||
|
private _timeToUnload = 1;
|
||||||
|
if (!isNull (configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime")) then {
|
||||||
|
_timeToUnload = getNumber (configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime");
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
TIME_PROGRESSBAR(_timeToUnload),
|
||||||
|
[_target, _turretPath, _player, _carryMag, _vehMag],
|
||||||
|
{
|
||||||
|
(_this select 0) params ["_target", "_turretPath", "", "_carryMag", "_vehMag"];
|
||||||
|
TRACE_5("unload progressBar finish",_target,_turretPath,_carryMag,_vehMag,_player);
|
||||||
|
[QGVAR(removeTurretMag), [_target, _turretPath, _carryMag, _vehMag, _player]] call CBA_fnc_globalEvent;
|
||||||
|
},
|
||||||
|
{TRACE_1("unload progressBar fail",_this);},
|
||||||
|
format [localize LSTRING(unloadX), getText (configFile >> "CfgMagazines" >> _carryMag >> "displayName")],
|
||||||
|
{(_this select 0) call FUNC(reload_canUnloadMagazine)},
|
||||||
|
["isNotInside"]
|
||||||
|
] call EFUNC(common,progressBar);
|
||||||
|
};
|
||||||
|
|
||||||
|
private _condition = {
|
||||||
|
params ["_target", "_player", "_args"];
|
||||||
|
_args params ["_vehMag", "_turretPath", "_carryMag"];
|
||||||
|
[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)
|
||||||
|
};
|
||||||
|
|
||||||
|
private _actions = [];
|
||||||
|
private _handledMagTypes = [];
|
||||||
|
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
|
||||||
|
// Go through magazines on static weapon and check if any are unloadable
|
||||||
|
{
|
||||||
|
_x params ["_xMag", "_xTurret", "_xAmmo"];
|
||||||
|
|
||||||
|
if ((_xAmmo > 0) && {!(_xMag in _handledMagTypes)}) then {
|
||||||
|
_handledMagTypes pushBack _xMag;
|
||||||
|
private _carryMag = _xMag call FUNC(getCarryMagazine);
|
||||||
|
if (_carryMag == "") exitWith {};
|
||||||
|
|
||||||
|
private _displayName = getText (_cfgMagazines >> _carryMag >> "displayName");
|
||||||
|
private _text = format [LLSTRING(unloadX), _displayName];
|
||||||
|
private _picture = getText (_cfgMagazines >> _carryMag >> "picture");
|
||||||
|
private _action = [format ["unload_%1", _forEachIndex], _text, _picture, _statement, _condition, {}, [_xMag, _xTurret, _carryMag]] call EFUNC(interact_menu,createAction);
|
||||||
|
_actions pushBack [_action, [], _vehicle];
|
||||||
|
};
|
||||||
|
} forEach (magazinesAllTurrets _vehicle);
|
||||||
|
|
||||||
|
TRACE_1("unloadActions",count _actions);
|
||||||
|
_actions
|
@ -1,62 +1,63 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: tcvm
|
* Author: tcvm
|
||||||
* Initializes weapon to disable weapon disassembling
|
* Initializes CSW systems on vehicle
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Weapon <OBJECT>
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [weapon] call ace_csw_fnc_staticWeaponInit
|
* cursorObject call ace_csw_fnc_initVehicle
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_staticWeapon"];
|
params ["_vehicle"];
|
||||||
if (!alive _staticWeapon) exitWith { WARNING_1("%1 not alive",_staticWeapon); };
|
if (!alive _vehicle) exitWith { WARNING_1("%1 not alive",_vehicle); };
|
||||||
if (!simulationEnabled _staticWeapon) exitWith {
|
if (!simulationEnabled _vehicle) exitWith {
|
||||||
[{simulationEnabled _this}, FUNC(staticWeaponInit), _staticWeapon] call CBA_fnc_waitUntilAndExecute;
|
[{simulationEnabled _this}, FUNC(initVehicle), _vehicle] call CBA_fnc_waitUntilAndExecute;
|
||||||
};
|
};
|
||||||
private _typeOf = typeOf _staticWeapon;
|
|
||||||
private _configOf = configOf _staticWeapon;
|
private _typeOf = typeOf _vehicle;
|
||||||
private _configEnabled = (getNumber (_configOf >> "ace_csw" >> "enabled")) == 1;
|
private _configOf = configOf _vehicle;
|
||||||
private _assemblyConfig = _configEnabled && {(getText (_configOf >> "ace_csw" >> "disassembleWeapon")) != ""};
|
private _configEnabled = (getNumber (_configOf >> QUOTE(ADDON) >> "enabled")) == 1;
|
||||||
TRACE_4("staticWeaponInit",_staticWeapon,_typeOf,_configEnabled,_assemblyConfig);
|
private _assemblyConfig = _configEnabled && {(getText (_configOf >> QUOTE(ADDON) >> "disassembleWeapon")) != ""};
|
||||||
|
TRACE_4("initVehicle",_vehicle,_typeOf,_configEnabled,_assemblyConfig);
|
||||||
|
|
||||||
if (_configEnabled && {GVAR(ammoHandling) == 2}) then {
|
if (_configEnabled && {GVAR(ammoHandling) == 2}) then {
|
||||||
TRACE_1("adding AI fired handler",_staticWeapon);
|
TRACE_1("adding AI fired handler",_vehicle);
|
||||||
_staticWeapon addEventHandler ["Fired", LINKFUNC(ai_handleFired)];
|
_vehicle addEventHandler ["Fired", LINKFUNC(ai_handleFired)];
|
||||||
_staticWeapon addEventHandler ["GetIn", LINKFUNC(ai_handleGetIn)]; // handle AI getting inside weapon with no ammo
|
_vehicle addEventHandler ["GetIn", LINKFUNC(ai_handleGetIn)]; // handle AI getting inside weapon with no ammo
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACE_2("",local _staticWeapon,_staticWeapon turretLocal [0]);
|
TRACE_2("",local _vehicle,_vehicle turretLocal [0]);
|
||||||
if (_configEnabled && {_staticWeapon turretLocal [0]}) then { // if turret is local to us, then handle mags/weapon
|
if (_configEnabled && {_vehicle turretLocal [0]}) then { // if turret is local to us, then handle mags/weapon
|
||||||
[{
|
[{
|
||||||
params ["_staticWeapon"];
|
params ["_vehicle"];
|
||||||
if (!alive _staticWeapon) exitWith { TRACE_1("dead/deleted",_staticWeapon); };
|
if (!alive _vehicle) exitWith { TRACE_1("dead/deleted",_vehicle); };
|
||||||
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
|
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
|
||||||
private _assemblyModeIndex = _staticWeapon getVariable [QGVAR(assemblyMode), 3];
|
private _assemblyModeIndex = _vehicle getVariable [QGVAR(assemblyMode), 3];
|
||||||
private _emptyWeapon = _assemblyModeIndex isEqualTo 2;
|
private _emptyWeapon = _assemblyModeIndex isEqualTo 2;
|
||||||
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select _assemblyModeIndex;
|
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select _assemblyModeIndex;
|
||||||
TRACE_2("turretLocal",_staticWeapon,_assemblyMode);
|
TRACE_2("turretLocal",_vehicle,_assemblyMode);
|
||||||
[_staticWeapon, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon);
|
[_vehicle, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon);
|
||||||
[_staticWeapon, _assemblyMode, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags);
|
[_vehicle, _assemblyMode, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags);
|
||||||
}, [_staticWeapon]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
}, [_vehicle]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_assemblyConfig) then {
|
if (_assemblyConfig) then {
|
||||||
[{
|
[{
|
||||||
params ["_staticWeapon"];
|
params ["_vehicle"];
|
||||||
if (!alive _staticWeapon) exitWith { TRACE_1("dead/deleted",_staticWeapon); };
|
if (!alive _vehicle) exitWith { TRACE_1("dead/deleted",_vehicle); };
|
||||||
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_staticWeapon getVariable [QGVAR(assemblyMode), 3]);
|
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_vehicle getVariable [QGVAR(assemblyMode), 3]);
|
||||||
TRACE_2("assemblyConfig present",_staticWeapon,_assemblyMode);
|
TRACE_2("assemblyConfig present",_vehicle,_assemblyMode);
|
||||||
if (_assemblyMode) then { // Disable vanilla assembly if assemblyMode enabled
|
if (_assemblyMode) then { // Disable vanilla assembly if assemblyMode enabled
|
||||||
[_staticWeapon, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
[_vehicle, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
};
|
};
|
||||||
}, [_staticWeapon]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
}, [_vehicle]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add interactions for players
|
// Add interactions for players
|
||||||
@ -79,7 +80,7 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then {
|
|||||||
};
|
};
|
||||||
private _childenCode = {
|
private _childenCode = {
|
||||||
BEGIN_COUNTER(getActions); // can remove for final release
|
BEGIN_COUNTER(getActions); // can remove for final release
|
||||||
private _ret = (call FUNC(reload_actionsLoad)) + (call FUNC(reload_actionsUnload));
|
private _ret = (call FUNC(getLoadActions)) + (call FUNC(getUnloadActions));
|
||||||
END_COUNTER(getActions);
|
END_COUNTER(getActions);
|
||||||
_ret
|
_ret
|
||||||
};
|
};
|
@ -1,10 +1,10 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: tcvm, PabstMirror
|
* Author: tcvm, PabstMirror
|
||||||
* Handles the use of proxy weapons to fix engine-reload times
|
* Handles the use of proxy weapons to bypass engine reload times
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Weapon <OBJECT>
|
* 0: Vehicle <OBJECT>
|
||||||
* 1: Turret <ARRAY>
|
* 1: Turret <ARRAY>
|
||||||
* 2: Proxy weapon needed <BOOL>
|
* 2: Proxy weapon needed <BOOL>
|
||||||
* 2: Weapon should be emptied <BOOL>
|
* 2: Weapon should be emptied <BOOL>
|
||||||
@ -13,34 +13,34 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [weapon, [0], true, false] call ace_csw_fnc_proxyWeapon
|
* [cursorObject, [0], true, false] call ace_csw_fnc_proxyWeapon
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_staticWeapon", "_turret", "_needed", "_emptyWeapon"];
|
params ["_vehicle", "_turret", "_needed", "_emptyWeapon"];
|
||||||
TRACE_4("proxyWeapon",_staticWeapon,_turret,_needed,_emptyWeapon);
|
TRACE_4("proxyWeapon",_vehicle,_turret,_needed,_emptyWeapon);
|
||||||
|
|
||||||
if (_staticWeapon getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exitWith { TRACE_1("already handled",typeOf _staticWeapon); };
|
if (_vehicle getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exitWith { TRACE_1("already handled",typeOf _vehicle); };
|
||||||
|
|
||||||
private _proxyWeapon = getText (configOf _staticWeapon >> "ace_csw" >> "proxyWeapon");
|
private _proxyWeapon = getText (configOf _vehicle >> QUOTE(ADDON) >> "proxyWeapon");
|
||||||
|
|
||||||
TRACE_2("",typeOf _staticWeapon,_proxyWeapon);
|
TRACE_2("",typeOf _vehicle,_proxyWeapon);
|
||||||
if (_proxyWeapon == "") exitWith {};
|
if (_proxyWeapon == "") exitWith {};
|
||||||
|
|
||||||
private _currentWeapon = (_staticWeapon weaponsTurret [0]) param [0, "#none"];
|
private _currentWeapon = (_vehicle weaponsTurret [0]) param [0, "#none"];
|
||||||
if ((missionNamespace getVariable [_proxyWeapon, objNull]) isEqualType {}) then { // check if string is a function
|
if ((missionNamespace getVariable [_proxyWeapon, objNull]) isEqualType {}) then { // check if string is a function
|
||||||
TRACE_1("Calling proxyWeapon function",_proxyWeapon);
|
TRACE_1("Calling proxyWeapon function",_proxyWeapon);
|
||||||
// This function may replace magazines or do other things to the static weapon
|
// This function may replace magazines or do other things to the static weapon
|
||||||
_proxyWeapon = [_staticWeapon, _turret, _currentWeapon, _needed, _emptyWeapon] call (missionNamespace getVariable _proxyWeapon);
|
_proxyWeapon = [_vehicle, _turret, _currentWeapon, _needed, _emptyWeapon] call (missionNamespace getVariable _proxyWeapon);
|
||||||
_needed = _proxyWeapon != "";
|
_needed = _proxyWeapon != "";
|
||||||
};
|
};
|
||||||
if (!_needed) exitWith { TRACE_2("not needed",_needed,_proxyWeapon); };
|
if (!_needed) exitWith { TRACE_2("not needed",_needed,_proxyWeapon); };
|
||||||
|
|
||||||
// Rearm compatibility, prevent reloading entire static and breaking CSW
|
// Rearm compatibility, prevent reloading entire static and breaking CSW
|
||||||
_staticWeapon setVariable [QEGVAR(rearm,scriptedLoadout), true, true];
|
_vehicle setVariable [QEGVAR(rearm,scriptedLoadout), true, true];
|
||||||
|
|
||||||
TRACE_2("swapping to proxy weapon",_currentWeapon,_proxyWeapon);
|
TRACE_2("swapping to proxy weapon",_currentWeapon,_proxyWeapon);
|
||||||
_staticWeapon removeWeaponTurret [_currentWeapon, _turret];
|
_vehicle removeWeaponTurret [_currentWeapon, _turret];
|
||||||
_staticWeapon addWeaponTurret [_proxyWeapon, _turret];
|
_vehicle addWeaponTurret [_proxyWeapon, _turret];
|
||||||
_staticWeapon setVariable [format [QGVAR(proxyHandled_%1), _turret], true, true];
|
_vehicle setVariable [format [QGVAR(proxyHandled_%1), _turret], true, true];
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
/*
|
|
||||||
* Author: PabstMirror
|
|
||||||
* Gets sub actions for what the player can unload from the static weapon
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Target <OBJECT>
|
|
||||||
* 1: Player <OBJECT>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* Actions <ARRAY>
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [cursorObject, player] call ace_csw_fnc_reload_actionsUnload
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
|
|
||||||
params ["_vehicle", "_player"];
|
|
||||||
|
|
||||||
private _statement = {
|
|
||||||
params ["_target", "_player", "_params"];
|
|
||||||
_params params ["_vehMag", "_turretPath", "_carryMag"];
|
|
||||||
TRACE_5("starting unload",_target,_turretPath,_player,_carryMag,_vehMag);
|
|
||||||
|
|
||||||
private _timeToUnload = 1;
|
|
||||||
if (!isNull(configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime")) then {
|
|
||||||
_timeToUnload = getNumber(configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime");
|
|
||||||
};
|
|
||||||
|
|
||||||
[
|
|
||||||
TIME_PROGRESSBAR(_timeToUnload),
|
|
||||||
[_target, _turretPath, _player, _carryMag, _vehMag],
|
|
||||||
{
|
|
||||||
(_this select 0) params ["_target", "_turretPath", "", "_carryMag", "_vehMag"];
|
|
||||||
TRACE_5("unload progressBar finish",_target,_turretPath,_carryMag,_vehMag,_player);
|
|
||||||
[QGVAR(removeTurretMag), [_target, _turretPath, _carryMag, _vehMag, _player]] call CBA_fnc_globalEvent;
|
|
||||||
},
|
|
||||||
{TRACE_1("unload progressBar fail",_this);},
|
|
||||||
format [localize LSTRING(unloadX), getText (configFile >> "CfgMagazines" >> _carryMag >> "displayName")],
|
|
||||||
{(_this select 0) call FUNC(reload_canUnloadMagazine)},
|
|
||||||
["isNotInside"]
|
|
||||||
] call EFUNC(common,progressBar);
|
|
||||||
};
|
|
||||||
|
|
||||||
private _condition = {
|
|
||||||
params ["_target", "_player", "_params"];
|
|
||||||
_params params ["_vehMag", "_turretPath", "_carryMag"];
|
|
||||||
[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)
|
|
||||||
};
|
|
||||||
|
|
||||||
private _actions = [];
|
|
||||||
private _handeledMagTypes = [];
|
|
||||||
|
|
||||||
private _cfgMagazines = configFile >> "CfgMagazines";
|
|
||||||
|
|
||||||
// Go through magazines on static weapon and check if any are unloadable
|
|
||||||
{
|
|
||||||
_x params ["_xMag", "_xTurret", "_xAmmo"];
|
|
||||||
|
|
||||||
if ((_xAmmo > 0) && {!(_xMag in _handeledMagTypes)}) then {
|
|
||||||
_handeledMagTypes pushBack _xMag;
|
|
||||||
private _carryMag = _xMag call FUNC(getCarryMagazine);
|
|
||||||
if (_carryMag == "") exitWith {};
|
|
||||||
|
|
||||||
private _displayName = getText (_cfgMagazines >> _carryMag >> "displayName");
|
|
||||||
private _text = format [LLSTRING(unloadX), _displayName];
|
|
||||||
private _picture = getText (_cfgMagazines >> _carryMag >> "picture");
|
|
||||||
private _action = [format ["unload_%1", _forEachIndex], _text, _picture, _statement, _condition, {}, [_xMag, _xTurret, _carryMag]] call EFUNC(interact_menu,createAction);
|
|
||||||
_actions pushBack [_action, [], _vehicle];
|
|
||||||
};
|
|
||||||
} forEach (magazinesAllTurrets _vehicle);
|
|
||||||
|
|
||||||
TRACE_1("unloadActions",count _actions);
|
|
||||||
_actions
|
|
@ -21,5 +21,4 @@ params ["_target", "_unit"];
|
|||||||
&& {!alive (gunner _target)}
|
&& {!alive (gunner _target)}
|
||||||
&& {!(_target getVariable [QGVAR(fired), false])}
|
&& {!(_target getVariable [QGVAR(fired), false])}
|
||||||
&& {!(_target getVariable [QGVAR(sightAttached), ((typeOf _target) == QGVAR(staticAssembled))])}
|
&& {!(_target getVariable [QGVAR(sightAttached), ((typeOf _target) == QGVAR(staticAssembled))])}
|
||||||
&& EFUNC(csw,assemble_canPickupTripod)
|
&& EFUNC(csw,canPickupTripod)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user