-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cd0b49
commit cf73b3f
Showing
15 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
z\ace\addons\irlight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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)); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class asdg_SlotInfo; | ||
class asdg_FrontSideRail: asdg_SlotInfo { | ||
class compatibleItems { | ||
ACE_acc_pointer_IR_flashlight = 1; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class SlotInfo; | ||
class PointerSlot: SlotInfo { | ||
compatibleItems[] += { | ||
"ACE_acc_pointer_IR_flashlight" | ||
}; | ||
}; | ||
|
||
class CfgWeapons { | ||
class ItemCore; | ||
class acc_pointer_IR: ItemCore { | ||
class ItemInfo; | ||
}; | ||
class ACE_acc_pointer_IR_flashlight: acc_pointer_IR { | ||
author = ECSTRING(common,ACETeam); | ||
displayName = "ACE IR flashlight"; // TODO: stringtable | ||
|
||
class ItemInfo: ItemInfo { | ||
class Flashlight { | ||
color[] = {180,160,130}; | ||
ambient[] = {0.9,0.81,0.7}; | ||
intensity = 100; // Brightness | ||
size = 1; // TODO: OwO what's this? | ||
innerAngle = 5; // Can't really tell if there are actually two cones? | ||
outerAngle = 10; | ||
coneFadeCoef = 8; // Higher value = sharper outline | ||
position = "laser pos"; | ||
direction = "laser dir"; | ||
useFlare = 1; | ||
flareSize = 1.4; | ||
flareMaxDistance = 100; | ||
dayLight = 0; | ||
scale[] = {0}; | ||
|
||
class Attentuation { | ||
start = 0; | ||
constant = 0.5; | ||
linear = 0.1; | ||
quadratic = 0.2; | ||
hardLimitStart = 27; | ||
hardLimitEnd = 34; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ace_irlight | ||
=================== | ||
|
||
Adds scripted IR flashlights. | ||
|
||
|
||
## Maintainers | ||
|
||
The people responsible for merging changes to this component or answering potential questions. | ||
|
||
- [BaerMitUmlaut](https://github.com/BaerMitUmlaut) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PREP(handleLoadoutChanged); | ||
PREP(updateWeaponLights); | ||
PREP(handleVisionModeChanged); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "script_component.hpp" | ||
|
||
// Make sure JIPs can see already turned on IR lights | ||
GVAR(units) = allPlayers select { | ||
_x getVariable [QGVAR(turnedOn), false] | ||
}; | ||
|
||
[FUNC(updateWeaponLights), 0, []] call CBA_fnc_addPerFrameHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
name = COMPONENT_NAME; | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = REQUIRED_VERSION; | ||
requiredAddons[] = {"ace_common"}; | ||
author = ECSTRING(common,ACETeam); | ||
authors[] = {"BaerMitUmlaut"}; | ||
url = ECSTRING(main,URL); | ||
VERSION_CONFIG; | ||
}; | ||
}; | ||
|
||
#include "CfgEventHandlers.hpp" | ||
#include "CfgJointRails.hpp" | ||
#include "CfgWeapons.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "script_component.hpp" | ||
// TODO: save if the current weapon has an ir flashlight capable attachment | ||
// isKindOf forEach attachment? config property? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "\z\ace\addons\irlight\script_component.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#define COMPONENT irlight | ||
#define COMPONENT_BEAUTIFIED IR Light | ||
#include "\z\ace\addons\main\script_mod.hpp" | ||
|
||
// #define DEBUG_MODE_FULL | ||
// #define DISABLE_COMPILE_CACHE | ||
// #define ENABLE_PERFORMANCE_COUNTERS | ||
|
||
#ifdef DEBUG_ENABLED_IRLIGHT | ||
#define DEBUG_MODE_FULL | ||
#endif | ||
|
||
#ifdef DEBUG_SETTINGS_IRLIGHT | ||
#define DEBUG_SETTINGS DEBUG_SETTINGS_IRLIGHT | ||
#endif | ||
|
||
#include "\z\ace\addons\main\script_macros.hpp" |