Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
underobjectdecalspawncomponent.c
Go to the documentation of this file.
1
class
UnderObjectDecalSpawnSettings
2
{
3
bool
m_RandomizeRotation
=
true
;
4
5
float
m_ScaleMin
= 0.1;
6
float
m_ScaleMax
= 1.0;
7
8
vector
m_PositionOffset
=
vector
.
Zero
;
9
}
10
11
class
UnderObjectDecalSpawnComponent
12
{
13
private
const
string
SURFACE_PARAM_DECAL_NAME
=
"underObjectDecal"
;
14
15
protected
ref
UnderObjectDecalSpawnSettings
m_Settings
;
16
17
protected
Object
m_Parent
;
18
protected
Object
m_Decal
;
19
20
private
float
m_LastScaleValue
;
21
22
void
UnderObjectDecalSpawnComponent
(notnull
UnderObjectDecalSpawnSettings
pSettings, notnull
Object
pParent)
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
37
void
SpawnDecal
()
38
{
39
if
(
m_Decal
)
40
return
;
41
42
#ifndef SERVER
43
m_Decal
=
g_Game
.CreateObjectEx(
44
GetObjectNameFromSurfaceConfig
(),
45
m_Parent
.GetPosition() +
m_Settings
.m_PositionOffset,
46
ECE_LOCAL
|
ECE_PLACE_ON_SURFACE
,
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
63
void
RemoveDecal
()
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
}
m_Parent
Entity m_Parent
Definition
cachedequipmentstoragebase.c:15
ECE_LOCAL
const int ECE_LOCAL
Definition
centraleconomy.c:24
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
Math
Definition
enmath.c:7
Object
Definition
objecttyped.c:2
Surface
Definition
surface.c:2
Surface::GetParamText
static string GetParamText(string surfaceName, string paramName)
Definition
surface.c:23
UnderObjectDecalSpawnSettings
Definition
underobjectdecalspawncomponent.c:2
UnderObjectDecalSpawnSettings::m_ScaleMin
float m_ScaleMin
Definition
underobjectdecalspawncomponent.c:5
UnderObjectDecalSpawnSettings::m_ScaleMax
float m_ScaleMax
Definition
underobjectdecalspawncomponent.c:6
UnderObjectDecalSpawnSettings::m_RandomizeRotation
bool m_RandomizeRotation
Definition
underobjectdecalspawncomponent.c:3
UnderObjectDecalSpawnSettings::m_PositionOffset
vector m_PositionOffset
Definition
underobjectdecalspawncomponent.c:8
vector
Definition
enconvert.c:119
vector::Zero
static const vector Zero
Definition
enconvert.c:123
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Math::Clamp
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'.
Math::RandomFloat
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
Math::PI
static const float PI
Definition
enmath.c:12
Math::RAD2DEG
static const float RAD2DEG
Definition
enmath.c:16
m_Decal
Object m_Decal
Definition
underobjectdecalspawncomponent.c:18
RemoveDecal
void RemoveDecal()
Definition
underobjectdecalspawncomponent.c:63
GetObjectNameFromSurfaceConfig
string GetObjectNameFromSurfaceConfig(string surfaceParamName=SURFACE_PARAM_DECAL_NAME)
Definition
underobjectdecalspawncomponent.c:28
m_Settings
ref UnderObjectDecalSpawnSettings m_Settings
Definition
underobjectdecalspawncomponent.c:15
SURFACE_PARAM_DECAL_NAME
class UnderObjectDecalSpawnSettings SURFACE_PARAM_DECAL_NAME
m_LastScaleValue
float m_LastScaleValue
Definition
underobjectdecalspawncomponent.c:20
SpawnDecal
void SpawnDecal()
Definition
underobjectdecalspawncomponent.c:37
UpdateSize
void UpdateSize(float pScaleValue)
Definition
underobjectdecalspawncomponent.c:71
UnderObjectDecalSpawnComponent
void UnderObjectDecalSpawnComponent(notnull UnderObjectDecalSpawnSettings pSettings, notnull Object pParent)
Definition
underobjectdecalspawncomponent.c:22
Games
Dayz
scripts
4_world
classes
underobjectdecalspawncomponent.c
Generated by
1.17.0