Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
pperflashbangeffects.c
Go to the documentation of this file.
1 class 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 }
PostProcessEffectType
PostProcessEffectType
Post-process effect type.
Definition: enworld.c:71
GetGame
proto native CGame GetGame()
PPEExposureNative
EV postprocess, does not directly use materials.
Definition: ppeexposurenative.c:5
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
SetTargetValueColor
protected void SetTargetValueColor(int mat_id, int param_idx, ref array< float > val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
Definition: pperequestplatformsbase.c:195
Easing
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition: easing.c:2
OnStop
protected void OnStop(Param par=null)
automatically resets all material parameters of this requester to defaults
Definition: pperequestplatformsbase.c:358
PPEGaussFilter
GaussFilter - PostProcessEffectType.GaussFilter.
Definition: ppegaussfilter.c:2
OnUpdate
proto native void OnUpdate()
Definition: tools.c:349
PPEGlow
Glow - PostProcessEffectType.Glow.
Definition: ppeglow.c:7
PPERequester_GameplayBase
base, not to be used directly, would lead to layering collisions!
Definition: pperbloodloss.c:1
SetTargetValueFloat
protected void SetTargetValueFloat(int mat_id, int param_idx, bool relative, float val, int priority_layer, int operator=PPOperators.ADD_RELATIVE)
Definition: pperequestplatformsbase.c:153
PPEExceptions
PPEExceptions
Definition: ppeconstants.c:41
array< float >
m_IsRunning
protected bool m_IsRunning
Definition: pperequestplatformsbase.c:2
PPOperators
PPOperators
PP operators, specify operation between subsequent layers.
Definition: ppeconstants.c:51
Math
Definition: enmath.c:6
OnStart
enum EAchievementError OnStart
Definition: pperglasses.c:2