mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add API parameter to allow for unforced spectator
Adds an optional boolean paremeter to the setSpectator function for forcing the interface. It is forced by default, so if `false` is passed as the value the spectator will be able to close the interface with the escape button.
This commit is contained in:
parent
1fdedb5785
commit
0beaa40fbc
@ -7,7 +7,8 @@
|
||||
* The spectator interface will be opened/closed
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Spectator state of local client <BOOL> <OPTIONAL>
|
||||
* 0: Spectator state of local client <BOOL> (default: true)
|
||||
* 1: Force interface <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
@ -20,7 +21,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_set",true,[true]]];
|
||||
params [["_set",true,[true]], ["_force",true,[true]]];
|
||||
|
||||
// Only clients can be spectators
|
||||
if (!hasInterface) exitWith {};
|
||||
@ -75,7 +76,17 @@ if (_set) then {
|
||||
[{
|
||||
// Create the display
|
||||
(findDisplay 46) createDisplay QGVAR(interface);
|
||||
}, []] call EFUNC(common,execNextFrame);
|
||||
|
||||
// If not forced, make esc end spectator
|
||||
if (_this) then {
|
||||
(findDisplay 12249) displayAddEventHandler ["KeyDown", {
|
||||
if (_this select 1 == 1) then {
|
||||
[false] call ace_spectator_fnc_setSpectator;
|
||||
true
|
||||
};
|
||||
}];
|
||||
};
|
||||
}, !_force] call EFUNC(common,execNextFrame);
|
||||
|
||||
// Cache and disable nametag settings
|
||||
if (["ace_nametags"] call EFUNC(common,isModLoaded)) then {
|
||||
|
Loading…
Reference in New Issue
Block a user