Glasses conditions are local to each unit. No longer global scope on each client.

This commit is contained in:
Garth L-H de Wet 2015-01-19 01:38:54 +02:00
parent b499cc9a1d
commit ef19ffad0c
5 changed files with 28 additions and 14 deletions

View File

@ -35,7 +35,7 @@ GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
GVAR(PostProcessEyes) ppEffectCommit 0; GVAR(PostProcessEyes) ppEffectCommit 0;
GVAR(PostProcessEyes) ppEffectEnable false; GVAR(PostProcessEyes) ppEffectEnable false;
GVAR(EffectsActive) = false; GVAR(EffectsActive) = false;
GVAR(Effects) = GLASSESDEFAULT; SETGLASSES(ace_player,GLASSESDEFAULT);
GVAR(Current) = "None"; GVAR(Current) = "None";
GVAR(EyesDamageScript) = 0 spawn {}; GVAR(EyesDamageScript) = 0 spawn {};
GVAR(FrameEvent) = [false, [false,20]]; GVAR(FrameEvent) = [false, [false,20]];
@ -58,7 +58,9 @@ player addEventHandler ["Explosion", {
if (GETBROKEN) exitWith {}; if (GETBROKEN) exitWith {};
if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) 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 EFUNC(common,localEvent);}; if !(ace_player call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);};
GVAR(Effects) set [BROKEN, true]; _effects = GETGLASSES(ace_player,GLASSESDEFAULT);
_effects set [BROKEN, true];
SETGLASSES(ace_player,_effects);
if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then { if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then {
if (call FUNC(ExternalCamera)) exitWith {}; if (call FUNC(ExternalCamera)) exitWith {};
if (isNull(GLASSDISPLAY)) then { if (isNull(GLASSDISPLAY)) then {
@ -71,7 +73,7 @@ player addEventHandler ["Explosion", {
}]; }];
player addEventHandler ["Killed",{ player addEventHandler ["Killed",{
GVAR(PostProcessEyes) ppEffectEnable false; GVAR(PostProcessEyes) ppEffectEnable false;
GVAR(Effects) = GLASSESDEFAULT; SETGLASSES(ace_player,GLASSESDEFAULT);
call FUNC(removeGlassesEffect); call FUNC(removeGlassesEffect);
GVAR(EffectsActive)=false; GVAR(EffectsActive)=false;
ace_player setVariable ["ACE_EyesDamaged", false]; ace_player setVariable ["ACE_EyesDamaged", false];
@ -84,7 +86,7 @@ player AddEventHandler ["Take",{call FUNC(checkGlasses);}];
player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
["GlassesChanged",{ ["GlassesChanged",{
GVAR(Effects) = GLASSESDEFAULT; SETGLASSES(ace_player,GLASSESDEFAULT);
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)}; if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};

View File

@ -19,7 +19,9 @@
if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false}; if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false};
private "_dirtImage"; private "_dirtImage";
GVAR(Effects) set [DIRT, true]; _effects = GETGLASSES(ace_player,GLASSESDEFAULT);
_effects set [DIRT, true];
SETGLASSES(ace_player,_effects);
if (ace_player call FUNC(isGogglesVisible)) then{ 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");

View File

@ -38,7 +38,6 @@ if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
}; };
SETDUST(DBULLETS,0); SETDUST(DBULLETS,0);
GVAR(DustHandler) = [{ GVAR(DustHandler) = [{
EXPLODE_2_PVT(_this select 0,_sleep,_startTime);
if (diag_tickTime >= GETDUSTT(DTIME) + 3) then { if (diag_tickTime >= GETDUSTT(DTIME) + 3) then {
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
private "_amount"; private "_amount";
@ -48,7 +47,14 @@ GVAR(DustHandler) = [{
GVAR(PostProcessEyes) ppEffectCommit 0.5; GVAR(PostProcessEyes) ppEffectCommit 0.5;
}; };
if (GETDUSTT(DAMOUNT) <= 0) then { if (GETDUSTT(DAMOUNT) <= 0) then {
GVAR(PostProcessEyes) ppEffectEnable false; 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);
SETDUST(DACTIVE,false); SETDUST(DACTIVE,false);
SETDUST(DBULLETS,0); SETDUST(DBULLETS,0);
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);

View File

@ -20,8 +20,9 @@
private "_broken"; private "_broken";
_broken = GETBROKEN; _broken = GETBROKEN;
GVAR(Effects) = GLASSESDEFAULT; _effects = GLASSESDEFAULT;
GVAR(Effects) set [BROKEN, _broken]; _effects set [BROKEN, _broken];
SETGLASSES(ace_player,_effects);
if ((stance ace_player) != "PRONE") then { if ((stance ace_player) != "PRONE") then {
ace_player playActionNow "gestureWipeFace"; ace_player playActionNow "gestureWipeFace";

View File

@ -13,16 +13,19 @@
// MACROS // MACROS
#define GLASSESDEFAULT [false,[false,0,0,0],false] #define GLASSESDEFAULT [false,[false,0,0,0],false]
#define GETGLASSES(unit) GETVAR(unit,GVAR(Condition),GLASSESDEFAULT)
#define SETGLASSES(unit,value) SETVAR(unit,GVAR(Condition),value)
#define DIRT 0 #define DIRT 0
#define DUST 1 #define DUST 1
#define BROKEN 2 #define BROKEN 2
#define GETDIRT (GVAR(Effects) select DIRT) #define GETDIRT (GETGLASSES(ace_player) select DIRT)
#define GETDUST (GVAR(Effects) select DUST) #define GETDUST (GETGLASSES(ace_player) select DUST)
#define GETBROKEN (GVAR(Effects) select BROKEN) #define GETBROKEN (GETGLASSES(ace_player) select BROKEN)
#define GETDUSTT(type) ((GVAR(Effects) select DUST) select type) #define GETDUSTT(type) ((GETGLASSES(ace_player) select DUST) select type)
#define SETDUST(type,value) (GVAR(Effects) select DUST) set [type,value] #define SETDUST(type,value) (GETGLASSES(ace_player) select DUST) set [type,value]
#define DACTIVE 0 #define DACTIVE 0
#define DTIME 1 #define DTIME 1