DayZ
1.24
Loading...
Searching...
No Matches
PropertyModifiers.c
Go to the documentation of this file.
1
class
PropertyModifiers
2
{
3
vector
m_RecoilModifiers
;
4
vector
m_SwayModifiers
;
5
vector
m_SightMisalignment
;
6
7
float
m_BarrelLength
;
8
//ref Timer test_timer;
9
ItemBase
m_OwnerItem
;
10
float
m_Weapon
11
12
void
PropertyModifiers
(
ItemBase
owner
)
13
{
14
//test_timer = new Timer();
15
//test_timer.Run(5, this, "Refresh", NULL, true);
16
m_OwnerItem
=
owner
;
17
UpdateModifiers
();
18
m_BarrelLength
=
CalculateBarrelLength
(
owner
);
19
}
20
22
float
GetBarrelLength
()
23
{
24
//return m_BarrelLength * 1000:
25
return
CalculateBarrelLength
(
m_OwnerItem
) * 1000;
26
}
27
28
float
CalculateBarrelLength
(
ItemBase
owner
)
29
{
30
vector
usti_hlavne_position
=
owner
.GetSelectionPositionLS(
"usti hlavne"
);
//usti hlavne
31
vector
konec_hlavne_position
=
owner
.GetSelectionPositionLS(
"konec hlavne"
);
//konec hlavne
32
usti_hlavne_position
=
owner
.ModelToWorld(
usti_hlavne_position
);
33
konec_hlavne_position
=
owner
.ModelToWorld(
konec_hlavne_position
);
34
return
vector
.
Distance
(
usti_hlavne_position
,
konec_hlavne_position
);
35
}
36
37
38
void
UpdateModifiers
()
39
{
40
m_RecoilModifiers
=
GetModifierRaw
(
m_OwnerItem
,
"recoilModifier"
);
41
m_SwayModifiers
=
GetModifierRaw
(
m_OwnerItem
,
"swayModifier"
);
42
m_SightMisalignment
=
GetModifierRaw
(
m_OwnerItem
,
"sightMisalignmentModifier"
);
43
44
for
(
int
i
= 0;
i
<
m_OwnerItem
.GetInventory().AttachmentCount();
i
++)
45
{
46
ItemBase
attachment
=
ItemBase
.Cast(
m_OwnerItem
.GetInventory().GetAttachmentFromIndex(
i
));
47
48
vector
temp_value
=
PropertyModifiers
.
GetModifierRaw
(
attachment
,
"recoilModifier"
);
49
m_RecoilModifiers
[0] =
m_RecoilModifiers
[0] *
temp_value
[0];
50
m_RecoilModifiers
[1] =
m_RecoilModifiers
[1] *
temp_value
[1];
51
m_RecoilModifiers
[2] =
m_RecoilModifiers
[2] *
temp_value
[2];
52
53
temp_value
=
PropertyModifiers
.
GetModifierRaw
(
attachment
,
"swayModifier"
);
54
m_SwayModifiers
[0] =
m_SwayModifiers
[0] *
temp_value
[0];
55
m_SwayModifiers
[1] =
m_SwayModifiers
[1] *
temp_value
[1];
56
m_SwayModifiers
[2] =
m_SwayModifiers
[2] *
temp_value
[2];
57
58
temp_value
=
PropertyModifiers
.
GetModifierRaw
(
attachment
,
"sightMisalignmentModifier"
);
59
m_SightMisalignment
[0] =
m_SightMisalignment
[0] *
temp_value
[0];
60
m_SightMisalignment
[1] =
m_SightMisalignment
[1] *
temp_value
[1];
61
m_SightMisalignment
[2] =
m_SightMisalignment
[2] *
temp_value
[2];
62
}
63
}
64
65
static
vector
GetModifierRaw
(
ItemBase
item
,
string
modifier_name
,
vector
value
=
"1 1 1"
)
66
{
67
if
(
item
.ConfigIsExisting(
modifier_name
))
68
value
=
item
.ConfigGetVector(
modifier_name
);
69
return
value
;
70
}
71
72
}
m_Weapon
InventoryItem m_Weapon
Weapons - cache.
Definition
DayZPlayerImplementMeleeCombat.c:57
ItemBase
Definition
InventoryItem.c:697
Param3
Definition
EntityAI.c:95
PropertyModifiers
Definition
PropertyModifiers.c:2
PropertyModifiers::CalculateBarrelLength
float CalculateBarrelLength(ItemBase owner)
Definition
PropertyModifiers.c:28
PropertyModifiers::m_BarrelLength
float m_BarrelLength
Definition
PropertyModifiers.c:7
PropertyModifiers::UpdateModifiers
void UpdateModifiers()
Definition
PropertyModifiers.c:38
PropertyModifiers::PropertyModifiers
float m_Weapon void PropertyModifiers(ItemBase owner)
Definition
PropertyModifiers.c:12
PropertyModifiers::GetModifierRaw
static vector GetModifierRaw(ItemBase item, string modifier_name, vector value="1 1 1")
Definition
PropertyModifiers.c:65
PropertyModifiers::m_SightMisalignment
vector m_SightMisalignment
Definition
PropertyModifiers.c:5
PropertyModifiers::GetBarrelLength
float GetBarrelLength()
Get Barrel Legth in mm.
Definition
PropertyModifiers.c:22
PropertyModifiers::m_RecoilModifiers
vector m_RecoilModifiers
Definition
PropertyModifiers.c:3
PropertyModifiers::m_SwayModifiers
vector m_SwayModifiers
Definition
PropertyModifiers.c:4
PropertyModifiers::m_OwnerItem
ItemBase m_OwnerItem
Definition
PropertyModifiers.c:9
vector
Definition
EnConvert.c:106
vector::Distance
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
scripts
4_World
Classes
PropertyModifiers.c
Generated by
1.10.0