-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Toggle Laser keybind * Update addons/editor/stringtable.xml Co-authored-by: Jouni Järvinen <[email protected]> --------- Co-authored-by: Jouni Järvinen <[email protected]>
- Loading branch information
1 parent
f1653f1
commit d6f8e15
Showing
5 changed files
with
66 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
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
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,46 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: mharis001 | ||
* Sets the state (on/off) of the given vehicle turret's laser weapon. | ||
* | ||
* Arguments: | ||
* 0: Vehicle <OBJECT> | ||
* 1: State <BOOL> (default: nil) | ||
* - Toggles the laser's state when unspecified. | ||
* 2: Turret Path <ARRAY> (default: [0]) | ||
* - The primary gunner turret is used by default. | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_vehicle, true] call zen_common_fnc_setVehicleLaserState | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params [["_vehicle", objNull, [objNull]], ["_state", nil, [true]], ["_turretPath", [0], [[]]]]; | ||
|
||
if (!local _vehicle) exitWith { | ||
[QGVAR(setVehicleLaserState), _this, _vehicle] call CBA_fnc_targetEvent; | ||
}; | ||
|
||
// Exit if the laser is already turned on/off and we are not toggling it | ||
if (!isNil "_state" && {_vehicle isLaserOn _turretPath isEqualTo _state}) exitWith {}; | ||
|
||
// Find the correct magazine id and owner and force the laser weapon to fire | ||
{ | ||
_x params ["_xMagazine", "_xTurretPath", "_xAmmoCount", "_id", "_owner"]; | ||
|
||
if ( | ||
_turretPath isEqualTo _xTurretPath | ||
&& {_xAmmoCount > 0} | ||
&& { | ||
private _ammo = getText (configFile >> "CfgMagazines" >> _xMagazine >> "ammo"); | ||
private _ammoSimulation = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation"); | ||
_ammoSimulation == "laserDesignate" | ||
} | ||
) exitWith { | ||
_vehicle action ["UseMagazine", _vehicle, _vehicle turretUnit _turretPath, _owner, _id]; | ||
}; | ||
} forEach magazinesAllTurrets _vehicle; |
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
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