2015-07-02 23:53:26 +00:00
|
|
|
/*
|
2015-07-15 10:48:49 +00:00
|
|
|
* Author: SilentSpike
|
2015-08-01 17:10:11 +00:00
|
|
|
* Sets target unit to the given spectator state (virtually)
|
|
|
|
* To physically handle a spectator see ace_spectator_fnc_stageSpectator
|
|
|
|
*
|
|
|
|
* Units will be able to communicate in ACRE/TFAR as appropriate
|
|
|
|
* The spectator interface will be opened/closed
|
2015-07-02 23:53:26 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-07-09 20:20:09 +00:00
|
|
|
* 0: Unit to put into spectator state <OBJECT>
|
2015-08-01 17:10:11 +00:00
|
|
|
* 1: Spectator state <BOOL> <OPTIONAL>
|
2015-07-02 23:53:26 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-07-04 23:49:47 +00:00
|
|
|
* None <NIL>
|
2015-07-02 23:53:26 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-07-09 20:20:09 +00:00
|
|
|
* [player, true] call ace_spectator_fnc_setSpectator
|
2015-07-02 23:53:26 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-01 17:10:11 +00:00
|
|
|
params ["_unit", ["_set",true,[true]]];
|
2015-07-02 23:53:26 +00:00
|
|
|
|
2015-07-09 20:20:09 +00:00
|
|
|
// Only run for player units
|
|
|
|
if !(isPlayer _unit) exitWith {};
|
|
|
|
|
|
|
|
if !(local _unit) exitwith {
|
|
|
|
[[_unit, _set, _target], QFUNC(setSpectator), _unit] call EFUNC(common,execRemoteFnc);
|
|
|
|
};
|
|
|
|
|
2015-07-02 23:53:26 +00:00
|
|
|
if (_set) then {
|
2015-07-15 11:03:54 +00:00
|
|
|
["open"] call FUNC(handleInterface);
|
2015-07-02 23:53:26 +00:00
|
|
|
} else {
|
2015-07-15 11:03:54 +00:00
|
|
|
["close"] call FUNC(handleInterface);
|
2015-07-02 23:53:26 +00:00
|
|
|
};
|
|
|
|
|
2015-07-03 12:13:02 +00:00
|
|
|
// Handle common addon audio
|
2015-07-04 18:41:18 +00:00
|
|
|
if (["ace_hearing"] call EFUNC(common,isModLoaded)) then {EGVAR(hearing,disableVolumeUpdate) = _set};
|
|
|
|
if (["acre_sys_radio"] call EFUNC(common,isModLoaded)) then {[_set] call acre_api_fnc_setSpectator};
|
|
|
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[_unit, _set] call TFAR_fnc_forceSpectator};
|
2015-07-03 12:13:02 +00:00
|
|
|
|
2015-08-01 17:10:11 +00:00
|
|
|
["spectatorSet",[_set]] call EFUNC(common,localEvent);
|