Shtora

Principle Author:  Bakerman

Disclaimer. This module is still a work in progress and is likely to change. If you do decide to make use of this document then please revisit it after each release to stay up to date.

Disabling

For all units in a mission

To disable Shtora mission wide, add the following line to the mission init.sqf file:

RHS_SHTORA_ENABLED = false;

Alternatively when calling from a single machine the variable can be used as a global mission variable like so:

missionNamespace setVariable ["RHS_SHTORA_ENABLED", false, true];

For a specific vehicle

To disable the Shtora system of a specific vehicle the following should be placed in the init field of the unit or the mission init.sqf file:

// Replace 'this' with vehicle name if required
this setVariable ["RHS_SHTORA_ENABLED", false];  

API

Object variables

When enabled, the following object variables are available for 3rd party access:

// Dazzler state
RHS_SHTORA_DAZZLE = boolean;

// System state 
RHS_SHTORA_ENABLED = boolean; 

// System damaged
RHS_SHTORA_DAMAGED = boolean; 

// System turning turret state, can be used to tell when the system detected a threat
RHS_SHTORA_TURNING = boolean; 

// System mode, 0 = OFF | 1 = SEMI-AUTO | 2 = AUTO
RHS_SHTORA_MODE = scalar; 

Functions

The following function can be accessed to notify the system that it is being targeted, all other calls are made by the system:

// Call where gunner is local
[_target, _gunner, _projectile, _ammoClass] call RHS_fnc_shtoraDetect;

// Alternative shorter syntax
[_target, _gunner, objNull] call RHS_fnc_shtoraDetect;

// Example of a player pointing a laser at a target
[cursorTarget, player, objNull, "LaserRangefinder"] call RHS_fnc_shtoraDetect;

Events

For vehicles with SACLOS weapons the detection function should be called each time the weapon is fired. RHS uses a custom muzzle effect for this purpose:

// The following should go in a vehicle's cfgVehicle eventHandler class
// RHSUSF_fnc_effectFired is the alternative function for USAF dependency
fired = "_this call (uinamespace getvariable 'RHS_fnc_effectFired')"; 

// Alternatively event handler can be scripted on the fly
player addEventHandler ["Fired", {
  _this call (uinamespace getvariable 'RHS_fnc_effectFired')
}];

The next step is to flag the ammo as SACLOS and give it a special type in CfgAmmo:

// This function does periodic detection calls over the life time of the projectile
// RHSUSF_fnc_firedSaclosis is the alternative function for USAF dependency
rhs_muzzleEffect = "RHS_fnc_firedSaclos";

// This set the saclos type for future implementation, for now it should be set to 1
rhs_saclos = 1;