From c09314027fd201ca42562731447f06a5a12347f9 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sat, 4 Jul 2015 19:41:18 +0100 Subject: [PATCH] "isNotSpectator" canInteractWith condition --- addons/spectator/XEH_postInit.sqf | 3 +++ addons/spectator/functions/fnc_camera.sqf | 6 +----- .../spectator/functions/fnc_setSpectator.sqf | 19 +++++++++---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index d220ff40a7..19110f499f 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -22,6 +22,9 @@ if !(hasInterface) exitWith {}; + // Add interaction menu exception + ["isNotSpectating", {!((_this select 0) getVariable [QGVAR(isSpectator), false])}] call EFUNC(common,addCanInteractWithCondition); + GVAR(playerSide) = side (group player); if GVAR(tracking) then { diff --git a/addons/spectator/functions/fnc_camera.sqf b/addons/spectator/functions/fnc_camera.sqf index 81e0f9ea40..06a7967471 100644 --- a/addons/spectator/functions/fnc_camera.sqf +++ b/addons/spectator/functions/fnc_camera.sqf @@ -187,10 +187,6 @@ switch _mode do { EGVAR(nametags,showNamesForAI) = false; }; - if (["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { - [QGVAR(interactCondition), {false}] call EFUNC(common,addCanInteractWithCondition); - }; - //add unit check, since if tracking were on it would already be present if !GVAR(tracking) then { [FUNC(checkUnits), 2] call CBA_fnc_addPerFrameHandler @@ -803,4 +799,4 @@ switch _mode do { if (!isMultiplayer) then {setAccTime 1}; ACE_player switchCamera "Internal"; }; -}; \ No newline at end of file +}; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index 2bd4c61532..e5d2b44c6b 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -24,18 +24,16 @@ _set = if (count _this > 2) then {_this select 2} else {true}; 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; - // Prevent player falling into water _unit enableSimulation !_set; if (_set) then { - // Move the player ASAP to avoid being seen + // Move and hide the player ASAP to avoid being seen _unit setPosASL (getMarkerPos QGVAR(respawn)); [_unit] joinSilent grpNull; - // Dead men can't talk + // Ghosts can't talk + [_unit, "isSpectator"] call EFUNC(common,hideUnit); [_unit, "isSpectator"] call EFUNC(common,muteUnit); if !(GVAR(modulePos)) then { @@ -51,18 +49,19 @@ if (_set) then { // Code to exit spectator and "respawn" player goes here (WIP) ["Exit"] call FUNC(camera); - // Living men can talk + // Physical beings can talk + [_unit, "isSpectator"] call EFUNC(common,unhideUnit); [_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}; +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}; // Spectators ignore damage (vanilla and ace_medical) _unit allowDamage !_set; -_unit setVariable ["ace_medical_allowDamage", !_set]; +_unit setVariable [QGVAR(medical,allowDamage), !_set]; // Mark spectator state for external reference [_unit,QGVAR(isSpectator),_set] call EFUNC(common,setVariableJIP);