ACE3/addons/irlight/functions/fnc_getGlowOffset.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

42 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Gets the player model offset of the IR laser origin.
* Currently unused, see onLightToggled.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_irlight_fnc_getGlowOffset
*
* Public: No
*/
if (isNil QGVAR(offsetCache)) then {
GVAR(offsetCache) = createHashMap;
};
private _weapon = currentWeapon ACE_player;
private _laser = ((weaponsItems ACE_player) select {_x#0 == _weapon})#0#2;
GVAR(offsetCache) getOrDefaultCall [[_weapon, _laser], {
private _model = getText (configFile >> "CfgWeapons" >> _weapon >> "model");
private _dummy = createSimpleObject [_model, [0, 0, 0], true];
private _proxyOffset = _dummy selectionPosition ["\a3\data_f\proxies\weapon_slots\SIDE.001", 1];
_proxyOffset = [_proxyOffset#1, _proxyOffset#0 * -1, _proxyOffset#2];
deleteVehicle _dummy;
_model = getText (configFile >> "CfgWeapons" >> _laser >> "model");
_dummy = createSimpleObject [_model, [0, 0, 0], true];
private _selection = getText (configFile >> "CfgWeapons" >> _laser >> "ItemInfo" >> "Pointer" >> "irLaserPos");
private _laserOffset = _dummy selectionPosition [_selection, "Memory"];
_laserOffset = [_laserOffset#1, _laserOffset#0 * -1, _laserOffset#2 * -1];
deleteVehicle _dummy;
_proxyOffset vectorAdd _laserOffset
}, true];