Skip to content

Commit

Permalink
Laser - Add a module to create constant laser source for testing (#10742
Browse files Browse the repository at this point in the history
)
  • Loading branch information
PabstMirror authored Feb 11, 2025
1 parent 6c0d013 commit 89b3d2b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
9 changes: 9 additions & 0 deletions addons/laser/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@ class CfgVehicles {
};
};
};
class ACE_Module;
class GVAR(testLaser): ACE_Module {
author = ECSTRING(common,ACETeam);
category = "ACE";
displayName = "[DEV] Laser Source (DOWN)";
function = QFUNC(laserModule);
scope = 2;
isGlobal = 1;
};
};
1 change: 1 addition & 0 deletions addons/laser/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PREP(findLaserSource);
PREP(getLaserCode);
PREP(handleLaserTargetCreation);
PREP(keyLaserCodeChange);
PREP(laserModule);
PREP(laserOff);
PREP(laserOn);
PREP(laserPointTrack);
Expand Down
2 changes: 1 addition & 1 deletion addons/laser/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ if (hasInterface) then {

// Shows detector and mine posistions in 3d when debug is on
#ifdef DRAW_LASER_INFO
addMissionEventHandler ["Draw3D", {_this call FUNC(dev_drawVisibleLaserTargets)}];
addMissionEventHandler ["Draw3D", {call FUNC(dev_drawVisibleLaserTargets)}];
#endif
36 changes: 36 additions & 0 deletions addons/laser/functions/fnc_laserModule.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Shoots a test laser down to the module position
*
* Arguments:
* 0: Module <OBJECT>
*
* Return Value:
* None
*
* Example:
* [m] call ace_laser_fnc_laserModule
*
* Public: No
*/

if (!hasInterface) exitWith {};
[{
params ["_module"];

private _laserMethod = {
params ["_module"];
private _povPos = (getPosASL _module) vectorAdd [0,0,100];
[_povPos, [0,0,-1]]
};
private _waveLength = _module getVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH];
private _laserCode = _module getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
private _beamSpread = _module getVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD];

private _uuid = format["laserModule%1%2", floor random 1000, floor random 10000];
private _args = [_uuid, [_module, _module, _laserMethod, _waveLength, _laserCode, _beamSpread, []]];

TRACE_2("Sending Laser On Event",_module,_args);
["ace_laserOn", _args] call CBA_fnc_localEvent;
}, _this] call CBA_fnc_execNextFrame;

0 comments on commit 89b3d2b

Please sign in to comment.