Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
underobjectdecalspawncomponent.c
Go to the documentation of this file.
10
12{
13 private const string SURFACE_PARAM_DECAL_NAME = "underObjectDecal";
14
16
17 protected Object m_Parent;
18 protected Object m_Decal;
19
20 private float m_LastScaleValue;
21
23 {
24 m_Settings = pSettings;
25 m_Parent = pParent;
26 }
27
28 private string GetObjectNameFromSurfaceConfig(string surfaceParamName = SURFACE_PARAM_DECAL_NAME)
29 {
30 string surfaceType
31 int liquidType;
32 g_Game.SurfaceUnderObjectCorrectedLiquid(m_Parent, surfaceType, liquidType);
33
34 return Surface.GetParamText(surfaceType, surfaceParamName);
35 }
36
38 {
39 if (m_Decal)
40 return;
41
42 #ifndef SERVER
43 m_Decal = g_Game.CreateObjectEx(
45 m_Parent.GetPosition() + m_Settings.m_PositionOffset,
47 );
48
49 if (m_Decal)
50 {
51 if (m_Settings.m_RandomizeRotation)
52 {
53 vector v;
54 v[0] = Math.RandomFloat(-Math.PI, Math.PI);
55 m_Decal.SetOrientation(v * Math.RAD2DEG);
56 }
57
58 m_Decal.SetScale(m_Settings.m_ScaleMin);
59 }
60 #endif
61 }
62
64 {
65 #ifndef SERVER
66 if (m_Decal)
67 m_Decal.Delete();
68 #endif
69 }
70
71 void UpdateSize(float pScaleValue)
72 {
73 #ifndef SERVER
74 if (m_Decal)
75 {
76 if (pScaleValue != m_LastScaleValue)
77 {
78 m_LastScaleValue = m_Decal.GetScale();
79 m_Decal.SetScale(Math.Clamp(pScaleValue, m_Settings.m_ScaleMin, m_Settings.m_ScaleMax));
80 }
81 }
82 #endif
83 }
84}
Entity m_Parent
const int ECE_LOCAL
const int ECE_PLACE_ON_SURFACE
Definition enmath.c:7
static string GetParamText(string surfaceName, string paramName)
Definition surface.c:23
static const vector Zero
Definition enconvert.c:123
DayZGame g_Game
Definition dayzgame.c:3942
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static const float PI
Definition enmath.c:12
static const float RAD2DEG
Definition enmath.c:16
string GetObjectNameFromSurfaceConfig(string surfaceParamName=SURFACE_PARAM_DECAL_NAME)
ref UnderObjectDecalSpawnSettings m_Settings
class UnderObjectDecalSpawnSettings SURFACE_PARAM_DECAL_NAME
void UpdateSize(float pScaleValue)
void UnderObjectDecalSpawnComponent(notnull UnderObjectDecalSpawnSettings pSettings, notnull Object pParent)