Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
ppercontaminated.c
Go to the documentation of this file.
1// PPE when player is in contaminated area trigger
2class PPERequester_ContaminatedAreaTint extends PPERequester_GameplayBase
3{
4 protected vector m_StartRGB = vector.Zero;
5 protected float m_AccumulatedTime = 0;
6 protected bool m_FadeIn = false;
7 protected bool m_FadeOut = false;
8
9 const float FADE_TIME = 3;
10 // the end result is 1 - the value set here
11 const float R_TARGET = 0.142; // end value 0.858
12 const float G_TARGET = 0.15; // end value 0.850
13 const float B_TARGET = 0.44; // end value 0.560
14
15 override protected void OnStart( Param par = null )
16 {
17 super.OnStart( par );
18
19 m_AccumulatedTime = 0;
20
21 m_FadeIn = true;
22 m_FadeOut = false;
23
24 SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_SHARPNESS,false,10.0,PPEFilmGrain.L_1_TOXIC_TINT,PPOperators.HIGHEST);
25 SetTargetValueFloat(PostProcessEffectType.FilmGrain,PPEFilmGrain.PARAM_GRAINSIZE,false,1.0,PPEFilmGrain.L_2_TOXIC_TINT,PPOperators.LOWEST);
26 }
27
28 override protected void OnUpdate( float delta )
29 {
30 super.OnUpdate( delta );
31
32 if ( m_FadeIn && m_AccumulatedTime <= FADE_TIME )
33 {
34 m_AccumulatedTime += delta;
35
36 m_StartRGB[0] = 1 - FadeColourMult( 0, 1, m_AccumulatedTime / FADE_TIME ) * R_TARGET;
37 m_StartRGB[1] = 1 - FadeColourMult( 0, 1, m_AccumulatedTime / FADE_TIME ) * G_TARGET;
38 m_StartRGB[2] = 1 - FadeColourMult( 0, 1, m_AccumulatedTime / FADE_TIME ) * B_TARGET;
39
40 SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{m_StartRGB[0], m_StartRGB[1], m_StartRGB[2], 0.0},PPEGlow.L_23_TOXIC_TINT,PPOperators.MULTIPLICATIVE);
41 }
42
43 if ( m_FadeOut )
44 {
45 if (m_AccumulatedTime <= FADE_TIME)
46 {
47 m_AccumulatedTime += delta;
48
49 m_StartRGB[0] = ( 1 - R_TARGET ) + FadeColourMult( 0, R_TARGET, m_AccumulatedTime / FADE_TIME );
50 m_StartRGB[1] = ( 1 - G_TARGET ) + FadeColourMult( 0, G_TARGET, m_AccumulatedTime / FADE_TIME );
51 m_StartRGB[2] = ( 1 - B_TARGET ) + FadeColourMult( 0, B_TARGET, m_AccumulatedTime / FADE_TIME );
52
53 SetTargetValueColor(PostProcessEffectType.Glow,PPEGlow.PARAM_COLORIZATIONCOLOR,{m_StartRGB[0], m_StartRGB[1], m_StartRGB[2], 0.0},PPEGlow.L_23_TOXIC_TINT,PPOperators.MULTIPLICATIVE);
54 }
55 else
56 {
57 Stop(); //proper termination after a fadeout
58 }
59 }
60 }
61
62 override void OnStop(Param par = null)
63 {
64 m_FadeIn = false;
65 m_FadeOut = false;
66 Param1<bool> p;
67
68 if (par && Class.CastTo(p,par))
69 m_FadeOut = p.param1;
70
71 m_AccumulatedTime = 0;
72
73 super.OnStop(par);
74 }
75
76 // Lerped multiplier for RGBA values
77 protected float FadeColourMult( float x, float y, float deltaT )
78 {
79 float output;
80 output = Math.Lerp( x, y, deltaT );
81 Easing.EaseInOutSine( output );
82 return output;
83 }
84}
Super root of all classes in Enforce script.
Definition enscript.c:11
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition easing.c:3
Definition enmath.c:7
FilmGrain - PostProcessEffectType.FilmGrain.
Definition ppefilmgrain.c:7
Glow - PostProcessEffectType.Glow.
Definition ppeglow.c:8
base, not to be used directly, would lead to layering collisions!
override void OnStop(Param par=null)
float FadeColourMult(float x, float y, float deltaT)
void OnStart(Param par=null)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
PostProcessEffectType
Post-process effect type.
Definition enworld.c:72
void Stop()
Stops all elements this effect consists of.
Definition effect.c:183
Icon x
Icon y
PPOperators
PP operators, specify operation between subsequent layers.
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)