diff --git a/addons/irlight/CfgEventHandlers.hpp b/addons/irlight/CfgEventHandlers.hpp index 0d3301d6e0a..b0cc92b5137 100644 --- a/addons/irlight/CfgEventHandlers.hpp +++ b/addons/irlight/CfgEventHandlers.hpp @@ -1,15 +1,3 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); - }; -}; - class Extended_PostInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_postInit)); diff --git a/addons/irlight/CfgJointRails.hpp b/addons/irlight/CfgJointRails.hpp index e3fc4ed6ffd..99ff2860383 100644 --- a/addons/irlight/CfgJointRails.hpp +++ b/addons/irlight/CfgJointRails.hpp @@ -1,6 +1,16 @@ class asdg_SlotInfo; class asdg_FrontSideRail: asdg_SlotInfo { class compatibleItems { - ACE_acc_pointer_IR_flashlight = 1; + ACE_DBAL_A3_Red = 1; + ACE_DBAL_A3_Red_IP = 1; + ACE_DBAL_A3_Red_II = 1; + ACE_DBAL_A3_Red_VP = 1; + ACE_DBAL_A3_Green = 1; + ACE_DBAL_A3_Green_IP = 1; + ACE_DBAL_A3_Green_II = 1; + ACE_DBAL_A3_Green_VP = 1; + ACE_SPIR = 1; + ACE_SPIR_Medium = 1; + ACE_SPIR_Narrow = 1; }; }; diff --git a/addons/irlight/CfgWeapons.hpp b/addons/irlight/CfgWeapons.hpp index 4e572cffefa..fe8cb7d1faa 100644 --- a/addons/irlight/CfgWeapons.hpp +++ b/addons/irlight/CfgWeapons.hpp @@ -1,18 +1,32 @@ class SlotInfo; class PointerSlot: SlotInfo { compatibleItems[] += { - "ACE_acc_pointer_IR_flashlight", - "ACE_acc_pointer_IR_flashlight2", - "ACE_acc_pointer_IR_flashlight3", - "ACE_acc_pointer_IR_flashlight4" + "ACE_DBAL_A3_Red", + "ACE_DBAL_A3_Red_IP", + "ACE_DBAL_A3_Red_II", + "ACE_DBAL_A3_Red_VP", + "ACE_DBAL_A3_Green", + "ACE_DBAL_A3_Green_IP", + "ACE_DBAL_A3_Green_II", + "ACE_DBAL_A3_Green_VP", + "ACE_SPIR", + "ACE_SPIR_Medium", + "ACE_SPIR_Narrow" }; }; class PointerSlot_Rail: PointerSlot { class compatibleItems { - ACE_acc_pointer_IR_flashlight = 1; - ACE_acc_pointer_IR_flashlight2 = 1; - ACE_acc_pointer_IR_flashlight3 = 1; - ACE_acc_pointer_IR_flashlight4 = 1; + ACE_DBAL_A3_Red = 1; + ACE_DBAL_A3_Red_IP = 1; + ACE_DBAL_A3_Red_II = 1; + ACE_DBAL_A3_Red_VP = 1; + ACE_DBAL_A3_Green = 1; + ACE_DBAL_A3_Green_IP = 1; + ACE_DBAL_A3_Green_II = 1; + ACE_DBAL_A3_Green_VP = 1; + ACE_SPIR = 1; + ACE_SPIR_Medium = 1; + ACE_SPIR_Narrow = 1; }; }; @@ -21,121 +35,248 @@ class CfgWeapons { class acc_pointer_IR: ItemCore { class ItemInfo; }; - class ACE_acc_pointer_IR_flashlight: acc_pointer_IR { + + class acc_flashlight: ItemCore { + class ItemInfo; + }; + + // DBAL A3 (red pointer) + class ACE_DBAL_A3_Red: acc_pointer_IR { author = ECSTRING(common,ACETeam); - displayName = "ACE IR flashlight"; // TODO: stringtable + displayName = CSTRING(DBAL_A3_Red); + descriptionUse = CSTRING(DBAL_A3_DescriptionUse); + descriptionShort = CSTRING(DBAL_A3_DescriptionShort); + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Red_IP"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Red_VP"; + MRT_SwitchItemHintText = CSTRING(Mode_IRDual); class ItemInfo: ItemInfo { class Flashlight { - color[] = {180,160,130}; - ambient[] = {0.9,0.81,0.7}; - intensity = 5000; // Brightness - size = 1; // TODO: OwO what's this? - innerAngle = 10; // Can't really tell if there are actually two cones? + color[] = {1, 1, 1, 1}; + ambient[] = {1, 1, 1, 1}; + size = 1; + innerAngle = 10; outerAngle = 12; - coneFadeCoef = 2; // Higher value = sharper outline position = "laser pos"; direction = "laser dir"; useFlare = 1; flareSize = 1.4; - flareMaxDistance = 100; - dayLight = 0; + flareMaxDistance = 200; scale[] = {0}; + coneFadeCoef = 6; + intensity = 100; + irLight = 1; - class Attentuation { - start = 0; - constant = 0.5; - linear = 0.1; - quadratic = 0.1; - hardLimitStart = 500; - hardLimitEnd = 600; + class Attenuation { + constant = 1; + linear = 0; + quadratic = 0; + start = 500; + hardLimitStart = 1; + hardLimitEnd = 500; }; }; }; }; - class ACE_acc_pointer_IR_flashlight2: acc_pointer_IR { + + class ACE_DBAL_A3_Red_IP: ACE_DBAL_A3_Red { + scope = 1; + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Red_II"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Red"; + MRT_SwitchItemHintText = CSTRING(Mode_IRPointer); + + class ItemInfo: ItemInfo { + class Flashlight {}; + }; + }; + + class ACE_DBAL_A3_Red_II: ACE_DBAL_A3_Red { + scope = 1; + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Red_VP"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Red_IP"; + MRT_SwitchItemHintText = CSTRING(Mode_IRIlluminator); + + class ItemInfo: ItemInfo { + class Pointer {}; + }; + }; + + class ACE_DBAL_A3_Red_VP: ACE_DBAL_A3_Red { + scope = 1; + ACE_laserpointer = 1; + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Red"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Red_II"; + MRT_SwitchItemHintText = CSTRING(Mode_VisiblePointer); + + class ItemInfo: ItemInfo { + class Pointer {}; + class Flashlight: Flashlight { + color[] = {0, 0, 0, 0}; + ambient[] = {0, 0, 0, 0}; + size = 0; + innerAngle = 0; + outerAngle = 0; + useFlare = 0; + intensity = 0; + irLight = 0; + + class Attenuation: Attenuation { + hardLimitStart = 0; + hardLimitEnd = 0; + }; + }; + }; + }; + + // DBAL A3 (green pointer) + class ACE_DBAL_A3_Green: ACE_DBAL_A3_Red { + scope = 2; + displayName = CSTRING(DBAL_A3_Green); + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Green_IP"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Green_VP"; + MRT_SwitchItemHintText = CSTRING(Mode_IRDual); + }; + + class ACE_DBAL_A3_Green_IP: ACE_DBAL_A3_Red_IP { + scope = 1; + displayName = CSTRING(DBAL_A3_Green); + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Green_II"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Green"; + MRT_SwitchItemHintText = CSTRING(Mode_IRPointer); + }; + + class ACE_DBAL_A3_Green_II: ACE_DBAL_A3_Red_II { + scope = 1; + displayName = CSTRING(DBAL_A3_Green); + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Green_VP"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Green_IP"; + MRT_SwitchItemHintText = CSTRING(Mode_IRIlluminator); + }; + + class ACE_DBAL_A3_Green_VP: ACE_DBAL_A3_Red_VP { + scope = 1; + displayName = CSTRING(DBAL_A3_Green); + ACE_laserpointer = 2; + + MRT_SwitchItemNextClass = "ACE_DBAL_A3_Green"; + MRT_SwitchItemPrevClass = "ACE_DBAL_A3_Green_II"; + MRT_SwitchItemHintText = CSTRING(Mode_VisiblePointer); + }; + + // SPIR + class ACE_SPIR: acc_flashlight { + author = ECSTRING(common,ACETeam); + displayName = "SPIR"; + descriptionUse = CSTRING(SPIR_DescriptionUse); + descriptionShort = CSTRING(SPIR_DescriptionShort); + + MRT_SwitchItemNextClass = "ACE_SPIR_Medium"; + MRT_SwitchItemPrevClass = "ACE_SPIR_Narrow"; + MRT_SwitchItemHintText = CSTRING(Mode_Wide); + class ItemInfo: ItemInfo { class Flashlight { - color[] = {180,160,130}; - ambient[] = {0.9,0.81,0.7}; - intensity = 5000; // Brightness - size = 1; // TODO: OwO what's this? - innerAngle = 10; // Can't really tell if there are actually two cones? - outerAngle = 12; - coneFadeCoef = 4; // Higher value = sharper outline - position = "laser pos"; - direction = "laser dir"; + color[] = {1, 1, 1, 1}; + ambient[] = {1, 1, 1, 1}; + size = 1; + innerAngle = 25; + outerAngle = 32; + position = "flash dir"; + direction = "flash"; useFlare = 1; flareSize = 1.4; - flareMaxDistance = 100; - dayLight = 0; + flareMaxDistance = 200; scale[] = {0}; + coneFadeCoef = 6; + intensity = 100; + irLight = 1; - class Attentuation { - start = 0; - constant = 0.5; - linear = 0.1; - quadratic = 0.1; - hardLimitStart = 500; - hardLimitEnd = 600; + class Attenuation { + constant = 1; + linear = 0; + quadratic = 0; + start = 200; + hardLimitStart = 1; + hardLimitEnd = 200; }; }; }; }; - class ACE_acc_pointer_IR_flashlight3: acc_pointer_IR { + + class ACE_SPIR_Medium: ACE_SPIR { + scope = 1; + + MRT_SwitchItemNextClass = "ACE_SPIR_Narrow"; + MRT_SwitchItemPrevClass = "ACE_SPIR"; + MRT_SwitchItemHintText = CSTRING(Mode_Medium); + class ItemInfo: ItemInfo { class Flashlight { - color[] = {180,160,130}; - ambient[] = {0.9,0.81,0.7}; - intensity = 5000; // Brightness - size = 1; // TODO: OwO what's this? - innerAngle = 10; // Can't really tell if there are actually two cones? - outerAngle = 12; - coneFadeCoef = 6; // Higher value = sharper outline - position = "laser pos"; - direction = "laser dir"; + color[] = {1, 1, 1, 1}; + ambient[] = {1, 1, 1, 1}; + size = 1; + position = "flash dir"; + direction = "flash"; useFlare = 1; flareSize = 1.4; - flareMaxDistance = 100; - dayLight = 0; + flareMaxDistance = 200; scale[] = {0}; + coneFadeCoef = 6; + intensity = 100; + irLight = 1; + innerAngle = 10; + outerAngle = 12; - class Attentuation { - start = 0; - constant = 0.5; - linear = 0.1; - quadratic = 0.1; - hardLimitStart = 500; - hardLimitEnd = 600; + class Attenuation { + constant = 1; + linear = 0; + quadratic = 0; + hardLimitStart = 1; + start = 350; + hardLimitEnd = 350; }; }; }; }; - class ACE_acc_pointer_IR_flashlight4: acc_pointer_IR { + + class ACE_SPIR_Narrow: ACE_SPIR { + scope = 1; + + MRT_SwitchItemNextClass = "ACE_SPIR"; + MRT_SwitchItemPrevClass = "ACE_SPIR_Medium"; + MRT_SwitchItemHintText = CSTRING(Mode_Narrow); + class ItemInfo: ItemInfo { class Flashlight { - color[] = {180,160,130}; - ambient[] = {0.9,0.81,0.7}; - intensity = 5000; // Brightness - size = 1; // TODO: OwO what's this? - innerAngle = 10; // Can't really tell if there are actually two cones? - outerAngle = 12; - coneFadeCoef = 8; // Higher value = sharper outline - position = "laser pos"; - direction = "laser dir"; + color[] = {1, 1, 1, 1}; + ambient[] = {1, 1, 1, 1}; + size = 1; + position = "flash dir"; + direction = "flash"; useFlare = 1; flareSize = 1.4; - flareMaxDistance = 100; - dayLight = 0; + flareMaxDistance = 200; scale[] = {0}; + coneFadeCoef = 6; + intensity = 100; + irLight = 1; + innerAngle = 5; + outerAngle = 6; - class Attentuation { - start = 0; - constant = 0.5; - linear = 0.1; - quadratic = 0.1; - hardLimitStart = 500; - hardLimitEnd = 600; + class Attenuation { + constant = 1; + linear = 0; + quadratic = 0; + hardLimitStart = 1; + start = 500; + hardLimitEnd = 500; }; }; }; diff --git a/addons/irlight/README.md b/addons/irlight/README.md index 1ad38174d9d..c92d5e0f848 100644 --- a/addons/irlight/README.md +++ b/addons/irlight/README.md @@ -1,7 +1,7 @@ ace_irlight =================== -Adds scripted IR flashlights. +Adds IR flashlights. ## Maintainers diff --git a/addons/irlight/XEH_PREP.hpp b/addons/irlight/XEH_PREP.hpp deleted file mode 100644 index 79c749d3380..00000000000 --- a/addons/irlight/XEH_PREP.hpp +++ /dev/null @@ -1,3 +0,0 @@ -PREP(handleLoadoutChanged); -PREP(updateWeaponLights); -PREP(handleVisionModeChanged); diff --git a/addons/irlight/XEH_postInit.sqf b/addons/irlight/XEH_postInit.sqf index 42b8d314d88..b7fd6226f90 100644 --- a/addons/irlight/XEH_postInit.sqf +++ b/addons/irlight/XEH_postInit.sqf @@ -1,8 +1,49 @@ #include "script_component.hpp" -// Make sure JIPs can see already turned on IR lights -GVAR(units) = allPlayers select { - _x getVariable [QGVAR(turnedOn), false] -}; +{ + _x params ["_variant", "_displayName"]; -[FUNC(updateWeaponLights), 0, []] call CBA_fnc_addPerFrameHandler; + [ + "ACE_DBAL_A3_Red", "POINTER", _displayName, [], "", { + params ["", "", "_item", "", "_variant"]; + + private _baseClass = if (_item select [0, 15] == "ACE_DBAL_A3_Red") then { + "ACE_DBAL_A3_Red" + } else { + "ACE_DBAL_A3_Green" + }; + + _item != _baseClass + _variant + }, { + params ["", "", "_item", "", "_variant"]; + + private _baseClass = if (_item select [0, 15] == "ACE_DBAL_A3_Red") then { + "ACE_DBAL_A3_Red" + } else { + "ACE_DBAL_A3_Green" + }; + + private _turnedOn = ACE_player isFlashlightOn primaryWeapon ACE_player + || ACE_player isIRLaserOn primaryWeapon ACE_player; + + 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)] +]; diff --git a/addons/irlight/XEH_preInit.sqf b/addons/irlight/XEH_preInit.sqf deleted file mode 100644 index a52f51f2a8f..00000000000 --- a/addons/irlight/XEH_preInit.sqf +++ /dev/null @@ -1,27 +0,0 @@ -#include "script_component.hpp" - -ADDON = false; - -PREP_RECOMPILE_START; -#include "XEH_PREP.hpp" -PREP_RECOMPILE_END; - -// List of units with an enabled IR light -GVAR(units) = []; - -[QGVAR(switchedLight), { - params ["_unit", "_lightOn"]; - - if (_lightOn) then { - _unit action ["GunLightOn", _unit]; - GVAR(units) pushBack _unit; - } else { - _unit action ["GunLightOff", _unit]; - GVAR(units) deleteAt (GVAR(units) find _unit); - }; -}] call CBA_fnc_addEventHandler; - -["loadout", FUNC(handleLoadoutChanged)] call CBA_fnc_addPlayerEventHandler; -["visionMode", FUNC(handleVisionModeChanged)] call CBA_fnc_addPlayerEventHandler; - -ADDON = true; diff --git a/addons/irlight/XEH_preStart.sqf b/addons/irlight/XEH_preStart.sqf deleted file mode 100644 index 022888575ed..00000000000 --- a/addons/irlight/XEH_preStart.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" - -#include "XEH_PREP.hpp" diff --git a/addons/irlight/config.cpp b/addons/irlight/config.cpp index 167d51d15a5..aa2dc8806c4 100644 --- a/addons/irlight/config.cpp +++ b/addons/irlight/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; + requiredAddons[] = {"ace_common", "ace_laserpointer"}; author = ECSTRING(common,ACETeam); authors[] = {"BaerMitUmlaut"}; url = ECSTRING(main,URL); diff --git a/addons/irlight/functions/fnc_handleLoadoutChanged.sqf b/addons/irlight/functions/fnc_handleLoadoutChanged.sqf deleted file mode 100644 index 5a249578a5a..00000000000 --- a/addons/irlight/functions/fnc_handleLoadoutChanged.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" -// TODO: save if the current weapon has an ir flashlight capable attachment -// isKindOf forEach attachment? config property? diff --git a/addons/irlight/functions/fnc_handleVisionModeChanged.sqf b/addons/irlight/functions/fnc_handleVisionModeChanged.sqf deleted file mode 100644 index ddc752e4645..00000000000 --- a/addons/irlight/functions/fnc_handleVisionModeChanged.sqf +++ /dev/null @@ -1,13 +0,0 @@ -#include "script_component.hpp" - -// Manually update weapon lights once for instant change -// TODO: Check if still necessary? -if (IN_NVGS) then { - { - _x action ["GunLightOn", _x]; - } forEach GVAR(units); -} else { - { - _x action ["GunLightOff", _x]; - } forEach GVAR(units); -}; diff --git a/addons/irlight/functions/fnc_updateWeaponLights.sqf b/addons/irlight/functions/fnc_updateWeaponLights.sqf deleted file mode 100644 index 53fe3444075..00000000000 --- a/addons/irlight/functions/fnc_updateWeaponLights.sqf +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Author: BaerMitUmlaut - * Makes the IR weapon lights visible depending on wether the player wears NVGs or not. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * [] call ace_irlight_fnc_updateWeaponLights - * - * Public: No - */ -#include "script_component.hpp" - -private _hasIRLight = "ACE_acc_pointer_IR_flashlight" in primaryWeaponItems ACE_player; -private _isLightOn = ACE_player isFlashlightOn primaryWeapon ACE_player; -private _synchedOn = ACE_player getVariable [QGVAR(turnedOn), false]; -private _inNVGS = IN_NVGS; - -// Detect if player switched light on or off -if (_hasIRLight) then { - if (_inNVGS) then { - // Synch weapon light state with virtual state - if !(_isLightOn isEqualTo _synchedOn) then { - [QGVAR(switchedLight), [ACE_player, _isLightOn]] call CBA_fnc_globalEvent; - ACE_player setVariable [QGVAR(turnedOn), _isLightOn, true]; - }; - } else { - // No NVGs, but light is on - // -> player pressed the weapon light button - // -> switch light status - if (_isLightOn) then { - [QGVAR(switchedLight), [ACE_player, !_synchedOn]] call CBA_fnc_globalEvent; - ACE_player setVariable [QGVAR(turnedOn), !_synchedOn, true]; - }; - }; -}; - -// Override weapon light of all units with enabled IR light -if (_inNVGS) then { - { - _x action ["GunLightOn", _x]; - } forEach GVAR(units); -} else { - { - _x action ["GunLightOff", _x]; - } forEach GVAR(units); -}; diff --git a/addons/irlight/functions/script_component.hpp b/addons/irlight/functions/script_component.hpp deleted file mode 100644 index 3dab1f1e8ef..00000000000 --- a/addons/irlight/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\irlight\script_component.hpp" diff --git a/addons/irlight/script_component.hpp b/addons/irlight/script_component.hpp index c4c04f2c55c..d742691d782 100644 --- a/addons/irlight/script_component.hpp +++ b/addons/irlight/script_component.hpp @@ -15,5 +15,3 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define IN_NVGS (currentVisionMode ACE_player == 1) diff --git a/addons/irlight/stringtable.xml b/addons/irlight/stringtable.xml new file mode 100644 index 00000000000..a326e83bd54 --- /dev/null +++ b/addons/irlight/stringtable.xml @@ -0,0 +1,57 @@ + + + + + DBAL A3 (red) + DBAL A3 (rot) + + + DBAL A3 (green) + DBAL A3 (grĂ¼n) + + + <t color='#9cf953'>Use: </t>Turn Laser ON/OFF<br>Double click to switch mode + <t color='#9cf953'>Benutzen: </t>Laser EIN/AUS<br>Doppelklick um Modus zu wechseln + + + Dual Beam Aiming Laser + Doppelstrahllaservisier + + + Visible Laser + Sichtbarer Laser + + + IR Laser + IR-Laser + + + IR Illuminator + IR-Taschenlampe + + + IR Laser and Illuminator + IR-Laser und -Licht + + + Wide Beam + Breiter Lichtstrahl + + + Medium Beam + Mittlerer Lichtstrahl + + + Narrow Beam + Schmaler Lichtstrahl + + + <t color='#9cf953'>Use: </t>Turn Light ON/OFF<br>Double click to switch mode + <t color='#9cf953'>Benutzen: </t>Licht EIN/AUS<br>Doppelklick um Modus zu wechseln + + + Special Purpose IR LED Illuminator + Infrarot LED Taschenlampe + + +