mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add action to get into jdam settings
This commit is contained in:
parent
73980337b7
commit
6cfc0754d8
@ -74,4 +74,5 @@ PREP(gps_modeSelect);
|
||||
PREP(gps_saveAttackSettings);
|
||||
PREP(gps_loadAttackSettings);
|
||||
PREP(gps_getAttackData);
|
||||
PREP(gps_setupVehicle);
|
||||
|
||||
|
@ -14,3 +14,19 @@
|
||||
|
||||
GVAR(dev_fnc_projectileCamera) = compile preprocessFileLineNumbers QPATHTOF(dev\projectileCamera.sqf);
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
["ace_settingsInitialized", {
|
||||
["turret", LINKFUNC(gps_setupVehicle), false] call CBA_fnc_addPlayerEventHandler;
|
||||
["vehicle", LINKFUNC(gps_setupVehicle), true] call CBA_fnc_addPlayerEventHandler; // only one of these needs the retro flag
|
||||
|
||||
// Add UAV Control Compatibility
|
||||
["ACE_controlledUAV", {
|
||||
params ["_UAV", "_seatAI", "_turret", "_position"];
|
||||
TRACE_4("ACE_controlledUAV EH",_UAV,_seatAI,_turret,_position);
|
||||
if (!isNull _seatAI) then {
|
||||
[_seatAI] call FUNC(gps_setupVehicle);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
@ -20,5 +20,11 @@ if (GVAR(gps_mode) isEqualTo "too") then {
|
||||
_target params ["_tracking", "_position", "_object"];
|
||||
GVAR(gps_currentSettings) set [0, _position]
|
||||
};
|
||||
GVAR(gps_currentSettings)
|
||||
|
||||
// create a copy of this array to make sure values are not overwritten
|
||||
[
|
||||
GVAR(gps_currentSettings)#0,
|
||||
GVAR(gps_currentSettings)#1,
|
||||
GVAR(gps_currentSettings)#2
|
||||
]
|
||||
|
||||
|
@ -15,4 +15,4 @@
|
||||
* Public: No
|
||||
*/
|
||||
[GVAR(gps_uiPerFrameHandler)] call CBA_fnc_removePerFrameHandler;
|
||||
systemChat "unload";
|
||||
|
||||
|
52
addons/missileguidance/functions/fnc_gps_setupVehicle.sqf
Normal file
52
addons/missileguidance/functions/fnc_gps_setupVehicle.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brandon (TCVM)
|
||||
* Adds interaction menu actions to configure GPS bombs
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Player <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_missileguidance_fnc_gps_setupVehicle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params ["_player"];
|
||||
|
||||
private _vehicle = vehicle _player;
|
||||
private _turretPath = [-1];
|
||||
|
||||
if (_vehicle getVariable [QGVAR(gps_actionsAdded), false]) exitWith {};
|
||||
_vehicle setVariable [QGVAR(gps_actionsAdded), true];
|
||||
|
||||
private _condition = {
|
||||
params ["_target", "_player"];
|
||||
|
||||
private _turretPath = if (ACE_player == (driver _target)) then {[-1]} else {ACE_player call CBA_fnc_turretPath};
|
||||
private _hasJDAM = false;
|
||||
{
|
||||
private _magazines = getArray (configFile >> "CfgWeapons" >> _x >> "magazines");
|
||||
{
|
||||
private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
|
||||
private _ammoAttackProfiles = getArray (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON) >> "attackProfiles");
|
||||
_hasJDAM = "JDAM" in _ammoAttackProfiles;
|
||||
|
||||
if (_hasJDAM) exitWith { true };
|
||||
} forEach _magazines;
|
||||
|
||||
if (_hasJDAM) exitWith { true };
|
||||
} forEach (_target weaponsTurret _turretPath);
|
||||
|
||||
_hasJDAM
|
||||
};
|
||||
|
||||
private _statement = {
|
||||
createDialog QGVAR(gpsAttackOptionsUI);
|
||||
};
|
||||
|
||||
private _action = [QUOTE(ADDON), "JDAM settings", "", _statement, _condition] call EFUNC(interact_menu,createAction);
|
||||
[_vehicle, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToObject);
|
||||
|
Loading…
Reference in New Issue
Block a user