Converted a couple PFHs to use the waitAndExecute function as that is what they were doing.

Fixed a couple bugs.
This commit is contained in:
Garth L-H de Wet 2015-01-19 10:34:49 +02:00
parent ef19ffad0c
commit 2fe155f990
5 changed files with 40 additions and 38 deletions

View File

@ -37,7 +37,7 @@ GVAR(PostProcessEyes) ppEffectEnable false;
GVAR(EffectsActive) = false;
SETGLASSES(ace_player,GLASSESDEFAULT);
GVAR(Current) = "None";
GVAR(EyesDamageScript) = 0 spawn {};
GVAR(EyesDamageScript) = -1;
GVAR(FrameEvent) = [false, [false,20]];
GVAR(PostProcessEyes_Enabled) = false;
GVAR(DustHandler) = -1;
@ -77,9 +77,13 @@ player addEventHandler ["Killed",{
call FUNC(removeGlassesEffect);
GVAR(EffectsActive)=false;
ace_player setVariable ["ACE_EyesDamaged", false];
terminate GVAR(EyesDamageScript);
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
GVAR(DustHandler) = -1;
if (GVAR(EyesDamageScript) != -1) then {
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
};
if (GVAR(DustHandler) != -1) then {
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
GVAR(DustHandler) = -1;
};
}];
player addEventHandler ["Fired",{[_this select 0, _this select 1] call FUNC(dustHandler);}];
player AddEventHandler ["Take",{call FUNC(checkGlasses);}];
@ -99,20 +103,21 @@ player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
["GlassesCracked",{
if (_this select 0 != ace_player) exitWith {};
ace_player setVariable ["ACE_EyesDamaged", true];
if !(scriptDone GVAR(EyesDamageScript)) then {
terminate GVAR(EyesDamageScript);
if (GVAR(EyesDamageScript) != -1) then {
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
};
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 0;
GVAR(PostProcessEyes) ppEffectEnable true;
GVAR(EyesDamageScript) = [] spawn {
sleep 25;
GVAR(EyesDamageScript) = [{
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 5;
sleep 5;
GVAR(PostProcessEyes) ppEffectEnable false;
ace_player setVariable ["ACE_EyesDamaged", false];
};
GVAR(EyesDamageScript) = [{
GVAR(PostProcessEyes) ppEffectEnable false;
ace_player setVariable ["ACE_EyesDamaged", false];
GVAR(EyesDamageScript) = -1;
}, [], 5, 1] call EFUNC(common,waitAndExecute);
}, [], 25, 5] call EFUNC(common,waitAndExecute);
}] call EFUNC(common,addEventHandler);
call FUNC(checkGlasses);
[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler;

View File

@ -33,10 +33,12 @@ _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 1;
GVAR(PostProcessEyes) ppEffectEnable true;
SETDUST(DBULLETS,0);
if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
GVAR(DustHandler) = -1;
};
SETDUST(DBULLETS,0);
GVAR(DustHandler) = [{
if (diag_tickTime >= GETDUSTT(DTIME) + 3) then {
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
@ -49,12 +51,7 @@ GVAR(DustHandler) = [{
if (GETDUSTT(DAMOUNT) <= 0) then {
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 2;
[{
if (diag_tickTime >= ((_this select 0) select 0)) then {
GVAR(PostProcessEyes) ppEffectEnable false;
[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);
};
},0.5,[diag_tickTime+2]] call CALLSTACK(cba_fnc_addPerFrameHandler);
[{GVAR(PostProcessEyes) ppEffectEnable false;}, [], 2, 0.5] call EFUNC(common,waitAndExecute);
SETDUST(DACTIVE,false);
SETDUST(DBULLETS,0);
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);

View File

@ -27,13 +27,11 @@ SETGLASSES(ace_player,_effects);
if ((stance ace_player) != "PRONE") then {
ace_player playActionNow "gestureWipeFace";
};
null = [] spawn {
sleep 0.3;
[{
if (cameraView == "INTERNAL") then {
addCamShake [5, 1.75, 2];
};
};
}, [], 0.3, 0] call EFUNC(common,waitAndExecute);
call FUNC(removeDirtEffect);
call FUNC(removeRainEffect);

View File

@ -18,11 +18,13 @@
See http://community.bistudio.com/wiki/ArmA_3:_Event_Handlers#Fired
*/
#include "script_component.hpp"
private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType"];
_weapon = _this select 1;
private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType", "_unit"];
EXPLODE_2_PVT(_this,_unit,_weapon);
if (_unit != ace_player) exitWith {true};
_cloudType = "";
if ((_this select 0) != ace_player) exitWith {true};
if (rain > 0.1) exitWith {true};
if ((stance _unit) != "PRONE") exitWith {true};
if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect")) then {
_cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect" >> "effectName");
@ -33,10 +35,8 @@ if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEff
};
if (_cloudType == "") exitWith {true};
if (rain > 0.1) exitWith {true};
if ((stance ace_player) != "PRONE") exitWith {true};
_position = getPosATL ace_player;
_position = getPosATL _unit;
if (surfaceIsWater _position) exitWith {};
if ((_position select 2) > 0.2) exitWith {};

View File

@ -28,15 +28,16 @@ _safe = false;
if !(_rotorWash select 0) exitWith {
if (GVAR(PostProcessEyes_Enabled)) then {
GVAR(PostProcessEyes_Enabled) = false;
if (!scriptDone (GVAR(DustHandler))) then {
terminate GVAR(DustHandler);
if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
GVAR(DustHandler) = -1;
};
GVAR(DustHandler) = [] spawn {
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 2;
sleep 2;
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 2;
GVAR(DustHandler) = [{
GVAR(PostProcessEyes) ppEffectEnable false;
};
GVAR(DustHandler) = -1;
}, [], 2, 0.5] call EFUNC(common,waitAndExecute);
};
};
if ((headgear ace_player) != "") then {
@ -66,8 +67,9 @@ if ((_rotorWash select 1) <= 15) then {
_scale = 0.1;
};
_scale = 1 - _scale;
if (!scriptDone (GVAR(DustHandler))) then {
terminate GVAR(DustHandler);
if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
GVAR(DustHandler) = -1;
};
if !(ace_player getVariable ["ACE_EyesDamaged", false]) then {
GVAR(PostProcessEyes_Enabled) = true;