mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e59f0ce822
Type 0 worked, but the mission didn't end when all players were killed. Type 1 didn't work because isPlayer isn't true for seagulls. So spectator virtual state is now entirely unassociated from objects in the game.
43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
/*
|
|
* Author: SilentSpike
|
|
* Sets local client to the given spectator state (virtually)
|
|
* To physically handle a spectator see ace_spectator_fnc_stageSpectator
|
|
*
|
|
* Client will be able to communicate in ACRE/TFAR as appropriate
|
|
* The spectator interface will be opened/closed
|
|
*
|
|
* Arguments:
|
|
* 0: Spectator state of local client <BOOL> <OPTIONAL>
|
|
*
|
|
* Return Value:
|
|
* None <NIL>
|
|
*
|
|
* Example:
|
|
* [true] call ace_spectator_fnc_setSpectator
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
params [["_set",true,[true]]];
|
|
|
|
// Only clients can be spectators
|
|
if !(hasInterface) exitWith {};
|
|
|
|
// 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};
|
|
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {[player, _set] call TFAR_fnc_forceSpectator};
|
|
|
|
if (_set) then {
|
|
["open"] call FUNC(handleInterface);
|
|
} else {
|
|
["close"] call FUNC(handleInterface);
|
|
};
|
|
|
|
// Mark spectator state for reference
|
|
GVAR(isSet) = _set;
|
|
|
|
["spectatorSet",[_set]] call EFUNC(common,localEvent);
|