ACE3/addons/irlight/functions/fnc_initItemContextMenu.sqf
BaerMitUmlaut d6faac5881
Add IR Flashlights (#6563)
* Initial IR flashlight tests

* More experiments

* Rewrite using engine IR lights

* Rework ranges, fix bugs, add docs

* Fix uncommented DISABLE_COMPILE_CACHE

Co-authored-by: jonpas <jonpas33@gmail.com>

* Markdown fixes

Co-authored-by: jonpas <jonpas33@gmail.com>

* Markdown fixes

Co-authored-by: jonpas <jonpas33@gmail.com>

* Markdown fixes

Co-authored-by: jonpas <jonpas33@gmail.com>

* Markdown fixes

Co-authored-by: jonpas <jonpas33@gmail.com>

* Markdown fixes

Co-authored-by: jonpas <jonpas33@gmail.com>

* Use baseWeapon instead of custom property

* Add baseWeapon to SPIR

---------

Co-authored-by: jonpas <jonpas33@gmail.com>
2023-09-17 09:32:39 +02:00

53 lines
1.4 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Initializes the item context menu for the DBAL.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_irlight_fnc_initItemContextMenu
*
* Public: No
*/
{
_x params ["_variant", "_displayName"];
[
"ACE_DBAL_A3_Red", "POINTER", _displayName, [], "", {
params ["", "", "_item", "", "_variant"];
private _baseClass = getText (configFile >> "CfgWeapons" >> _item >> "baseWeapon");
_item != _baseClass + _variant
}, {
params ["", "", "_item", "", "_variant"];
private _baseClass = getText (configFile >> "CfgWeapons" >> _item >> "baseWeapon");
ACE_player removePrimaryWeaponItem _item;
ACE_player addPrimaryWeaponItem (_baseClass + _variant);
playSound "click";
if (_turnedOn) then {
// Force update of flashlight
ACE_player action ["GunLightOff", ACE_player];
{
ACE_player action ["GunLightOn", ACE_player];
ACE_player action ["IRLaserOn", ACE_player];
} call CBA_fnc_execNextFrame;
};
}, false, _variant
] call CBA_fnc_addItemContextMenuOption;
} forEach [
["", LSTRING(Mode_IRDual)],
["_IP", LSTRING(Mode_IRPointer)],
["_II", LSTRING(Mode_IRIlluminator)],
["_VP", LSTRING(Mode_VisiblePointer)]
];