2015-07-02 23:53:26 +00:00
|
|
|
/*
|
2015-07-15 10:48:49 +00:00
|
|
|
* Author: SilentSpike
|
2015-08-08 11:24:49 +00:00
|
|
|
* Sets local client to the given spectator state (virtually)
|
2015-08-01 17:10:11 +00:00
|
|
|
* To physically handle a spectator see ace_spectator_fnc_stageSpectator
|
|
|
|
*
|
2015-08-08 11:24:49 +00:00
|
|
|
* Client will be able to communicate in ACRE/TFAR as appropriate
|
2015-08-01 17:10:11 +00:00
|
|
|
* The spectator interface will be opened/closed
|
2015-07-02 23:53:26 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-08 11:24:49 +00:00
|
|
|
* 0: Spectator state of local client <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-08-08 11:24:49 +00:00
|
|
|
* [true] call ace_spectator_fnc_setSpectator
|
2015-07-02 23:53:26 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-08 11:24:49 +00:00
|
|
|
params [["_set",true,[true]]];
|
2015-07-02 23:53:26 +00:00
|
|
|
|
2015-08-08 11:24:49 +00:00
|
|
|
// Only clients can be spectators
|
|
|
|
if !(hasInterface) exitWith {};
|
2015-07-09 20:20:09 +00:00
|
|
|
|
2015-08-03 20:38:44 +00:00
|
|
|
// Handle common addon audio
|
|
|
|
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};
|
2015-08-08 11:24:49 +00:00
|
|
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator};
|
2015-08-03 20:38:44 +00:00
|
|
|
|
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-08-08 11:24:49 +00:00
|
|
|
["close"] call FUNC(handleInterface);
|
2015-07-02 23:53:26 +00:00
|
|
|
};
|
|
|
|
|
2015-08-03 20:38:44 +00:00
|
|
|
// Mark spectator state for reference
|
|
|
|
GVAR(isSet) = _set;
|
2015-08-02 11:47:26 +00:00
|
|
|
|
2015-08-08 11:24:49 +00:00
|
|
|
["spectatorSet",[_set]] call EFUNC(common,localEvent);
|