ACE3/addons/goggles/XEH_postInit.sqf

108 lines
2.9 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
if (!hasInterface) exitWith {};
["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), {
2015-03-05 07:32:26 +00:00
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
call FUNC(clearGlasses);
true
};
false
},
2015-03-05 08:51:24 +00:00
{false},
[20, [true, true, false]], false] call CBA_fnc_addKeybind;
2015-09-29 20:01:40 +00:00
// make sure to stack effect layers in correct order
QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer;
QGVAR(GogglesLayer) call BIS_fnc_RSCLayer;
2015-09-29 20:01:40 +00:00
if (isNil QGVAR(UsePP)) then {
2015-03-05 07:32:26 +00:00
GVAR(UsePP) = true;
};
2015-09-29 20:01:40 +00:00
// init pp effects
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
2015-09-29 20:01:40 +00:00
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [1, 1, 1, 0]];
GVAR(PostProcessEyes) ppEffectCommit 0;
GVAR(PostProcessEyes) ppEffectEnable false;
2015-09-29 20:01:40 +00:00
GVAR(EffectsActive) = false;
2015-09-29 20:01:40 +00:00
SETGLASSES(ace_player,GLASSESDEFAULT);
2015-09-29 20:01:40 +00:00
GVAR(Current) = "None";
GVAR(EyesDamageScript) = -1;
GVAR(FrameEvent) = [false, [false,20]];
GVAR(PostProcessEyes_Enabled) = false;
GVAR(DustHandler) = -1;
GVAR(RainDrops) = objNull;
GVAR(RainActive) = false;
GVAR(RainLastLevel) = 0;
2015-05-28 05:18:45 +00:00
GVAR(surfaceCache) = "";
GVAR(surfaceCacheIsDust) = false;
2015-09-29 20:01:40 +00:00
// init GlassesChanged eventhandler
GVAR(OldGlasses) = "#NULLSTRING";
["playerInventoryChanged", {
(_this select 1) params ["", "_currentGlasses"];
if (GVAR(OldGlasses) != _currentGlasses) then {
["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent);
GVAR(OldGlasses) = _currentGlasses;
2015-03-05 07:32:26 +00:00
};
2015-09-29 20:01:40 +00:00
}] call EFUNC(common,addEventHandler);
// add glasses eventhandlers
["GlassesChanged", {
params ["_unit", "_glasses"];
2015-09-29 20:01:40 +00:00
SETGLASSES(_unit,GLASSESDEFAULT);
2015-03-05 07:32:26 +00:00
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
2015-09-29 20:01:40 +00:00
if ([_unit] call FUNC(isGogglesVisible)) then {
_glasses call FUNC(applyGlassesEffect);
2015-03-05 07:32:26 +00:00
} else {
call FUNC(removeGlassesEffect);
};
}] call EFUNC(common,addEventHandler);
2015-09-29 20:01:40 +00:00
["GlassesCracked", {
params ["_unit"];
_unit setVariable ["ACE_EyesDamaged", true];
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0]];
2015-03-05 07:32:26 +00:00
GVAR(PostProcessEyes) ppEffectCommit 0;
GVAR(PostProcessEyes) ppEffectEnable true;
2015-09-29 20:01:40 +00:00
[{
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]];
2015-03-05 07:32:26 +00:00
GVAR(PostProcessEyes) ppEffectCommit 5;
2015-09-29 20:01:40 +00:00
2015-03-05 07:32:26 +00:00
GVAR(EyesDamageScript) = [{
2015-09-29 20:01:40 +00:00
params ["_unit"];
2015-03-05 07:32:26 +00:00
GVAR(PostProcessEyes) ppEffectEnable false;
2015-09-29 20:01:40 +00:00
_unit setVariable ["ACE_EyesDamaged", false];
}, _this, 5] call EFUNC(common,waitAndExecute);
}, _unit, 25] call EFUNC(common,waitAndExecute);
}] call EFUNC(common,addEventHandler);
2015-09-29 20:01:40 +00:00
[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler;
2015-09-29 17:51:41 +00:00
[FUNC(applyRainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler;
[FUNC(onEachFrame), 0, []] call CBA_fnc_addPerFrameHandler;