mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Seamlessly integrates the spectator system with the vanilla respawn framework when the onDeath setting is enabled. This commit makes a lot of changes: - Edit BI functions used by the vanilla respawn framework to enable support for ace_spectator. - Set spectator state is now tracked using a GVAR for the local player since using a unit won't be reliable all of the time. However unit is still marked for any filtering purposes. - Instead of NV being used based on the sun to moon transition state by default, that functionality only takes place in the integrated system so that custom frameworks can do what they want. - Seagull units are hidden when using framework integration since they're spawned by the engine with respawn type 1 and they just hang around undesirably
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
/*
|
|
* Author: SilentSpike
|
|
* Sets target player to the given spectator state (virtually)
|
|
* To physically handle a spectator see ace_spectator_fnc_stageSpectator
|
|
*
|
|
* Player will be able to communicate in ACRE/TFAR as appropriate
|
|
* The spectator interface will be opened/closed
|
|
*
|
|
* Arguments:
|
|
* 0: Unit to put into spectator state <OBJECT>
|
|
* 1: Spectator state <BOOL> <OPTIONAL>
|
|
*
|
|
* Return Value:
|
|
* None <NIL>
|
|
*
|
|
* Example:
|
|
* [player, true] call ace_spectator_fnc_setSpectator
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
params ["_unit", ["_set",true,[true]]];
|
|
|
|
// Only run for player units
|
|
if !(isPlayer _unit) exitWith {};
|
|
|
|
if !(local _unit) exitwith {
|
|
[[_unit, _set], QFUNC(setSpectator), _unit] call EFUNC(common,execRemoteFnc);
|
|
};
|
|
|
|
// 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 {[_unit, _set] call TFAR_fnc_forceSpectator};
|
|
|
|
if (_set) then {
|
|
["open"] call FUNC(handleInterface);
|
|
} else {
|
|
["close",_unit] call FUNC(handleInterface);
|
|
};
|
|
|
|
// Mark spectator state for reference
|
|
_unit setVariable [QGVAR(isSet), _set, true];
|
|
GVAR(isSet) = _set;
|
|
|
|
["spectatorSet",[_set,_unit]] call EFUNC(common,localEvent);
|