mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Removed a bunch of spawns and used PFH's in their place.
This commit is contained in:
parent
fc18cb443f
commit
49e19610c2
@ -16,7 +16,16 @@
|
||||
#include "script_component.hpp"
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
if isNil(QGAR(UsePP)) then {
|
||||
["ACE3", localize "STR_ACE_Goggles_WipeGlasses",
|
||||
{
|
||||
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
|
||||
call FUNC(clearGlasses);
|
||||
true
|
||||
};
|
||||
false
|
||||
}, [20, true, true, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind);
|
||||
|
||||
if isNil(QGVAR(UsePP)) then {
|
||||
GVAR(UsePP) = true;
|
||||
};
|
||||
|
||||
@ -31,22 +40,24 @@ GVAR(Current) = "None";
|
||||
GVAR(EyesDamageScript) = 0 spawn {};
|
||||
GVAR(FrameEvent) = [false, [false,20]];
|
||||
GVAR(PostProcessEyes_Enabled) = false;
|
||||
GVAR(DustHandler) = 0 spawn {};
|
||||
GVAR(DustHandler) = -1;
|
||||
GVAR(RainDrops) = objNull;
|
||||
GVAR(RainActive) = false;
|
||||
GVAR(RainLastLevel) = 0;
|
||||
|
||||
FUNC(CheckGlasses) = {
|
||||
if (GVAR(Current) != (goggles ace_player)) then {
|
||||
GVAR(Current) = (goggles ace_player);
|
||||
["GlassesChanged",[GVAR(Current)]] call CBA_fnc_localEvent;
|
||||
["GlassesChanged",[GVAR(Current)]] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
|
||||
ace_player addEventHandler ["Explosion", {
|
||||
player addEventHandler ["Explosion", {
|
||||
if (alive ace_player) then {
|
||||
call FUNC(ApplyDirtEffect);
|
||||
if (GETBROKEN) exitWith {};
|
||||
if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {};
|
||||
if !(ace_player call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call CBA_fnc_localEvent;};
|
||||
if !(ace_player call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);};
|
||||
GVAR(Effects) set [BROKEN, true];
|
||||
if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then {
|
||||
if (call FUNC(ExternalCamera)) exitWith {};
|
||||
@ -55,26 +66,22 @@ ace_player addEventHandler ["Explosion", {
|
||||
};
|
||||
(GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked");
|
||||
};
|
||||
["GlassesCracked",[ace_player]] call CBA_fnc_localEvent;
|
||||
["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);
|
||||
};
|
||||
}];
|
||||
ace_player addEventHandler ["Killed",{
|
||||
[] spawn {
|
||||
sleep 2;
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
GVAR(Effects) = GLASSESDEFAULT;
|
||||
call FUNC(removeGlassesEffect);
|
||||
GVAR(EffectsActive)=false;
|
||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
||||
terminate GVAR(EyesDamageScript);
|
||||
terminate GVAR(MainLoop);
|
||||
terminate GVAR(DustHandler);
|
||||
GVAR(MainLoop) = [] spawn FUNC(checkGoggles);
|
||||
};
|
||||
player addEventHandler ["Killed",{
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
GVAR(Effects) = GLASSESDEFAULT;
|
||||
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;
|
||||
}];
|
||||
ace_player addEventHandler ["Fired",{[_this select 0, _this select 1] call FUNC(dustHandler);}];
|
||||
ace_player AddEventHandler ["Take",{call FUNC(checkGlasses);}];
|
||||
ace_player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
|
||||
player addEventHandler ["Fired",{[_this select 0, _this select 1] call FUNC(dustHandler);}];
|
||||
player AddEventHandler ["Take",{call FUNC(checkGlasses);}];
|
||||
player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
|
||||
|
||||
["GlassesChanged",{
|
||||
GVAR(Effects) = GLASSESDEFAULT;
|
||||
@ -86,7 +93,7 @@ ace_player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
|
||||
} else {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
["GlassesCracked",{
|
||||
if (_this select 0 != ace_player) exitWith {};
|
||||
ace_player setVariable ["ACE_EyesDamaged", true];
|
||||
@ -104,5 +111,8 @@ ace_player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
GVAR(MainLoop) = [] spawn FUNC(CheckGoggles);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
call FUNC(checkGlasses);
|
||||
[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(rainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(onEachFrame), 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -243,19 +243,6 @@ class SniperCloud {
|
||||
ACE_Goggles_BulletCount = 1;
|
||||
};
|
||||
|
||||
class ACE_Default_Keys {
|
||||
class wipeGlasses {
|
||||
displayName = $STR_ACE_Goggles_WipeGlasses;
|
||||
//condition = QUOTE(!(GETVAR(ace_player,isUnconscious,false)));
|
||||
condition = "true";
|
||||
statement = QUOTE(call FUNC(clearGlasses););
|
||||
key = 20; // T
|
||||
shift = 1;
|
||||
control = 1;
|
||||
alt = 0;
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Options {
|
||||
class showInThirdPerson {
|
||||
displayName = $STR_ACE_Goggles_ShowInThirdPerson;
|
||||
|
@ -22,7 +22,7 @@ private "_dirtImage";
|
||||
GVAR(Effects) set [DIRT, true];
|
||||
|
||||
if (ace_player call FUNC(isGogglesVisible)) then{
|
||||
_dirtImage = getText(ConfigFile >> "CfgGlasses" >> goggles ace_player >> "ACE_OverlayDirt");
|
||||
_dirtImage = getText(ConfigFile >> "CfgGlasses" >> (goggles ace_player) >> "ACE_OverlayDirt");
|
||||
if (_dirtImage != "") then {
|
||||
100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false];
|
||||
|
||||
|
@ -33,37 +33,26 @@ _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;
|
||||
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);
|
||||
};
|
||||
SETDUST(DBULLETS,0);
|
||||
GVAR(DustHandler) = [3] spawn {
|
||||
private ["_loop", "_timeToSleep"];
|
||||
_timeToSleep = _this select 0;
|
||||
_loop = true;
|
||||
while {_loop} do {
|
||||
sleep _timeToSleep;
|
||||
_timeToSleep = GETDUSTT(DTIME);
|
||||
|
||||
if(_timeToSleep >= (time - 2.5)) then {
|
||||
_timeToSleep = time - _timeToSleep;
|
||||
} else {
|
||||
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
||||
private "_amount";
|
||||
_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
||||
if !(ace_player getVariable ["ACE_EyesDamaged", false]) then {
|
||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]];
|
||||
GVAR(PostProcessEyes) ppEffectCommit 1;
|
||||
sleep 1;
|
||||
};
|
||||
if (GETDUSTT(DAMOUNT) <= 0) then {
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
SETDUST(DACTIVE,false);
|
||||
SETDUST(DBULLETS,0);
|
||||
_loop = false;
|
||||
};
|
||||
SETDUST(DTIME,time);
|
||||
_timeToSleep = 3;
|
||||
GVAR(DustHandler) = [{
|
||||
EXPLODE_2_PVT(_this select 0,_sleep,_startTime);
|
||||
if (diag_tickTime >= GETDUSTT(DTIME) + 3) then {
|
||||
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
||||
private "_amount";
|
||||
_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
||||
if !(ace_player getVariable ["ACE_EyesDamaged", false]) then {
|
||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]];
|
||||
GVAR(PostProcessEyes) ppEffectCommit 0.5;
|
||||
};
|
||||
if (GETDUSTT(DAMOUNT) <= 0) then {
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
SETDUST(DACTIVE,false);
|
||||
SETDUST(DBULLETS,0);
|
||||
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
GVAR(DustHandler) = -1;
|
||||
};
|
||||
};
|
||||
};
|
||||
},0,[]] call CALLSTACK(cba_fnc_addPerFrameHandler);
|
||||
|
@ -4,48 +4,34 @@
|
||||
Description:
|
||||
Performs rain checks and checks to see whether glasses effects have been applied or not.
|
||||
Checks for external camera and removes effects.
|
||||
|
||||
Parameters:
|
||||
Nothing
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
|
||||
Example:
|
||||
[] execVM "ACE_Goggles\functions\fn_CheckGoggles.sqf";
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
call FUNC(checkGlasses);
|
||||
[QGVAR(RotorWash), "OnEachFrame", {call FUNC(onEachFrame);}] call CALLSTACK(BIS_fnc_addStackedEventHandler);
|
||||
[] spawn FUNC(rainEffect);
|
||||
while {alive ace_player} do {
|
||||
sleep 1;
|
||||
if (true) then {
|
||||
// Detect if curator interface is open and disable effects
|
||||
if (!isNull(findDisplay 312)) exitWith {
|
||||
if (GVAR(EffectsActive)) then {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
if (!alive ace_player) exitWith {};
|
||||
if (true) then {
|
||||
// Detect if curator interface is open and disable effects
|
||||
if (!isNull(findDisplay 312)) exitWith {
|
||||
if (GVAR(EffectsActive)) then {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
call FUNC(checkGlasses);
|
||||
if !(ace_player call FUNC(isGogglesVisible)) exitWith {
|
||||
if (GVAR(EffectsActive)) then {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
};
|
||||
call FUNC(checkGlasses);
|
||||
if !(ace_player call FUNC(isGogglesVisible)) exitWith {
|
||||
if (GVAR(EffectsActive)) then {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
if (call FUNC(externalCamera)) exitWith {
|
||||
if (GVAR(EffectsActive)) then {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
};
|
||||
if (call FUNC(externalCamera)) exitWith {
|
||||
if (GVAR(EffectsActive)) then {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
if !(GVAR(EffectsActive)) then {
|
||||
(goggles ace_player) call FUNC(applyGlassesEffect);
|
||||
} else {
|
||||
if ((goggles ace_player) call FUNC(isDivingGoggles) && {underwater ace_player}) then {
|
||||
call FUNC(removeRainEffect);
|
||||
call FUNC(removeDirtEffect);
|
||||
call FUNC(removeDustEffect);
|
||||
};
|
||||
};
|
||||
if !(GVAR(EffectsActive)) then {
|
||||
(goggles ace_player) call FUNC(applyGlassesEffect);
|
||||
} else {
|
||||
if ((goggles ace_player) call FUNC(isDivingGoggles) && {underwater ace_player}) then {
|
||||
call FUNC(removeRainEffect);
|
||||
call FUNC(removeDirtEffect);
|
||||
call FUNC(removeDustEffect);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -18,7 +18,6 @@
|
||||
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;
|
||||
_cloudType = "";
|
||||
@ -52,13 +51,13 @@ if (!_found) exitWith {};
|
||||
|
||||
_bullets = GETDUSTT(DBULLETS);
|
||||
|
||||
if ((time - GETDUSTT(DTIME)) > 1) then {
|
||||
if ((diag_tickTime - GETDUSTT(DTIME)) > 1) then {
|
||||
_bullets = 0;
|
||||
};
|
||||
|
||||
_bullets = _bullets + 1;
|
||||
SETDUST(DBULLETS,_bullets);
|
||||
SETDUST(DTIME,time);
|
||||
SETDUST(DTIME,diag_tickTime);
|
||||
|
||||
if (GETDUSTT(DAMOUNT) < 2) then {
|
||||
private "_bulletsRequired";
|
||||
|
@ -16,9 +16,7 @@
|
||||
["ACE_Goggles_RotorWash", "OnEachFrame", "call FUNC(OnEachFrame);"] call BIS_fnc_addStackedEventHandler;
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
if (isNull(ace_player)) then {
|
||||
[QGVAR(RotorWash), "OnEachFrame"] call CALLSTACK(BIS_fnc_removeStackedEventHandler);
|
||||
};
|
||||
if (isNull(ace_player)) exitWith {};
|
||||
GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)];
|
||||
if (GVAR(FrameEvent) select 0) exitWith {
|
||||
if (vehicle ace_player != ace_player && {!([ace_player] call EFUNC(common,isTurnedOut))}) exitWith {(GVAR(FrameEvent) select 1) set [0, false]; };
|
||||
|
@ -16,8 +16,8 @@
|
||||
[] spawn FUNC(RainEffect);
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
GVAR(RainDrops) = objNull;
|
||||
GVAR(RainActive) = false;
|
||||
private ["_fnc_underCover"];
|
||||
if (isNull(ace_player) || {!(alive ace_player)}) exitWith {};
|
||||
_fnc_underCover = {
|
||||
private ["_pos", "_unit"];
|
||||
_unit = (_this select 0);
|
||||
@ -25,37 +25,31 @@ _fnc_underCover = {
|
||||
_pos = eyePos _unit;
|
||||
((positionCameraToWorld [0,0,1] select 2) < ((positionCameraToWorld [0,0,0] select 2) - 0.4)) || {(lineIntersects [_pos, _pos vectorAdd [0,0,15], _unit])}
|
||||
};
|
||||
private ["_lastRain"];
|
||||
_lastRain = 0;
|
||||
while {alive ace_player} do {
|
||||
sleep 0.5;
|
||||
if (isNull(findDisplay 312)) then {
|
||||
// Ignore if ace_player is under water
|
||||
if (!GVAR(EffectsActive) || {underwater ace_player}) exitWith{call FUNC(RemoveRainEffect);};
|
||||
if (_lastRain != rain) then {
|
||||
if (isNull(findDisplay 312)) exitWith {
|
||||
if (GVAR(RainActive)) then {
|
||||
call FUNC(RemoveRainEffect);
|
||||
};
|
||||
};
|
||||
// Ignore if ace_player is under water
|
||||
if (!GVAR(EffectsActive) || {underwater ace_player}) exitWith{call FUNC(RemoveRainEffect);};
|
||||
if (GVAR(RainLastRain) != rain) then {
|
||||
call FUNC(RemoveRainEffect);
|
||||
GVAR(RainLastRain) = rain;
|
||||
// Rain is happening
|
||||
if (GVAR(RainLastRain) > 0.05 && {!([ace_player] call _fnc_underCover)}) then {
|
||||
GVAR(RainActive) = true;
|
||||
GVAR(RainDrops) = "#particlesource" createVehicleLocal GetPos ace_player;
|
||||
GVAR(RainDrops) setParticleClass "ACERainEffect";
|
||||
GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastRain)));
|
||||
GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]];
|
||||
};
|
||||
}else{
|
||||
if (GVAR(RainLastRain) > 0.05) then {
|
||||
if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith {
|
||||
call FUNC(RemoveRainEffect);
|
||||
_lastRain = rain;
|
||||
// Rain is happening
|
||||
if (_lastRain > 0.05 && {!([ace_player] call _fnc_underCover)}) then {
|
||||
GVAR(RainActive) = true;
|
||||
GVAR(RainDrops) = "#particlesource" createVehicleLocal GetPos ace_player;
|
||||
GVAR(RainDrops) setParticleClass "ACERainEffect";
|
||||
GVAR(RainDrops) setDropInterval (0.07 * (1.1 - _lastRain));
|
||||
GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]];
|
||||
};
|
||||
}else{
|
||||
if (_lastRain > 0.05) then {
|
||||
if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith {
|
||||
call FUNC(RemoveRainEffect);
|
||||
};
|
||||
if (!GVAR(RainActive)) then {
|
||||
_lastRain = -1;
|
||||
};
|
||||
};
|
||||
};
|
||||
}else{
|
||||
if (GVAR(RainActive)) then {
|
||||
call FUNC(RemoveRainEffect);
|
||||
if (!GVAR(RainActive)) then {
|
||||
GVAR(RainLastRain) = -1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -20,3 +20,4 @@ if (!isNull (GVAR(RainDrops))) then {
|
||||
deleteVehicle (GVAR(RainDrops));
|
||||
};
|
||||
GVAR(RainActive) = false;
|
||||
GVAR(RainLastLevel) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user