mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2648 from acemod/340goggles
Code cleanup / refactoring Goggles
This commit is contained in:
commit
ea01db4030
@ -1,4 +1,11 @@
|
|||||||
|
|
||||||
class ACE_Settings {
|
class ACE_Settings {
|
||||||
|
/*class GVAR(enable) { // @todo
|
||||||
|
value = 0;
|
||||||
|
typeName = "BOOL";
|
||||||
|
isClientSettable = 1;
|
||||||
|
displayName = CSTRING(enable);
|
||||||
|
};*/
|
||||||
class GVAR(showInThirdPerson) {
|
class GVAR(showInThirdPerson) {
|
||||||
value = 0;
|
value = 0;
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
|
@ -1,10 +1,36 @@
|
|||||||
|
|
||||||
class Extended_PreInit_EventHandlers {
|
class Extended_PreInit_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Extended_PostInit_EventHandlers {
|
class Extended_PostInit_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_Killed_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
killed = QUOTE(_this call FUNC(handleKilled));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_Fired_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
fired = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleFired)});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_Explosion_EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
class ADDON {
|
||||||
|
explosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)});
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,24 +1,8 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Sets up the glasses mod for usage. Initialises variables and event handlers.
|
|
||||||
* Shouldn't be called by a user/modder ever. Done by the engine.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses),
|
["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), {
|
||||||
{
|
|
||||||
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
|
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
|
||||||
call FUNC(clearGlasses);
|
call FUNC(clearGlasses);
|
||||||
true
|
true
|
||||||
@ -26,22 +10,29 @@ if (!hasInterface) exitWith {};
|
|||||||
false
|
false
|
||||||
},
|
},
|
||||||
{false},
|
{false},
|
||||||
[20, [true, true, false]], false] call cba_fnc_addKeybind;
|
[20, [true, true, false]], false] call CBA_fnc_addKeybind;
|
||||||
|
|
||||||
if isNil(QGVAR(UsePP)) then {
|
// make sure to stack effect layers in correct order
|
||||||
|
GVAR(GogglesEffectsLayer) = QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer;
|
||||||
|
GVAR(GogglesLayer) = QGVAR(GogglesLayer) call BIS_fnc_RSCLayer;
|
||||||
|
|
||||||
|
if (isNil QGVAR(UsePP)) then {
|
||||||
GVAR(UsePP) = true;
|
GVAR(UsePP) = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
// init pp effects
|
||||||
|
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
||||||
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
|
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
|
||||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
|
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;
|
||||||
|
|
||||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
SETGLASSES(ace_player,GLASSESDEFAULT);
|
||||||
GVAR(Current) = "None";
|
|
||||||
GVAR(EyesDamageScript) = -1;
|
GVAR(EyesDamageScript) = -1;
|
||||||
GVAR(FrameEvent) = [false, [false,20]];
|
GVAR(FrameEvent) = [false, [false, 20]];
|
||||||
GVAR(PostProcessEyes_Enabled) = false;
|
GVAR(PostProcessEyes_Enabled) = false;
|
||||||
GVAR(DustHandler) = -1;
|
GVAR(DustHandler) = -1;
|
||||||
GVAR(RainDrops) = objNull;
|
GVAR(RainDrops) = objNull;
|
||||||
@ -50,82 +41,89 @@ GVAR(RainLastLevel) = 0;
|
|||||||
GVAR(surfaceCache) = "";
|
GVAR(surfaceCache) = "";
|
||||||
GVAR(surfaceCacheIsDust) = false;
|
GVAR(surfaceCacheIsDust) = false;
|
||||||
|
|
||||||
FUNC(CheckGlasses) = {
|
// init GlassesChanged eventhandler
|
||||||
if (GVAR(Current) != (goggles ace_player)) then {
|
GVAR(OldGlasses) = "#NULLSTRING";
|
||||||
GVAR(Current) = (goggles ace_player);
|
|
||||||
["GlassesChanged",[GVAR(Current)]] call EFUNC(common,localEvent);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
player addEventHandler ["Explosion", {
|
["playerInventoryChanged", {
|
||||||
private "_effects";
|
(_this select 1) params ["", "_currentGlasses"];
|
||||||
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 EFUNC(common,localEvent);};
|
|
||||||
_effects = GETGLASSES(ace_player);
|
|
||||||
_effects set [BROKEN, true];
|
|
||||||
SETGLASSES(ace_player,_effects);
|
|
||||||
if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then {
|
|
||||||
if (call FUNC(ExternalCamera)) exitWith {};
|
|
||||||
if (isNull(GLASSDISPLAY)) then {
|
|
||||||
150 cutRsc["RscACE_Goggles", "PLAIN",1, false];
|
|
||||||
};
|
|
||||||
(GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked");
|
|
||||||
};
|
|
||||||
["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
player addEventHandler ["Killed",{
|
|
||||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
|
||||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
|
||||||
call FUNC(removeGlassesEffect);
|
|
||||||
GVAR(EffectsActive)=false;
|
|
||||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
|
||||||
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);}];
|
|
||||||
player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
|
|
||||||
|
|
||||||
["GlassesChanged",{
|
if (GVAR(OldGlasses) != _currentGlasses) then {
|
||||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent);
|
||||||
|
GVAR(OldGlasses) = _currentGlasses;
|
||||||
|
};
|
||||||
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
// add glasses eventhandlers
|
||||||
|
["GlassesChanged", {
|
||||||
|
params ["_unit", "_glasses"];
|
||||||
|
|
||||||
|
SETGLASSES(_unit,GLASSESDEFAULT);
|
||||||
|
|
||||||
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
||||||
|
|
||||||
if ([ace_player] call FUNC(isGogglesVisible)) then {
|
if ([_unit] call FUNC(isGogglesVisible)) then {
|
||||||
[_this select 0] call FUNC(applyGlassesEffect);
|
_glasses call FUNC(applyGlassesEffect);
|
||||||
} else {
|
} else {
|
||||||
call FUNC(removeGlassesEffect);
|
call FUNC(removeGlassesEffect);
|
||||||
};
|
};
|
||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
["GlassesCracked",{
|
|
||||||
if (_this select 0 != ace_player) exitWith {};
|
["GlassesCracked", {
|
||||||
ace_player setVariable ["ACE_EyesDamaged", true];
|
params ["_unit"];
|
||||||
if (GVAR(EyesDamageScript) != -1) then {
|
|
||||||
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
|
_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]];
|
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) ppEffectCommit 0;
|
||||||
GVAR(PostProcessEyes) ppEffectEnable true;
|
GVAR(PostProcessEyes) ppEffectEnable true;
|
||||||
GVAR(EyesDamageScript) = [{
|
|
||||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
|
[{
|
||||||
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]];
|
||||||
GVAR(PostProcessEyes) ppEffectCommit 5;
|
GVAR(PostProcessEyes) ppEffectCommit 5;
|
||||||
|
|
||||||
GVAR(EyesDamageScript) = [{
|
GVAR(EyesDamageScript) = [{
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
|
||||||
GVAR(EyesDamageScript) = -1;
|
_unit setVariable ["ACE_EyesDamaged", false];
|
||||||
}, [], 5, 1] call EFUNC(common,waitAndExecute);
|
|
||||||
}, [], 25, 5] call EFUNC(common,waitAndExecute);
|
}, _this, 5] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
|
}, _unit, 25] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
call FUNC(checkGlasses);
|
|
||||||
[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler;
|
// check goggles
|
||||||
[FUNC(rainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler;
|
local _fnc_checkGoggles = {
|
||||||
[FUNC(onEachFrame), 0, []] call CBA_fnc_addPerFrameHandler;
|
params ["_unit"];
|
||||||
|
|
||||||
|
if (GVAR(EffectsActive)) then {
|
||||||
|
if (call FUNC(externalCamera) || {!([_unit] call FUNC(isGogglesVisible))}) then {
|
||||||
|
call FUNC(removeGlassesEffect);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (!(call FUNC(externalCamera)) && {[_unit] call FUNC(isGogglesVisible)}) then {
|
||||||
|
[goggles _unit] call FUNC(applyGlassesEffect);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
["cameraViewChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler);
|
||||||
|
["activeCameraChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
// goggles effects main PFH
|
||||||
|
[{
|
||||||
|
// rain
|
||||||
|
call FUNC(applyRainEffect);
|
||||||
|
|
||||||
|
// auto remove effects under water
|
||||||
|
if (GVAR(EffectsActive) && {[goggles ACE_player] call FUNC(isDivingGoggles) && {underwater ACE_player}}) then {
|
||||||
|
call FUNC(removeRainEffect);
|
||||||
|
call FUNC(removeDirtEffect);
|
||||||
|
call FUNC(removeDustEffect);
|
||||||
|
};
|
||||||
|
|
||||||
|
// rotor wash effect
|
||||||
|
call FUNC(applyRotorWashEffect)
|
||||||
|
}, 0.5, _fnc_checkGoggles] call CBA_fnc_addPerFrameHandler;
|
||||||
|
@ -1,42 +1,31 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Initialises Goggles.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
|
// effects
|
||||||
PREP(applyDirtEffect);
|
PREP(applyDirtEffect);
|
||||||
PREP(applyDust);
|
PREP(applyDustEffect);
|
||||||
PREP(applyGlassesEffect);
|
PREP(applyGlassesEffect);
|
||||||
|
PREP(applyRainEffect);
|
||||||
PREP(checkGoggles);
|
PREP(applyRotorWashEffect);
|
||||||
PREP(clearGlasses);
|
|
||||||
PREP(dustHandler);
|
|
||||||
PREP(externalCamera);
|
|
||||||
PREP(getExplosionIndex);
|
|
||||||
|
|
||||||
PREP(isDivingGoggles);
|
|
||||||
PREP(isGogglesVisible);
|
|
||||||
PREP(isInRotorWash);
|
|
||||||
|
|
||||||
PREP(onEachFrame);
|
|
||||||
PREP(rainEffect);
|
|
||||||
|
|
||||||
PREP(removeDirtEffect);
|
PREP(removeDirtEffect);
|
||||||
PREP(removeDustEffect);
|
PREP(removeDustEffect);
|
||||||
PREP(removeGlassesEffect);
|
PREP(removeGlassesEffect);
|
||||||
PREP(removeRainEffect);
|
PREP(removeRainEffect);
|
||||||
|
|
||||||
|
// public
|
||||||
|
PREP(externalCamera);
|
||||||
|
PREP(isDivingGoggles);
|
||||||
|
PREP(isGogglesVisible);
|
||||||
|
PREP(isInRotorWash);
|
||||||
|
|
||||||
|
// general
|
||||||
|
PREP(clearGlasses);
|
||||||
|
PREP(getExplosionIndex);
|
||||||
|
|
||||||
|
// eventhandlers
|
||||||
|
PREP(handleExplosion);
|
||||||
|
PREP(handleFired);
|
||||||
|
PREP(handleKilled);
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -1,128 +1,133 @@
|
|||||||
class CfgSkeletons
|
|
||||||
{
|
class CfgSkeletons {
|
||||||
class Default
|
class Default {
|
||||||
{
|
isDiscrete = 1;
|
||||||
isDiscrete = 1;
|
skeletonInherit = "";
|
||||||
skeletonInherit = "";
|
skeletonBones[] = {};
|
||||||
skeletonBones[] = {};
|
};
|
||||||
};
|
|
||||||
class OFP2_ManSkeleton
|
class OFP2_ManSkeleton {
|
||||||
{
|
isDiscrete = 0;
|
||||||
isDiscrete = 0;
|
skeletonInherit = "";
|
||||||
skeletonInherit = "";
|
skeletonBones[] = {
|
||||||
skeletonBones[] =
|
"Pelvis","",
|
||||||
{
|
"Spine","Pelvis",
|
||||||
"Pelvis","",
|
"Spine1","Spine",
|
||||||
"Spine","Pelvis",
|
"Spine2","Spine1",
|
||||||
"Spine1","Spine",
|
"Spine3","Spine2",
|
||||||
"Spine2","Spine1",
|
"Camera","Pelvis",
|
||||||
"Spine3","Spine2",
|
"weapon","Spine1",
|
||||||
"Camera","Pelvis",
|
"launcher","Spine1",
|
||||||
"weapon","Spine1",
|
|
||||||
"launcher","Spine1",
|
//Head skeleton in hierarchy
|
||||||
//Head skeleton in hierarchy
|
"neck","Spine3",
|
||||||
"neck","Spine3",
|
"neck1","neck",
|
||||||
"neck1","neck",
|
"head","neck1",
|
||||||
"head","neck1",
|
|
||||||
//New facial features
|
//New facial features
|
||||||
"Face_Hub","head",
|
"Face_Hub","head",
|
||||||
"Face_Jawbone","Face_Hub",
|
"Face_Jawbone","Face_Hub",
|
||||||
"Face_Jowl","Face_Jawbone",
|
"Face_Jowl","Face_Jawbone",
|
||||||
"Face_chopRight","Face_Jawbone",
|
"Face_chopRight","Face_Jawbone",
|
||||||
"Face_chopLeft","Face_Jawbone",
|
"Face_chopLeft","Face_Jawbone",
|
||||||
"Face_LipLowerMiddle","Face_Jawbone",
|
"Face_LipLowerMiddle","Face_Jawbone",
|
||||||
"Face_LipLowerLeft","Face_Jawbone",
|
"Face_LipLowerLeft","Face_Jawbone",
|
||||||
"Face_LipLowerRight","Face_Jawbone",
|
"Face_LipLowerRight","Face_Jawbone",
|
||||||
"Face_Chin","Face_Jawbone",
|
"Face_Chin","Face_Jawbone",
|
||||||
"Face_Tongue","Face_Jawbone",
|
"Face_Tongue","Face_Jawbone",
|
||||||
"Face_CornerRight","Face_Hub",
|
"Face_CornerRight","Face_Hub",
|
||||||
"Face_CheekSideRight","Face_CornerRight",
|
"Face_CheekSideRight","Face_CornerRight",
|
||||||
"Face_CornerLeft","Face_Hub",
|
"Face_CornerLeft","Face_Hub",
|
||||||
"Face_CheekSideLeft","Face_CornerLeft",
|
"Face_CheekSideLeft","Face_CornerLeft",
|
||||||
"Face_CheekFrontRight","Face_Hub",
|
"Face_CheekFrontRight","Face_Hub",
|
||||||
"Face_CheekFrontLeft","Face_Hub",
|
"Face_CheekFrontLeft","Face_Hub",
|
||||||
"Face_CheekUpperRight","Face_Hub",
|
"Face_CheekUpperRight","Face_Hub",
|
||||||
"Face_CheekUpperLeft","Face_Hub",
|
"Face_CheekUpperLeft","Face_Hub",
|
||||||
"Face_LipUpperMiddle","Face_Hub",
|
"Face_LipUpperMiddle","Face_Hub",
|
||||||
"Face_LipUpperRight","Face_Hub",
|
"Face_LipUpperRight","Face_Hub",
|
||||||
"Face_LipUpperLeft","Face_Hub",
|
"Face_LipUpperLeft","Face_Hub",
|
||||||
"Face_NostrilRight","Face_Hub",
|
"Face_NostrilRight","Face_Hub",
|
||||||
"Face_NostrilLeft","Face_Hub",
|
"Face_NostrilLeft","Face_Hub",
|
||||||
"Face_Forehead","Face_Hub",
|
"Face_Forehead","Face_Hub",
|
||||||
"Face_BrowFrontRight","Face_Forehead",
|
"Face_BrowFrontRight","Face_Forehead",
|
||||||
"Face_BrowFrontLeft","Face_Forehead",
|
"Face_BrowFrontLeft","Face_Forehead",
|
||||||
"Face_BrowMiddle","Face_Forehead",
|
"Face_BrowMiddle","Face_Forehead",
|
||||||
"Face_BrowSideRight","Face_Forehead",
|
"Face_BrowSideRight","Face_Forehead",
|
||||||
"Face_BrowSideLeft","Face_Forehead",
|
"Face_BrowSideLeft","Face_Forehead",
|
||||||
"Face_Eyelids","Face_Hub",
|
"Face_Eyelids","Face_Hub",
|
||||||
"Face_EyelidUpperRight","Face_Hub",
|
"Face_EyelidUpperRight","Face_Hub",
|
||||||
"Face_EyelidUpperLeft","Face_Hub",
|
"Face_EyelidUpperLeft","Face_Hub",
|
||||||
"Face_EyelidLowerRight","Face_Hub",
|
"Face_EyelidLowerRight","Face_Hub",
|
||||||
"Face_EyelidLowerLeft","Face_Hub",
|
"Face_EyelidLowerLeft","Face_Hub",
|
||||||
"EyeLeft","Face_Hub",
|
"EyeLeft","Face_Hub",
|
||||||
"EyeRight","Face_Hub",
|
"EyeRight","Face_Hub",
|
||||||
//Left upper side
|
|
||||||
"LeftShoulder","Spine3",
|
//Left upper side
|
||||||
"LeftArm","LeftShoulder",
|
"LeftShoulder","Spine3",
|
||||||
"LeftArmRoll","LeftArm",
|
"LeftArm","LeftShoulder",
|
||||||
"LeftForeArm","LeftArmRoll",
|
"LeftArmRoll","LeftArm",
|
||||||
"LeftForeArmRoll","LeftForeArm",
|
"LeftForeArm","LeftArmRoll",
|
||||||
"LeftHand","LeftForeArmRoll",
|
"LeftForeArmRoll","LeftForeArm",
|
||||||
"LeftHandRing","LeftHand",
|
"LeftHand","LeftForeArmRoll",
|
||||||
"LeftHandRing1","LeftHandRing",
|
"LeftHandRing","LeftHand",
|
||||||
"LeftHandRing2","LeftHandRing1",
|
"LeftHandRing1","LeftHandRing",
|
||||||
"LeftHandRing3","LeftHandRing2",
|
"LeftHandRing2","LeftHandRing1",
|
||||||
"LeftHandPinky1","LeftHandRing",
|
"LeftHandRing3","LeftHandRing2",
|
||||||
"LeftHandPinky2","LeftHandPinky1",
|
"LeftHandPinky1","LeftHandRing",
|
||||||
"LeftHandPinky3","LeftHandPinky2",
|
"LeftHandPinky2","LeftHandPinky1",
|
||||||
"LeftHandMiddle1","LeftHand",
|
"LeftHandPinky3","LeftHandPinky2",
|
||||||
"LeftHandMiddle2","LeftHandMiddle1",
|
"LeftHandMiddle1","LeftHand",
|
||||||
"LeftHandMiddle3","LeftHandMiddle2",
|
"LeftHandMiddle2","LeftHandMiddle1",
|
||||||
"LeftHandIndex1","LeftHand",
|
"LeftHandMiddle3","LeftHandMiddle2",
|
||||||
"LeftHandIndex2","LeftHandIndex1",
|
"LeftHandIndex1","LeftHand",
|
||||||
"LeftHandIndex3","LeftHandIndex2",
|
"LeftHandIndex2","LeftHandIndex1",
|
||||||
"LeftHandThumb1","LeftHand",
|
"LeftHandIndex3","LeftHandIndex2",
|
||||||
"LeftHandThumb2","LeftHandThumb1",
|
"LeftHandThumb1","LeftHand",
|
||||||
"LeftHandThumb3","LeftHandThumb2",
|
"LeftHandThumb2","LeftHandThumb1",
|
||||||
//Right upper side
|
"LeftHandThumb3","LeftHandThumb2",
|
||||||
"RightShoulder","Spine3",
|
|
||||||
"RightArm","RightShoulder",
|
//Right upper side
|
||||||
"RightArmRoll","RightArm",
|
"RightShoulder","Spine3",
|
||||||
"RightForeArm","RightArmRoll",
|
"RightArm","RightShoulder",
|
||||||
"RightForeArmRoll","RightForeArm",
|
"RightArmRoll","RightArm",
|
||||||
"RightHand","RightForeArmRoll",
|
"RightForeArm","RightArmRoll",
|
||||||
"RightHandRing","RightHand",
|
"RightForeArmRoll","RightForeArm",
|
||||||
"RightHandRing1","RightHandRing",
|
"RightHand","RightForeArmRoll",
|
||||||
"RightHandRing2","RightHandRing1",
|
"RightHandRing","RightHand",
|
||||||
"RightHandRing3","RightHandRing2",
|
"RightHandRing1","RightHandRing",
|
||||||
"RightHandPinky1","RightHandRing",
|
"RightHandRing2","RightHandRing1",
|
||||||
"RightHandPinky2","RightHandPinky1",
|
"RightHandRing3","RightHandRing2",
|
||||||
"RightHandPinky3","RightHandPinky2",
|
"RightHandPinky1","RightHandRing",
|
||||||
"RightHandMiddle1","RightHand",
|
"RightHandPinky2","RightHandPinky1",
|
||||||
"RightHandMiddle2","RightHandMiddle1",
|
"RightHandPinky3","RightHandPinky2",
|
||||||
"RightHandMiddle3","RightHandMiddle2",
|
"RightHandMiddle1","RightHand",
|
||||||
"RightHandIndex1","RightHand",
|
"RightHandMiddle2","RightHandMiddle1",
|
||||||
"RightHandIndex2","RightHandIndex1",
|
"RightHandMiddle3","RightHandMiddle2",
|
||||||
"RightHandIndex3","RightHandIndex2",
|
"RightHandIndex1","RightHand",
|
||||||
"RightHandThumb1","RightHand",
|
"RightHandIndex2","RightHandIndex1",
|
||||||
"RightHandThumb2","RightHandThumb1",
|
"RightHandIndex3","RightHandIndex2",
|
||||||
"RightHandThumb3","RightHandThumb2",
|
"RightHandThumb1","RightHand",
|
||||||
//Left lower side
|
"RightHandThumb2","RightHandThumb1",
|
||||||
"LeftUpLeg","Pelvis",
|
"RightHandThumb3","RightHandThumb2",
|
||||||
"LeftUpLegRoll","LeftUpLeg",
|
|
||||||
"LeftLeg","LeftUpLegRoll",
|
//Left lower side
|
||||||
"LeftLegRoll","LeftLeg",
|
"LeftUpLeg","Pelvis",
|
||||||
"LeftFoot","LeftLegRoll",
|
"LeftUpLegRoll","LeftUpLeg",
|
||||||
"LeftToeBase","LeftFoot",
|
"LeftLeg","LeftUpLegRoll",
|
||||||
//Right lower side
|
"LeftLegRoll","LeftLeg",
|
||||||
"RightUpLeg","Pelvis",
|
"LeftFoot","LeftLegRoll",
|
||||||
"RightUpLegRoll","RightUpLeg",
|
"LeftToeBase","LeftFoot",
|
||||||
"RightLeg","RightUpLegRoll",
|
|
||||||
"RightLegRoll","RightLeg",
|
//Right lower side
|
||||||
"RightFoot","RightLegRoll",
|
"RightUpLeg","Pelvis",
|
||||||
"RightToeBase","RightFoot"
|
"RightUpLegRoll","RightUpLeg",
|
||||||
};
|
"RightLeg","RightUpLegRoll",
|
||||||
// location of pivot points (local axes) for hierarchical animation
|
"RightLegRoll","RightLeg",
|
||||||
pivotsModel="A3\anims_f\data\skeleton\SkeletonPivots.p3d";
|
"RightFoot","RightLegRoll",
|
||||||
};
|
"RightToeBase","RightFoot"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// location of pivot points (local axes) for hierarchical animation
|
||||||
|
pivotsModel="A3\anims_f\data\skeleton\SkeletonPivots.p3d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -9,23 +9,29 @@
|
|||||||
* Succeeded <BOOL>
|
* Succeeded <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* _applied = call ace_goggles_fnc_ApplyDirtEffect;
|
* _applied = call ace_goggles_fnc_applyDirtEffect
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false};
|
if (GVAR(showInThirdPerson)) exitWith {false};
|
||||||
private ["_dirtImage", "_applied", "_effects"];
|
if (call FUNC(externalCamera)) exitWith {false};
|
||||||
_effects = GETGLASSES(ace_player);
|
|
||||||
|
private ["_unit", "_effects"];
|
||||||
|
|
||||||
|
_unit = ACE_player;
|
||||||
|
|
||||||
|
_effects = GETGLASSES(_unit);
|
||||||
_effects set [DIRT, true];
|
_effects set [DIRT, true];
|
||||||
SETGLASSES(ace_player,_effects);
|
|
||||||
|
|
||||||
if ([ace_player] call FUNC(isGogglesVisible)) then{
|
SETGLASSES(_unit,_effects);
|
||||||
_dirtImage = getText(ConfigFile >> "CfgGlasses" >> (goggles ace_player) >> "ACE_OverlayDirt");
|
|
||||||
|
if ([_unit] call FUNC(isGogglesVisible)) then {
|
||||||
|
local _dirtImage = getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_OverlayDirt");
|
||||||
|
|
||||||
if (_dirtImage != "") then {
|
if (_dirtImage != "") then {
|
||||||
100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false];
|
GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 0.1, false];
|
||||||
|
|
||||||
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage;
|
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Applies dust to screen.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* call ace_goggles_fnc_ApplyDust;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
if (call FUNC(ExternalCamera)) exitWith {};
|
|
||||||
if ([ace_player] call FUNC(isGogglesVisible)) exitWith {
|
|
||||||
100 cutRsc["RscACE_GogglesEffects", "PLAIN",2,false];
|
|
||||||
(uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_DustPath"), GETDUSTT(DAMOUNT)+1];
|
|
||||||
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1));
|
|
||||||
SETDUST(DBULLETS,0);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (GETVAR(ace_player,ACE_EyesDamaged,false)) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);};
|
|
||||||
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2));
|
|
||||||
|
|
||||||
private "_amount";
|
|
||||||
_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;
|
|
||||||
};
|
|
||||||
GVAR(DustHandler) = [{
|
|
||||||
if (ACE_diagTime >= 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) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
|
|
||||||
GVAR(PostProcessEyes) ppEffectCommit 2;
|
|
||||||
[{GVAR(PostProcessEyes) ppEffectEnable false;}, [], 2, 0.5] call EFUNC(common,waitAndExecute);
|
|
||||||
SETDUST(DACTIVE,false);
|
|
||||||
SETDUST(DBULLETS,0);
|
|
||||||
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
|
||||||
GVAR(DustHandler) = -1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
},0,[]] call CALLSTACK(CBA_fnc_addPerFrameHandler);
|
|
81
addons/goggles/functions/fnc_applyDustEffect.sqf
Normal file
81
addons/goggles/functions/fnc_applyDustEffect.sqf
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Author: Garth 'L-H' de Wet
|
||||||
|
* Applies dust to screen.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* call ace_goggles_fnc_applyDustEffect
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
if (GVAR(showInThirdPerson)) exitWith {};
|
||||||
|
if (call FUNC(ExternalCamera)) exitWith {};
|
||||||
|
|
||||||
|
private ["_unit", "_amount"];
|
||||||
|
|
||||||
|
_unit = ACE_player;
|
||||||
|
|
||||||
|
if ([_unit] call FUNC(isGogglesVisible)) exitWith {
|
||||||
|
GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 2, false];
|
||||||
|
|
||||||
|
((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetText format [getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_DustPath"), GETDUSTT(DAMOUNT) + 1];
|
||||||
|
|
||||||
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,1));
|
||||||
|
SETDUST(DBULLETS,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GETVAR(_unit,ACE_EyesDamaged,false)) exitWith {
|
||||||
|
SETDUST(DACTIVE,false);
|
||||||
|
SETDUST(DBULLETS,0);
|
||||||
|
SETDUST(DAMOUNT,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,2));
|
||||||
|
|
||||||
|
_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);
|
||||||
|
|
||||||
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
GVAR(DustHandler) = -1;
|
||||||
|
|
||||||
|
GVAR(DustHandler) = [{
|
||||||
|
if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then {
|
||||||
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
||||||
|
|
||||||
|
local _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
||||||
|
|
||||||
|
if !(_unit 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 {
|
||||||
|
SETDUST(DACTIVE,false);
|
||||||
|
SETDUST(DBULLETS,0);
|
||||||
|
|
||||||
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]];
|
||||||
|
GVAR(PostProcessEyes) ppEffectCommit 2;
|
||||||
|
|
||||||
|
[{
|
||||||
|
if (GVAR(DustHandler) == -1) then {
|
||||||
|
GVAR(PostProcessEyes) ppEffectEnable false
|
||||||
|
};
|
||||||
|
}, [], 2] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
GVAR(DustHandler) = -1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
@ -11,20 +11,23 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [goggles ace_player] call ace_goggles_fnc_ApplyGlassesEffect;
|
* [goggles ace_player] call ace_goggles_fnc_applyGlassesEffect
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"];
|
params ["_glasses"];
|
||||||
|
|
||||||
_glassesClassname = _this select 0;
|
|
||||||
_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color");
|
|
||||||
_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount");
|
|
||||||
|
|
||||||
|
// remove old effect
|
||||||
call FUNC(removeGlassesEffect);
|
call FUNC(removeGlassesEffect);
|
||||||
GVAR(EffectsActive) = true;
|
|
||||||
|
private ["_config", "_postProcessColour", "_postProcessTintAmount", "_imagePath"];
|
||||||
|
|
||||||
|
_config = configFile >> "CfgGlasses" >> _glasses;
|
||||||
|
|
||||||
|
_postProcessColour = getArray (_config >> "ACE_Color");
|
||||||
|
_postProcessTintAmount = getNumber (_config >> "ACE_TintAmount");
|
||||||
|
|
||||||
if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then {
|
if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then {
|
||||||
_postProcessColour set [3, _postProcessTintAmount/100];
|
_postProcessColour set [3, _postProcessTintAmount/100];
|
||||||
@ -36,20 +39,20 @@ if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then {
|
|||||||
GVAR(PostProcess) ppEffectCommit 30;
|
GVAR(PostProcess) ppEffectCommit 30;
|
||||||
};
|
};
|
||||||
|
|
||||||
_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Overlay");
|
_imagePath = getText (_config >> ["ACE_Overlay", "ACE_OverlayCracked"] select GETBROKEN);
|
||||||
if GETBROKEN then {
|
|
||||||
_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_OverlayCracked");
|
if (_imagePath != "") then {
|
||||||
};
|
GVAR(GogglesLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false];
|
||||||
if (_glassImagePath != "") then {
|
(GLASSDISPLAY displayCtrl 10650) ctrlSetText _imagePath;
|
||||||
150 cutRsc["RscACE_Goggles", "PLAIN",1, false];
|
|
||||||
(GLASSDISPLAY displayCtrl 10650) ctrlSetText _glassImagePath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if GETDIRT then {
|
if (GETDIRT) then {
|
||||||
call FUNC(applyDirtEffect);
|
call FUNC(applyDirtEffect);
|
||||||
};
|
};
|
||||||
|
|
||||||
if GETDUSTT(DACTIVE) then {
|
if (GETDUSTT(DACTIVE)) then {
|
||||||
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
||||||
call FUNC(applyDust);
|
call FUNC(applyDustEffect);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GVAR(EffectsActive) = true;
|
||||||
|
68
addons/goggles/functions/fnc_applyRainEffect.sqf
Normal file
68
addons/goggles/functions/fnc_applyRainEffect.sqf
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Author: Garth 'L-H' de Wet
|
||||||
|
* Handles rain effects being created on glasses.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* call ace_goggles_fnc_applyRainEffect;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit", "_fnc_underCover"];
|
||||||
|
|
||||||
|
_unit = ACE_player;
|
||||||
|
|
||||||
|
if (!alive _unit) exitWith {};
|
||||||
|
|
||||||
|
_fnc_underCover = {
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true};
|
||||||
|
|
||||||
|
// looking up and no roof over head
|
||||||
|
local _position = eyePos _unit;
|
||||||
|
positionCameraToWorld [0, 0, 1] select 2 < (positionCameraToWorld [0, 0, 0] select 2) - 0.4 || {(lineIntersects [_position, _position vectorAdd [0, 0, 15], _unit])} // return
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!isNull findDisplay 312) exitWith {
|
||||||
|
if (GVAR(RainActive)) then {
|
||||||
|
call FUNC(removeRainEffect);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ignore if unit is under water
|
||||||
|
if !(GVAR(EffectsActive) || {underwater _unit}) exitWith {
|
||||||
|
call FUNC(RemoveRainEffect);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GVAR(RainLastLevel) != rain) then {
|
||||||
|
call FUNC(RemoveRainEffect);
|
||||||
|
|
||||||
|
GVAR(RainLastLevel) = rain;
|
||||||
|
|
||||||
|
// Rain is happening
|
||||||
|
if (GVAR(RainLastLevel) > 0.05 && {!([_unit] call _fnc_underCover)}) then {
|
||||||
|
GVAR(RainActive) = true;
|
||||||
|
GVAR(RainDrops) = "#particlesource" createVehicleLocal position _unit;
|
||||||
|
GVAR(RainDrops) setParticleClass "ACERainEffect";
|
||||||
|
GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel)));
|
||||||
|
GVAR(RainDrops) attachTo [vehicle _unit, [0,0,0]];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (GVAR(RainLastLevel) > 0.05) then {
|
||||||
|
if (GVAR(RainActive) && {[_unit] call _fnc_underCover}) exitWith {
|
||||||
|
call FUNC(RemoveRainEffect);
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(GVAR(RainActive)) then {
|
||||||
|
GVAR(RainLastLevel) = -1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
108
addons/goggles/functions/fnc_applyRotorWashEffect.sqf
Normal file
108
addons/goggles/functions/fnc_applyRotorWashEffect.sqf
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Author: Garth 'L-H' de Wet, commy2
|
||||||
|
* Handles the rotor wash effects.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* call ace_goggles_fnc_applyRotorWashEffect;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit", "_fnc_underCover"];
|
||||||
|
|
||||||
|
_unit = ACE_player;
|
||||||
|
|
||||||
|
if (!alive _unit) exitWith {};
|
||||||
|
|
||||||
|
// idk. chaching magic? ends with isInRotorWash check.
|
||||||
|
GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)];
|
||||||
|
|
||||||
|
if (GVAR(FrameEvent) select 0) exitWith {
|
||||||
|
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {
|
||||||
|
(GVAR(FrameEvent) select 1) set [0, false];
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(FrameEvent) set [1, ([_unit] call FUNC(isInRotorWash))];
|
||||||
|
};
|
||||||
|
|
||||||
|
// check if the unit is affected by rotor wash
|
||||||
|
private ["_rotorWash", "_safe"];
|
||||||
|
|
||||||
|
_rotorWash = GVAR(FrameEvent) select 1;
|
||||||
|
_safe = false;
|
||||||
|
|
||||||
|
// no rotor wash? remove effects.
|
||||||
|
if !(_rotorWash select 0) exitWith {
|
||||||
|
if (GVAR(PostProcessEyes_Enabled)) then {
|
||||||
|
GVAR(PostProcessEyes_Enabled) = false;
|
||||||
|
|
||||||
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [1, 1, 1, 0]];
|
||||||
|
GVAR(PostProcessEyes) ppEffectCommit 2;
|
||||||
|
|
||||||
|
[{
|
||||||
|
if (GVAR(DustHandler) == -1) then {
|
||||||
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||||
|
}
|
||||||
|
}, [], 2] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
GVAR(DustHandler) = -1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// check protection of helmet
|
||||||
|
if (headgear _unit != "") then {
|
||||||
|
_safe = getNumber (configFile >> "CfgWeapons" >> headgear _unit >> "ACE_Protection") == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// check protection of goggles
|
||||||
|
if !(_safe) then {
|
||||||
|
if !([_unit] call FUNC(isGogglesVisible)) exitWith {};
|
||||||
|
|
||||||
|
if (GETDUSTT(DAMOUNT) < 2) then {
|
||||||
|
if !(GETDUSTT(DACTIVE)) then {
|
||||||
|
SETDUST(DACTIVE,true);
|
||||||
|
|
||||||
|
call FUNC(applyDustEffect);
|
||||||
|
} else {
|
||||||
|
if (_rotorWash select 1 > 0.5) then {
|
||||||
|
call FUNC(applyDustEffect);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_safe = getNumber (ConfigFile >> "CfgGlasses" >> goggles _unit >> "ACE_Protection") == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// quit if protected by goggles or helmet
|
||||||
|
if (_safe) exitWith {};
|
||||||
|
|
||||||
|
// apply rotor wash effect
|
||||||
|
if (_rotorWash select 1 > 0) then {
|
||||||
|
local _scale = 0.7;
|
||||||
|
|
||||||
|
if (_rotorWash select 1 > 0) then {
|
||||||
|
_scale = CLAMP(0.3 * (_rotorWash select 1),0.1,0.3);
|
||||||
|
} else {
|
||||||
|
_scale = 0.1;
|
||||||
|
};
|
||||||
|
|
||||||
|
_scale = 1 - _scale;
|
||||||
|
|
||||||
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
GVAR(DustHandler) = -1;
|
||||||
|
|
||||||
|
if !(_unit getVariable ["ACE_EyesDamaged", false]) then {
|
||||||
|
GVAR(PostProcessEyes_Enabled) = true;
|
||||||
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_scale, _scale, _scale, _scale], [1, 1, 1, 0]];
|
||||||
|
GVAR(PostProcessEyes) ppEffectCommit 0.5;
|
||||||
|
GVAR(PostProcessEyes) ppEffectEnable true;
|
||||||
|
};
|
||||||
|
};
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Performs rain checks and checks to see whether glasses effects have been applied or not.
|
|
||||||
* Checks for external camera and removes effects.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
if (!alive ace_player) exitWith {};
|
|
||||||
if (true) then {
|
|
||||||
// Detect if curator interface is open and disable effects
|
|
||||||
if !(isNull curatorCamera) 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 !(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);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
@ -10,27 +10,31 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_goggles_fnc_ClearGlasses;
|
* call ace_goggles_fnc_clearGlasses
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_broken", "_effects"];
|
private ["_unit", "_broken", "_effects"];
|
||||||
|
|
||||||
|
_unit = ACE_player;
|
||||||
|
|
||||||
_broken = GETBROKEN;
|
_broken = GETBROKEN;
|
||||||
_effects = GLASSESDEFAULT;
|
_effects = GLASSESDEFAULT;
|
||||||
_effects set [BROKEN, _broken];
|
_effects set [BROKEN, _broken];
|
||||||
SETGLASSES(ace_player,_effects);
|
|
||||||
|
|
||||||
if ((stance ace_player) != "PRONE") then {
|
SETGLASSES(_unit,_effects);
|
||||||
ace_player playActionNow "gestureWipeFace";
|
|
||||||
|
if (stance _unit != "PRONE") then {
|
||||||
|
_unit playActionNow "gestureWipeFace";
|
||||||
};
|
};
|
||||||
|
|
||||||
[{
|
[{
|
||||||
if (cameraView == "INTERNAL") then {
|
if (cameraView == "INTERNAL") then {
|
||||||
addCamShake [5, 1.75, 2];
|
addCamShake [5, 1.75, 2];
|
||||||
};
|
};
|
||||||
}, [], 0.3, 0] call EFUNC(common,waitAndExecute);
|
}, [], 0.3] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
call FUNC(removeDirtEffect);
|
call FUNC(removeDirtEffect);
|
||||||
call FUNC(removeRainEffect);
|
call FUNC(removeRainEffect);
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Unit <OBJECT>
|
|
||||||
* 1: Weapon <STRING>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
*ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call ace_goggles_fnc_dustHandler;}];
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
private ["_bullets", "_position", "_surface", "_weapon", "_cloudType", "_unit"];
|
|
||||||
EXPLODE_2_PVT(_this,_unit,_weapon);
|
|
||||||
if (_unit != ace_player) exitWith {true};
|
|
||||||
_cloudType = "";
|
|
||||||
|
|
||||||
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");
|
|
||||||
} else {
|
|
||||||
if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "effect1")) then {
|
|
||||||
_cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "effect1" >> "effectName");
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_cloudType == "") exitWith {true};
|
|
||||||
|
|
||||||
_position = getPosATL _unit;
|
|
||||||
|
|
||||||
if (surfaceIsWater _position) exitWith {};
|
|
||||||
if ((_position select 2) > 0.2) exitWith {};
|
|
||||||
|
|
||||||
_surface = surfaceType _position;
|
|
||||||
|
|
||||||
if (_surface != GVAR(surfaceCache)) then {
|
|
||||||
GVAR(surfaceCache) = _surface;
|
|
||||||
_surface = ([_surface, "#"] call CBA_fnc_split) select 1;
|
|
||||||
GVAR(surfaceCacheIsDust) = getNumber (ConfigFile >> "CfgSurfaces" >> _surface >> "dust") >= 0.1;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!GVAR(surfaceCacheIsDust)) exitWith {};
|
|
||||||
|
|
||||||
_bullets = GETDUSTT(DBULLETS);
|
|
||||||
|
|
||||||
if ((ACE_diagTime - GETDUSTT(DTIME)) > 1) then {
|
|
||||||
_bullets = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
_bullets = _bullets + 1;
|
|
||||||
SETDUST(DBULLETS,_bullets);
|
|
||||||
SETDUST(DTIME,ACE_diagTime);
|
|
||||||
|
|
||||||
if (GETDUSTT(DAMOUNT) < 2) then {
|
|
||||||
private "_bulletsRequired";
|
|
||||||
_bulletsRequired = 100;
|
|
||||||
if (isNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount")) then {
|
|
||||||
_bulletsRequired = getNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount");
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_bulletsRequired <= _bullets) then {
|
|
||||||
SETDUST(DACTIVE,true);
|
|
||||||
call FUNC(applyDust);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
true
|
|
@ -6,15 +6,13 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Whether the camera is in external view or not. If the "showInThirdPerson" option is checked, this will always return false. <BOOL>
|
* Whether the camera is in external view or not. <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_goggles_fnc_removeRainEffect;
|
* call ace_goggles_fnc_externalCamera;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (GVAR(showInThirdPerson)) exitWith { false };
|
cameraView in ["EXTERNAL", "GROUP"] || EFUNC(common,isFeatureCameraActive) // return
|
||||||
|
|
||||||
(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)})
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Garth 'L-H' de Wet
|
* Author: Garth 'L-H' de Wet, commy2
|
||||||
* Turns 0-1 damage of explosion Event into a rating system of 0-3
|
* Turns 0-1 damage of explosion Event into a rating system of 0-3
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -13,13 +13,12 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
private ["_effectIndex"];
|
#include "script_component.hpp"
|
||||||
|
|
||||||
_effectIndex = switch true do {
|
params ["_damage"];
|
||||||
case (_this <= 0.04): {0};
|
|
||||||
case (_this <= 0.06): {1};
|
|
||||||
case (_this <= 0.09): {2};
|
|
||||||
default {3};
|
|
||||||
};
|
|
||||||
|
|
||||||
_effectIndex
|
if (_damage <= 0.04) exitWith {0};
|
||||||
|
if (_damage <= 0.06) exitWith {1};
|
||||||
|
if (_damage <= 0.09) exitWith {2};
|
||||||
|
|
||||||
|
3
|
||||||
|
51
addons/goggles/functions/fnc_handleExplosion.sqf
Normal file
51
addons/goggles/functions/fnc_handleExplosion.sqf
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Author: Garth 'L-H' de Wet, commy2
|
||||||
|
* Handles explosions.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Function is handled? <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
if (_unit != ACE_player) exitWith {true};
|
||||||
|
|
||||||
|
call FUNC(applyDirtEffect);
|
||||||
|
|
||||||
|
if (GETBROKEN) exitWith {true};
|
||||||
|
|
||||||
|
private ["_config", "_effects"];
|
||||||
|
|
||||||
|
_config = configFile >> "CfgGlasses" >> goggles _unit;
|
||||||
|
|
||||||
|
if ((_this select 1) call FUNC(GetExplosionIndex) < getNumber (_config >> "ACE_Resistance")) exitWith {true};
|
||||||
|
|
||||||
|
if !([_unit] call FUNC(isGogglesVisible)) exitWith {
|
||||||
|
["GlassesCracked", [_unit]] call EFUNC(common,localEvent);
|
||||||
|
true
|
||||||
|
};
|
||||||
|
|
||||||
|
_effects = GETGLASSES(_unit);
|
||||||
|
_effects set [BROKEN, true];
|
||||||
|
|
||||||
|
SETGLASSES(_unit,_effects);
|
||||||
|
|
||||||
|
if (getText (_config >> "ACE_OverlayCracked") != "") then {
|
||||||
|
if (GVAR(showInThirdPerson)) exitWith {};
|
||||||
|
if (call FUNC(ExternalCamera)) exitWith {};
|
||||||
|
|
||||||
|
if (isNull (GLASSDISPLAY)) then {
|
||||||
|
GVAR(GogglesLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false];
|
||||||
|
};
|
||||||
|
|
||||||
|
(GLASSDISPLAY displayCtrl 10650) ctrlSetText getText (_config >> "ACE_OverlayCracked");
|
||||||
|
};
|
||||||
|
|
||||||
|
["GlassesCracked", [_unit]] call EFUNC(common,localEvent);
|
||||||
|
true
|
88
addons/goggles/functions/fnc_handleFired.sqf
Normal file
88
addons/goggles/functions/fnc_handleFired.sqf
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* Author: Garth 'L-H' de Wet, commy2
|
||||||
|
* Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Weapon <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Function is handled? <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit", "_weapon"];
|
||||||
|
|
||||||
|
if (_unit != ACE_player) exitWith {true};
|
||||||
|
|
||||||
|
// no dust in rain
|
||||||
|
if (rain > 0.1) exitWith {true};
|
||||||
|
|
||||||
|
// effect only aplies when lying on the ground
|
||||||
|
if (stance _unit != "PRONE") exitWith {true};
|
||||||
|
|
||||||
|
private ["_position", "_particleConfig", "_cloudType", "_surface", "_bullets"];
|
||||||
|
|
||||||
|
// check if the unit really is on the ground and not in a building
|
||||||
|
_position = getPosATL _unit;
|
||||||
|
|
||||||
|
if (_position select 2 > 0.2) exitWith {true};
|
||||||
|
|
||||||
|
// get weapon dust effect
|
||||||
|
_particleConfig = configFile >> "CfgWeapons" >> _weapon >> "GunParticles";
|
||||||
|
|
||||||
|
_cloudType = "";
|
||||||
|
|
||||||
|
if (isClass (_particleConfig >> "FirstEffect")) then { // @todo read this with custom / non-standard config classnames
|
||||||
|
_cloudType = getText (_particleConfig >> "FirstEffect" >> "effectName");
|
||||||
|
} else {
|
||||||
|
if (isClass (_particleConfig >> "effect1")) then {
|
||||||
|
_cloudType = getText (_particleConfig >> "effect1" >> "effectName");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// quit if the weapon causes no dust effect
|
||||||
|
if (_cloudType == "") exitWith {true};
|
||||||
|
|
||||||
|
// get if the surface is dusty
|
||||||
|
if (surfaceIsWater _position) exitWith {true};
|
||||||
|
|
||||||
|
_surface = surfaceType _position select [1]; // cuts of the leading #
|
||||||
|
|
||||||
|
if (_surface != GVAR(surfaceCache)) then {
|
||||||
|
GVAR(surfaceCache) = _surface;
|
||||||
|
GVAR(surfaceCacheIsDust) = getNumber (configFile >> "CfgSurfaces" >> _surface >> "dust") >= 0.1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// quit if surface isn't dusty
|
||||||
|
if (!GVAR(surfaceCacheIsDust)) exitWith {true};
|
||||||
|
|
||||||
|
// increment dust value with type bullet
|
||||||
|
_bullets = GETDUSTT(DBULLETS);
|
||||||
|
|
||||||
|
if (ACE_diagTime - GETDUSTT(DTIME) > 1) then {
|
||||||
|
_bullets = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
_bullets = _bullets + 1;
|
||||||
|
|
||||||
|
SETDUST(DBULLETS,_bullets);
|
||||||
|
SETDUST(DTIME,ACE_diagTime);
|
||||||
|
|
||||||
|
// apply dust effect if the amount of fired bullets is over the threshold
|
||||||
|
if (GETDUSTT(DAMOUNT) < 2) then {
|
||||||
|
local _bulletsRequired = 100;
|
||||||
|
|
||||||
|
if (isNumber (configFile >> _cloudType >> QGVAR(BulletCount))) then {
|
||||||
|
_bulletsRequired = getNumber (configFile >> _cloudType >> QGVAR(BulletCount));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_bullets > _bulletsRequired) then {
|
||||||
|
SETDUST(DACTIVE,true);
|
||||||
|
call FUNC(applyDustEffect);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
true
|
32
addons/goggles/functions/fnc_handleKilled.sqf
Normal file
32
addons/goggles/functions/fnc_handleKilled.sqf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Author: Garth 'L-H' de Wet, commy2
|
||||||
|
* Handles the player dying.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Function is handled? <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
|
||||||
|
if (_unit != ACE_player) exitWith {true};
|
||||||
|
|
||||||
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||||
|
|
||||||
|
SETGLASSES(_unit,GLASSESDEFAULT);
|
||||||
|
|
||||||
|
call FUNC(removeGlassesEffect);
|
||||||
|
|
||||||
|
GVAR(EffectsActive) = false;
|
||||||
|
|
||||||
|
_unit setVariable ["ACE_EyesDamaged", false];
|
||||||
|
|
||||||
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
GVAR(DustHandler) = -1;
|
||||||
|
|
||||||
|
true
|
@ -1,22 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Garth 'L-H' de Wet
|
* Author: commy2
|
||||||
* Determines whether passed goggles is diving goggles or a variant of them.
|
* Determines whether passed goggles is diving goggles or a variant of them.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Glasses classname <STRING>
|
* 0: Glasses classname <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Whether diving goggles are worn <BOOL>
|
* Check if these goggles are diving goggles <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [(goggles ace_player)] call ace_goggles_fnc_isDivingGoggles;
|
* [goggles ace_player] call ace_goggles_fnc_isDivingGoggles;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
private ["_result", "_glasses"];
|
|
||||||
_glasses = _this select 0;
|
params ["_glasses"];
|
||||||
_result = _glasses == "G_Diving";
|
|
||||||
if (_result) exitWith {true};
|
local _config = configFile >> "CfgGlasses" >> _glasses;
|
||||||
_result = [configFile >> "CfgGlasses" >> _glasses, configFile >> "CfgGlasses" >> "G_Diving"] call CBA_fnc_inheritsFrom;
|
|
||||||
_result
|
if (!isClass _config) exitWith {false};
|
||||||
|
|
||||||
|
getNumber (_config >> "mode") == 1 // return
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Garth 'L-H' de Wet
|
* Author: Garth 'L-H' de Wet
|
||||||
* Determines if goggles are visible on passed unit (Also checks if unit is in vehicle and cameraView is set to GUNNER)
|
* Determines if goggles are visible on passed unit.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
@ -16,20 +16,17 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
private ["_currentGlasses", "_result", "_position", "_visible"];
|
|
||||||
|
private ["_currentGlasses", "_position"];
|
||||||
|
|
||||||
_currentGlasses = goggles _unit;
|
_currentGlasses = goggles _unit;
|
||||||
_result = false;
|
|
||||||
|
|
||||||
if (_currentGlasses != "") then {
|
if (_currentGlasses == "") exitWith {false};
|
||||||
_position = getPosASLW _unit;
|
|
||||||
if (surfaceIsWater _position && {((_position select 2) < 0.25)}) exitWith {
|
|
||||||
_result = ([_currentGlasses] call FUNC(isDivingGoggles));
|
|
||||||
};
|
|
||||||
if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {
|
|
||||||
_result = false;
|
|
||||||
};
|
|
||||||
_result = !([_currentGlasses] call FUNC(isDivingGoggles));
|
|
||||||
};
|
|
||||||
|
|
||||||
_result
|
// requires ACE_Resistance config entry. Returns false for balaclavas and bandanas.
|
||||||
|
if (getNumber (configFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {false};
|
||||||
|
|
||||||
|
// check if in water and has diving goggles or on land and not diving goggles
|
||||||
|
_position = getPosASLW _unit;
|
||||||
|
|
||||||
|
(surfaceIsWater _position && {_position select 2 < 0.25}) isEqualTo (_currentGlasses call FUNC(isDivingGoggles)) // return
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Garth 'L-H' de Wet
|
* Author: Garth 'L-H' de Wet, commy2
|
||||||
* Checks for nearby running helicopters (within 15m)
|
* Checks for nearby running helicopters (within 15m)
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: Radius to check for helicopter Default: 15 (optional) <NUMBER>
|
* 1: Radius to check for helicopter (default: 15) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* <ARRAY>:
|
* <ARRAY>:
|
||||||
@ -12,35 +12,31 @@
|
|||||||
* 1: Amount of rotor wash. <NUMBER>
|
* 1: Amount of rotor wash. <NUMBER>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* if (([ace_player, 10] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
|
* if ([ace_player, 10] call ace_goggles_fnc_isInRotorWash select 0) then { hint "Rotor wash"; };
|
||||||
* if (([ace_player] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
|
* if ([ace_player] call ace_goggles_fnc_isInRotorWash select 0) then { hint "Rotor wash"; };
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
private ["_heli", "_unit", "_result", "_radius"];
|
|
||||||
_unit = _this select 0;
|
|
||||||
_radius = 15;
|
|
||||||
if (count _this > 1) then {
|
|
||||||
_radius = _this select 1;
|
|
||||||
};
|
|
||||||
_result = [false, _radius + 2];
|
|
||||||
|
|
||||||
_heli = (getPosATL _unit) nearEntities [["Helicopter"], _radius];
|
params ["_unit", ["_radius", 15]];
|
||||||
|
|
||||||
|
local _rotorWash = [false, 0];
|
||||||
|
|
||||||
{
|
{
|
||||||
if !(_x isKindOf "ParachuteBase") then {
|
if (isEngineOn _x) then {
|
||||||
if (isEngineOn _x) then {
|
local _distance = _unit distance _x;
|
||||||
private "_distance";
|
|
||||||
_distance = (_radius - (_unit distance _x));
|
// convert distance to 0...1 range, where 0 is the maximum radius
|
||||||
if (_distance != 0) then {
|
_distance = 1 - _distance / _radius;
|
||||||
_distance = _distance / _radius;
|
|
||||||
};
|
// use highest amount of rotor wash as return value in case of multiple helicopters
|
||||||
if (_distance < (_result select 1)) then {
|
if (_distance > _rotorWash select 1) then {
|
||||||
_result = [true, _distance];
|
_rotorWash set [0, true];
|
||||||
};
|
_rotorWash set [1, _distance];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
false
|
false
|
||||||
} count _heli;
|
} count (position _unit nearEntities [["Helicopter"], _radius]);
|
||||||
|
|
||||||
_result
|
_rotorWash
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Checks whether the player is in the downwash of a helicopter and handles applying effects of that.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["ACE_Goggles_RotorWash", "OnEachFrame", "call ace_goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler;
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
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 && {!isTurnedOut ACE_player}) exitWith {(GVAR(FrameEvent) select 1) set [0, false]; };
|
|
||||||
GVAR(FrameEvent) set [1, ([ace_player] call FUNC(isInRotorWash))];
|
|
||||||
};
|
|
||||||
private ["_rotorWash","_safe"];
|
|
||||||
_rotorWash = GVAR(FrameEvent) select 1;
|
|
||||||
_safe = false;
|
|
||||||
if !(_rotorWash select 0) exitWith {
|
|
||||||
if (GVAR(PostProcessEyes_Enabled)) then {
|
|
||||||
GVAR(PostProcessEyes_Enabled) = false;
|
|
||||||
if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
|
|
||||||
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
|
||||||
GVAR(DustHandler) = -1;
|
|
||||||
};
|
|
||||||
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 {
|
|
||||||
_safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear ace_player) >> "ACE_Protection") == 1);
|
|
||||||
};
|
|
||||||
if !(_safe) then {
|
|
||||||
if !([ace_player] call FUNC(isGogglesVisible)) exitWith{};
|
|
||||||
if (GETDUSTT(DAMOUNT) < 2) then {
|
|
||||||
if (!GETDUSTT(DACTIVE)) then {
|
|
||||||
SETDUST(DACTIVE,true);
|
|
||||||
call FUNC(ApplyDust);
|
|
||||||
} else {
|
|
||||||
if ((_rotorWash select 1) > 0.5) then {
|
|
||||||
call FUNC(ApplyDust);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
_safe = (getNumber (ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Protection") == 1);
|
|
||||||
};
|
|
||||||
if (_safe) exitWith {};
|
|
||||||
if ((_rotorWash select 1) <= 15) then {
|
|
||||||
private "_scale";
|
|
||||||
_scale = 0.7;
|
|
||||||
if ((_rotorWash select 1) != 0) then {
|
|
||||||
_scale = CLAMP(0.3*(_rotorWash select 1),0.1,0.3);
|
|
||||||
} else {
|
|
||||||
_scale = 0.1;
|
|
||||||
};
|
|
||||||
_scale = 1 - _scale;
|
|
||||||
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;
|
|
||||||
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [_scale,_scale,_scale,_scale],[1,1,1,0]];
|
|
||||||
GVAR(PostProcessEyes) ppEffectCommit 0.5;
|
|
||||||
GVAR(PostProcessEyes) ppEffectEnable true;
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: Garth 'L-H' de Wet
|
|
||||||
* Handles rain effects being created on glasses.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* call ace_goggles_fnc_rainEffect;
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
private ["_fnc_underCover"];
|
|
||||||
if (isNull(ace_player) || {!(alive ace_player)}) exitWith {};
|
|
||||||
_fnc_underCover = {
|
|
||||||
private ["_pos", "_unit"];
|
|
||||||
_unit = (_this select 0);
|
|
||||||
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true};
|
|
||||||
_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])}
|
|
||||||
};
|
|
||||||
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(RainLastLevel) != rain) then {
|
|
||||||
call FUNC(RemoveRainEffect);
|
|
||||||
GVAR(RainLastLevel) = rain;
|
|
||||||
// Rain is happening
|
|
||||||
if (GVAR(RainLastLevel) > 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(RainLastLevel)));
|
|
||||||
GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]];
|
|
||||||
};
|
|
||||||
}else{
|
|
||||||
if (GVAR(RainLastLevel) > 0.05) then {
|
|
||||||
if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith {
|
|
||||||
call FUNC(RemoveRainEffect);
|
|
||||||
};
|
|
||||||
if (!GVAR(RainActive)) then {
|
|
||||||
GVAR(RainLastLevel) = -1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
@ -9,11 +9,12 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_goggles_fnc_removeDirtEffect;
|
* call ace_goggles_fnc_removeDirtEffect
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then {
|
|
||||||
|
if (!isNull (GETUVAR(GVAR(DisplayEffects),displayNull))) then {
|
||||||
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText "";
|
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText "";
|
||||||
};
|
};
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_goggles_fnc_removeDustEffect;
|
* call ace_goggles_fnc_removeDustEffect
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then {
|
|
||||||
|
if (!isNull (GETUVAR(GVAR(DisplayEffects),displayNull))) then {
|
||||||
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10662) ctrlSetText "";
|
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10662) ctrlSetText "";
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Garth 'L-H' de Wet
|
* Author: Garth 'L-H' de Wet
|
||||||
* Removes the glasses effect from the screen, removes dirt effect, removes rain effect,
|
* Removes the glasses effect from the screen, removes dirt effect, removes rain effect, removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.)
|
||||||
* removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.)
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
@ -10,15 +9,16 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_goggles_fnc_removeGlassesEffect;
|
* call ace_goggles_fnc_removeGlassesEffect
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
GVAR(EffectsActive) = false;
|
GVAR(EffectsActive) = false;
|
||||||
GVAR(PostProcess) ppEffectEnable false;
|
GVAR(PostProcess) ppEffectEnable false;
|
||||||
|
|
||||||
if (!isNull(GLASSDISPLAY)) then {
|
if (!isNull (GLASSDISPLAY)) then {
|
||||||
GLASSDISPLAY closeDisplay 0;
|
GLASSDISPLAY closeDisplay 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,13 +9,15 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_goggles_fnc_removeRainEffect;
|
* call ace_goggles_fnc_removeRainEffect
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
if (!isNull (GVAR(RainDrops))) then {
|
|
||||||
deleteVehicle (GVAR(RainDrops));
|
if (!isNull GVAR(RainDrops)) then {
|
||||||
|
deleteVehicle GVAR(RainDrops);
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(RainActive) = false;
|
GVAR(RainActive) = false;
|
||||||
GVAR(RainLastLevel) = 0;
|
GVAR(RainLastLevel) = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user