mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
New function to precisely control spectatable sides
This commit is contained in:
parent
69d1db2872
commit
7107514b05
@ -18,11 +18,13 @@ PREP(setSpectator);
|
||||
PREP(transitionCamera);
|
||||
PREP(toggleInterface);
|
||||
PREP(updateCameraModes);
|
||||
PREP(updateSpectatableSides);
|
||||
PREP(updateUnits);
|
||||
PREP(updateVisionModes);
|
||||
|
||||
// Permanent variables
|
||||
GVAR(availableModes) = [0,1,2];
|
||||
GVAR(availableSides) = [west,east,resistance,civilian];
|
||||
GVAR(availableVisions) = [-2,-1,0,1];
|
||||
|
||||
GVAR(camMode) = 0;
|
||||
|
33
addons/spectator/functions/fnc_updateSpectatableSides.sqf
Normal file
33
addons/spectator/functions/fnc_updateSpectatableSides.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Adds or removes sides from the selection available to spectate by the local player.
|
||||
* Note that the side filter setting is applied to the available sides dynamically.
|
||||
*
|
||||
* Default selection is [west,east,resistance,civilian]
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Sides to add <ARRAY>
|
||||
* 1: Sides to remove <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Spectatable sides <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [[west], [east,civilian]] call ace_spectator_fnc_updateSpectatableSides
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_addSides",[],[[]]], ["_removeSides",[],[[]]]];
|
||||
|
||||
// Add and remove sides
|
||||
_addSides append (GVAR(availableSides) - _removeSides);
|
||||
|
||||
// Only need array of unique sides
|
||||
_addSides arrayIntersect _addSides;
|
||||
|
||||
GVAR(availableSides) = _addSides;
|
||||
|
||||
_addSides
|
@ -45,7 +45,7 @@ _cond = [{_this == (side group player)},{(_this getFriend (side group player)) >
|
||||
if (_x call _cond) then {
|
||||
_sides pushBack _x;
|
||||
};
|
||||
} forEach [west,east,resistance,civilian];
|
||||
} forEach GVAR(availableSides);
|
||||
|
||||
// Filter units and append to list
|
||||
_filteredUnits = [];
|
||||
|
Loading…
Reference in New Issue
Block a user