Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laser - Public getter and setter for laser codes #9772

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addons/laser/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PREP(addLaserTarget);
PREP(addMapHandler);
PREP(dev_drawVisibleLaserTargets);
PREP(findLaserSource);
PREP(getLaserCode);
PREP(handleLaserTargetCreation);
PREP(keyLaserCodeChange);
PREP(laserOff);
Expand All @@ -13,6 +14,7 @@ PREP(onLaserDesignatorDraw);
PREP(rotateVectLine);
PREP(rotateVectLineGetMap);
PREP(seekerFindLaserSpot);
PREP(setLaserCode);
PREP(shootCone);
PREP(shootRay);
PREP(showVehicleHud);
Expand Down
20 changes: 20 additions & 0 deletions addons/laser/functions/fnc_getLaserCode.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "..\script_component.hpp"
/*
* Author: johnb43
* Gets the laser code of a laser source.
*
* Argument:
* 0: Laser source <OBJECT>
*
* Return Value:
* Laser code <NUMBER>
*
* Example:
* player call ace_laser_fnc_getLaserCode;
*
* Public: Yes
*/

params ["_laserSource"];
johnb432 marked this conversation as resolved.
Show resolved Hide resolved

_laserSource getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]
21 changes: 21 additions & 0 deletions addons/laser/functions/fnc_setLaserCode.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: johnb43
* Sets the laser code on a laser source.
*
* Argument:
* 0: Laser source <OBJECT>
* 1: Laser code <NUMBER>
*
* Return Value:
* None
*
* Example:
* [player, 1111] call ace_laser_fnc_setLaserCode;
*
* Public: Yes
*/

params ["_laserSource", "_laserCode"];

_laserSource setVariable [QGVAR(code), _laserCode, true];
34 changes: 34 additions & 0 deletions docs/wiki/framework/laser-framework.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
layout: wiki
title: Laser
description: Explains the functions available for laser designators.
group: framework
order: 5
parent: wiki
mod: ace
version:
major: 3
minor: 16
patch: 4
---

## 1. Scripting

### 1.1. Get object's laser code

`ace_laser_fnc_getLaserCode`

| | Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Unit/Vehicle | Object | Required
**R** | Laser code | Number | Return value

### 1.2. Set object's laser code

`ace_laser_fnc_setLaserCode`

| | Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Unit/Vehicle | Object | Required
1 | Laser code | Number | Required
**R** | None | None | Return value
Loading