mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'ace_spectator' into ace_spectator_dev
Conflicts: addons/spectator/functions/fnc_camera.sqf
This commit is contained in:
commit
206a976013
@ -18,7 +18,7 @@
|
||||
|
||||
if (GVAR(endMission) && isServer) then {
|
||||
[{
|
||||
if ({isPlayer _x && alive _x && (_x distance GVAR(penPos)) > 200} count playableUnits == 0) then {
|
||||
if ({(isPlayer _x) && (alive _x) && !(_x getVariable [QGVAR(isSpectator), false])} count playableUnits == 0) then {
|
||||
[["endDeath", false], "BIS_fnc_endMission"] call BIS_fnc_MP;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -28,6 +28,4 @@ PREP(unitSide);
|
||||
PREP(unitVar);
|
||||
PREP(viewDistance);
|
||||
|
||||
GVAR(penPos) = [-10e5,-10e5,0];
|
||||
|
||||
ADDON = true;
|
||||
|
@ -33,8 +33,6 @@ switch _mode do {
|
||||
|
||||
GVAR(noEscape) = if (count _this > 0) then {_this select 0} else {false};
|
||||
|
||||
call FUNC(penPos);
|
||||
|
||||
_camPos = if (!isNil QGVAR(startingPos)) then {
|
||||
GVAR(startingPos)
|
||||
} else {
|
||||
|
@ -22,9 +22,8 @@
|
||||
|
||||
_unit = _this select 0;
|
||||
|
||||
if (_unit distance GVAR(penPos) < 200) exitWith {false};
|
||||
if (_unit distance [0,0,0] < 100) exitWith {false};
|
||||
if (!GVAR(AI) && !isPlayer _unit) exitWith {false};
|
||||
if (GVAR(limitSide) && (([_unit] call FUNC(unitSide)) != GVAR(playerSide))) exitWith {false};
|
||||
|
||||
true
|
||||
(simulationEnabled _unit) && // Simulation enabled
|
||||
//{!isObjectHidden _unit} && // Not hidden (currently dev branch only)
|
||||
{!(_unit getVariable [QGVAR(isSpectator), false])} && // Who watches the watchmen?
|
||||
{(GVAR(AI) || (isPlayer _unit))} && // Only allow AI when setting is enabled
|
||||
{!GVAR(limitSide) || (([_unit] call FUNC(unitSide)) == GVAR(playerSide))} // Only allow units of same side when setting is enabled
|
||||
|
@ -31,7 +31,7 @@ switch _mode do {
|
||||
_map = _this displayCtrl 1;
|
||||
|
||||
if (isNil QGVAR(mapPos)) then {
|
||||
GVAR(mapPos) = [(GVAR(penPos) select 0) / 4, (GVAR(penPos) select 1) / 4];
|
||||
GVAR(mapPos) = (getPosASL GVAR(cam)) select [0,2];
|
||||
};
|
||||
|
||||
if (isNil QGVAR(mapZoom)) then {
|
||||
|
@ -27,13 +27,16 @@ if (_set isEqualTo (_unit getVariable [QGVAR(isSpectator), false])) exitWith {};
|
||||
// Spectators aren't physical entities (todo: this command has to be executed on the server)
|
||||
_unit hideObjectGlobal _set;
|
||||
|
||||
if (isClass (configFile >> "CfgPatches" >> "ace_hearing")) then {EGVAR(hearing,disableVolumeUpdate) = _set};
|
||||
if (isClass (configFile >> "CfgPatches" >> "acre_sys_radio")) then {[_set] call acre_api_fnc_setSpectator};
|
||||
if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {[_unit, _set] call TFAR_fnc_forceSpectator};
|
||||
// Prevent player falling into water
|
||||
_unit enableSimulation !_set;
|
||||
|
||||
if (_set) then {
|
||||
// Move the player ASAP to avoid being seen
|
||||
_unit setPosATL GVAR(penPos);
|
||||
_unit setPosASL (getMarkerPos QGVAR(respawn));
|
||||
[_unit] joinSilent grpNull;
|
||||
|
||||
// Dead men can't talk
|
||||
[_unit, "isSpectator"] call EFUNC(common,muteUnit);
|
||||
|
||||
if !(GVAR(modulePos)) then {
|
||||
if !(isNull _target) then {
|
||||
@ -41,26 +44,22 @@ if (_set) then {
|
||||
};
|
||||
};
|
||||
|
||||
// Spectators shouldn't show in group UI
|
||||
[_unit] joinSilent grpNull;
|
||||
|
||||
// Prevent drowning and vision blur
|
||||
if (surfaceisWater GVAR(penPos)) then {
|
||||
_unit forceAddUniform "U_B_Wetsuit";
|
||||
_unit addVest "V_RebreatherB";
|
||||
};
|
||||
|
||||
// Dead men can't talk
|
||||
[_unit, "isSpectator"] call EFUNC(common,muteUnit);
|
||||
|
||||
0 fadeSound 0;
|
||||
999999 cutText ["", "BLACK FADED", 0];
|
||||
["Init", [true]] call FUNC(camera);
|
||||
} else {
|
||||
// Code to exit spectator and "respawn" player goes here (WIP)
|
||||
["Exit"] call FUNC(camera);
|
||||
|
||||
// Living men can talk
|
||||
[_unit, "isSpectator"] call EFUNC(common,unmuteUnit);
|
||||
};
|
||||
|
||||
// Handle common addon audio
|
||||
if (isClass (configFile >> "CfgPatches" >> "ace_hearing")) then {EGVAR(hearing,disableVolumeUpdate) = _set};
|
||||
if (isClass (configFile >> "CfgPatches" >> "acre_sys_radio")) then {[_set] call acre_api_fnc_setSpectator};
|
||||
if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {[_unit, _set] call TFAR_fnc_forceSpectator};
|
||||
|
||||
// Spectators ignore damage (vanilla and ace_medical)
|
||||
_unit allowDamage !_set;
|
||||
_unit setVariable ["ace_medical_allowDamage", !_set];
|
||||
|
Loading…
Reference in New Issue
Block a user