mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Virtual units - skip goggles/hearing effects (#4988)
* Disable goggles and hearing fx for virtual units * Cleanup some other CBA_fnc_addPlayerEventHandler
This commit is contained in:
parent
fb73286242
commit
6c592e5a10
@ -296,18 +296,10 @@ enableCamShake true;
|
|||||||
// Set up numerous eventhanders for player controlled units
|
// Set up numerous eventhanders for player controlled units
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
// It is possible that CBA_fnc_addPlayerEventHandler has allready been called and run
|
TRACE_1("adding unit playerEH to set ace_player",isNull cba_events_oldUnit);
|
||||||
// We will NOT get any events for the initial state, so manually set ACE_player
|
|
||||||
if (!isNull (missionNamespace getVariable ["cba_events_oldUnit", objNull])) then {
|
|
||||||
// INFO("CBA_fnc_addPlayerEventHandler has already run - manually setting ace_player"); //ToDo CBA 3.1
|
|
||||||
diag_log text "[ACE-Common - CBA_fnc_addPlayerEventHandler has already run - manually setting ace_player";
|
|
||||||
ACE_player = cba_events_oldUnit;
|
|
||||||
};
|
|
||||||
|
|
||||||
// "playerChanged" event
|
|
||||||
["unit", {
|
["unit", {
|
||||||
ACE_player = (_this select 0);
|
ACE_player = (_this select 0);
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
GVAR(OldIsCamera) = false;
|
GVAR(OldIsCamera) = false;
|
||||||
|
|
||||||
|
@ -29,6 +29,26 @@ if (!hasInterface) exitWith {};
|
|||||||
GVAR(UsePP) = true;
|
GVAR(UsePP) = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// init pp effects
|
||||||
|
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
||||||
|
GVAR(EffectsActive) = false;
|
||||||
|
|
||||||
|
// add glasses eventhandlers
|
||||||
|
["ace_glassesChanged", {
|
||||||
|
params ["_unit", "_glasses"];
|
||||||
|
TRACE_2("ace_glassesChanged eh",_unit,_glasses);
|
||||||
|
|
||||||
|
SETGLASSES(_unit,GLASSESDEFAULT);
|
||||||
|
|
||||||
|
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
||||||
|
|
||||||
|
if ([_unit] call FUNC(isGogglesVisible)) then {
|
||||||
|
[_unit, _glasses] call FUNC(applyGlassesEffect);
|
||||||
|
} else {
|
||||||
|
call FUNC(removeGlassesEffect);
|
||||||
|
};
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// init GlassesChanged eventhandler
|
// init GlassesChanged eventhandler
|
||||||
GVAR(OldGlasses) = "<null>";
|
GVAR(OldGlasses) = "<null>";
|
||||||
["loadout", {
|
["loadout", {
|
||||||
@ -40,12 +60,9 @@ if (!hasInterface) exitWith {};
|
|||||||
["ace_glassesChanged", [_unit, _currentGlasses]] call CBA_fnc_localEvent;
|
["ace_glassesChanged", [_unit, _currentGlasses]] call CBA_fnc_localEvent;
|
||||||
GVAR(OldGlasses) = _currentGlasses;
|
GVAR(OldGlasses) = _currentGlasses;
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
|
|
||||||
// init pp effects
|
|
||||||
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
|
||||||
GVAR(EffectsActive) = false;
|
|
||||||
|
|
||||||
// check goggles
|
// check goggles
|
||||||
private _fnc_checkGoggles = {
|
private _fnc_checkGoggles = {
|
||||||
@ -57,7 +74,7 @@ if (!hasInterface) exitWith {};
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (!(call FUNC(externalCamera)) && {[_unit] call FUNC(isGogglesVisible)}) then {
|
if (!(call FUNC(externalCamera)) && {[_unit] call FUNC(isGogglesVisible)}) then {
|
||||||
[goggles _unit] call FUNC(applyGlassesEffect);
|
[_unit, goggles _unit] call FUNC(applyGlassesEffect);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -66,21 +83,6 @@ if (!hasInterface) exitWith {};
|
|||||||
["ace_activeCameraChanged", _fnc_checkGoggles] call CBA_fnc_addEventHandler;
|
["ace_activeCameraChanged", _fnc_checkGoggles] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
|
||||||
// add glasses eventhandlers
|
|
||||||
["ace_glassesChanged", {
|
|
||||||
params ["_unit", "_glasses"];
|
|
||||||
|
|
||||||
SETGLASSES(_unit,GLASSESDEFAULT);
|
|
||||||
|
|
||||||
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
|
||||||
|
|
||||||
if ([_unit] call FUNC(isGogglesVisible)) then {
|
|
||||||
_glasses call FUNC(applyGlassesEffect);
|
|
||||||
} else {
|
|
||||||
call FUNC(removeGlassesEffect);
|
|
||||||
};
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
|
|
||||||
// // ---Add the Dust/Dirt/Rain Effects---
|
// // ---Add the Dust/Dirt/Rain Effects---
|
||||||
if (GVAR(effects) == 2) then {
|
if (GVAR(effects) == 2) then {
|
||||||
|
@ -5,23 +5,29 @@
|
|||||||
* Sets dirt/rain overlay for glasses.
|
* Sets dirt/rain overlay for glasses.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Glasses classname to be applied <STRING>
|
* 0: Player <OBJECT>
|
||||||
|
* 1: Glasses classname to be applied <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [goggles ace_player] call ace_goggles_fnc_applyGlassesEffect
|
* [ace_player, goggles ace_player] call ace_goggles_fnc_applyGlassesEffect
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_glasses"];
|
params ["_player", "_glasses"];
|
||||||
|
TRACE_2("applyGlassesEffect",_player,_glasses);
|
||||||
|
|
||||||
// remove old effect
|
// remove old effect
|
||||||
call FUNC(removeGlassesEffect);
|
call FUNC(removeGlassesEffect);
|
||||||
|
|
||||||
|
if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _player) >> "isPlayableLogic")) == 1) exitWith {
|
||||||
|
TRACE_1("skipping playable logic",typeOf _player); // VirtualMan_F (placeable logic zeus / spectator)
|
||||||
|
};
|
||||||
|
|
||||||
private ["_config", "_postProcessColour", "_postProcessTintAmount", "_imagePath"];
|
private ["_config", "_postProcessColour", "_postProcessTintAmount", "_imagePath"];
|
||||||
|
|
||||||
_config = configFile >> "CfgGlasses" >> _glasses;
|
_config = configFile >> "CfgGlasses" >> _glasses;
|
||||||
|
@ -60,6 +60,9 @@ GVAR(lastPlayerVehicle) = objNull;
|
|||||||
};
|
};
|
||||||
// Don't add a new EH if the unit respawned
|
// Don't add a new EH if the unit respawned
|
||||||
if ((_player getVariable [QGVAR(firedEH), -1]) == -1) then {
|
if ((_player getVariable [QGVAR(firedEH), -1]) == -1) then {
|
||||||
|
if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _player) >> "isPlayableLogic")) == 1) exitWith {
|
||||||
|
TRACE_1("skipping playable logic",typeOf _player); // VirtualMan_F (placeable logic zeus / spectator)
|
||||||
|
};
|
||||||
private _firedEH = _player addEventHandler ["FiredNear", {call FUNC(firedNear)}];
|
private _firedEH = _player addEventHandler ["FiredNear", {call FUNC(firedNear)}];
|
||||||
_player setVariable [QGVAR(firedEH), _firedEH];
|
_player setVariable [QGVAR(firedEH), _firedEH];
|
||||||
private _explosionEH = _player addEventHandler ["Explosion", {call FUNC(explosionNear)}];
|
private _explosionEH = _player addEventHandler ["Explosion", {call FUNC(explosionNear)}];
|
||||||
@ -69,7 +72,6 @@ GVAR(lastPlayerVehicle) = objNull;
|
|||||||
|
|
||||||
GVAR(deafnessDV) = 0;
|
GVAR(deafnessDV) = 0;
|
||||||
GVAR(deafnessPrior) = 0;
|
GVAR(deafnessPrior) = 0;
|
||||||
ACE_player setVariable [QGVAR(deaf), false];
|
|
||||||
GVAR(time3) = 0;
|
GVAR(time3) = 0;
|
||||||
[] call FUNC(updateHearingProtection);
|
[] call FUNC(updateHearingProtection);
|
||||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
@ -116,12 +116,13 @@ call FUNC(determineZoom);
|
|||||||
GVAR(hasWatch) = true;
|
GVAR(hasWatch) = true;
|
||||||
|
|
||||||
["loadout", {
|
["loadout", {
|
||||||
if (isNull (_this select 0)) exitWith {
|
params ["_unit"];
|
||||||
|
if (isNull _unit) exitWith {
|
||||||
GVAR(hasWatch) = true;
|
GVAR(hasWatch) = true;
|
||||||
};
|
};
|
||||||
GVAR(hasWatch) = false;
|
GVAR(hasWatch) = false;
|
||||||
{
|
{
|
||||||
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
|
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
|
||||||
false
|
false
|
||||||
} count (assignedItems ACE_player);
|
} count (assignedItems _unit);
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
Loading…
Reference in New Issue
Block a user