Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
pperflashbangeffects.c
Go to the documentation of this file.
1class PPERequester_FlashbangEffects extends PPERequester_GameplayBase
2{
3 const float VAL_FACTOR = 0.85;
4 const float EXPOSURE_MAX = 50;
5 protected float m_Exposure;
6 protected float m_Intensity;
7
8 override protected void OnStart(Param par = null)
9 {
10 if (!m_IsRunning)
11 {
12 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
13 GetGame().GetMission().GetEffectWidgets().AddActiveEffects({EffectWidgetsTypes.COVER_FLASHBANG});
14 }
15
16 super.OnStart();
17 }
18
19 override protected void OnStop(Param par = null)
20 {
21 super.OnStop();
22
23 m_Intensity = 0.0;
24 m_Exposure = 0.0;
25
26 if (GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
27 GetGame().GetMission().GetEffectWidgets().RemoveActiveEffects({EffectWidgetsTypes.COVER_FLASHBANG});
28 }
29
30 override protected void OnUpdate(float delta)
31 {
32 super.OnUpdate(delta);
33
34 if (GetGame() && GetGame().GetMission() && GetGame().GetMission().GetEffectWidgets())
35 {
36 Param1<float> par = new Param1<float>(1 - m_Intensity);
37 GetGame().GetMission().GetEffectWidgets().UpdateWidgets(EffectWidgetsTypes.COVER_FLASHBANG,0,par,EffectWidgetHandles.FLASHBANG);
38 }
39 }
40
41 void SetFlashbangIntensity(float intensity, float daytime_toggle)
42 {
43 m_Intensity = intensity;
44 array<float> overlay_color = {1.0, 1.0, 1.0, intensity};
45 if (daytime_toggle <= 5.0)
46 {
47 m_Exposure = Math.Clamp(intensity * daytime_toggle,0.0,EXPOSURE_MAX);
48 }
49 else
50 {
51 m_Exposure = Easing.EaseInQuart(intensity);
52 m_Exposure = Math.Clamp(EXPOSURE_MAX * m_Exposure,0.0,EXPOSURE_MAX);
53 }
54 overlay_color[3] = intensity;
55
56 //blur
57 SetTargetValueFloat(PostProcessEffectType.GaussFilter,PPEGaussFilter.PARAM_INTENSITY,true,intensity,PPEGaussFilter.L_0_FLASHBANG,PPOperators.ADD_RELATIVE);
58 //overlay
59 SetTargetValueFloat(PostProcessEffectType.Glow,PPEGlow.PARAM_OVERLAYFACTOR,true,intensity,PPEGlow.L_20_FLASHBANG,PPOperators.HIGHEST);
60 SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_OVERLAYCOLOR,overlay_color,PPEGlow.L_21_FLASHBANG,PPOperators.SET);
61 //exposure
62 SetTargetValueFloat(PPEExceptions.EXPOSURE,PPEExposureNative.PARAM_INTENSITY,false,m_Exposure,PPEExposureNative.L_0_FLASHBANG,PPOperators.ADD);
63 }
64}
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition easing.c:3
override void RemoveActiveEffects(array< int > effects)
override void UpdateWidgets(int type=-1, float timeSlice=0, Param p=null, int handle=-1)
Usually called in course of an OnFrame update, can be manually called from elsewhere with parameters.
override void AddActiveEffects(array< int > effects)
Definition enmath.c:7
EV postprocess, does not directly use materials.
GaussFilter - PostProcessEffectType.GaussFilter.
Glow - PostProcessEffectType.Glow.
Definition ppeglow.c:8
base, not to be used directly, would lead to layering collisions!
void OnStart(Param par=null)
void SetFlashbangIntensity(float intensity, float daytime_toggle)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
PostProcessEffectType
Post-process effect type.
Definition enworld.c:72
PPOperators
PP operators, specify operation between subsequent layers.
PPEExceptions
bool m_IsRunning
void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
void SetTargetValueColor(int mat_id, int param_idx, array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)