-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into move-camera-to-se…
…lection-cqb
- Loading branch information
Showing
13 changed files
with
203 additions
and
50 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
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
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,52 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: mharis001 | ||
* Makes the given unit watch the specified target. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Target <OBJECT|ARRAY> (default: objNull) | ||
* - When given objNull, the unit stops watching its current target. | ||
* - Positions must be in AGL format. | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_unit, _target] call zen_common_fnc_forceWatch | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull, []], 3]]; | ||
|
||
[QGVAR(doWatch), [[_unit, gunner _unit], _target], _unit] call CBA_fnc_targetEvent; | ||
|
||
// If an object is given, make the unit target the object in addition to watching it | ||
if (_target isEqualType objNull && {!isNull _target}) then { | ||
[QGVAR(doTarget), [[_unit, gunner _unit], _target], _unit] call CBA_fnc_targetEvent; | ||
}; | ||
|
||
// Make vehicles or units in vehicles watch target by locking their turret cameras onto it | ||
private _vehicle = vehicle _unit; | ||
|
||
if ( | ||
_unit isNotEqualTo _vehicle | ||
|| {_unit isKindOf "LandVehicle"} | ||
|| {_unit isKindOf "Air"} | ||
|| {_unit isKindOf "Ship"} | ||
) then { | ||
private _turretPaths = if (_unit isEqualTo _vehicle) then { | ||
_vehicle call FUNC(getAllTurrets) | ||
} else { | ||
[_vehicle unitTurret _unit] | ||
}; | ||
|
||
if (_target isEqualType []) then { | ||
_target = AGLToASL _target; | ||
}; | ||
|
||
{ | ||
[QGVAR(lockCameraTo), [_vehicle, _target, _x, false], _vehicle, _x] call CBA_fnc_turretEvent; | ||
} forEach _turretPaths; | ||
}; |
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
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
Oops, something went wrong.