Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
propertymodifiers.c
Go to the documentation of this file.
2{
6
8 //ref Timer test_timer;
10 float m_Weapon
11
13 {
14 //test_timer = new Timer();
15 //test_timer.Run(5, this, "Refresh", NULL, true);
16 m_OwnerItem = owner;
19 }
20
23 {
24 //return m_BarrelLength * 1000:
26 }
27
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
39 {
40 m_RecoilModifiers = GetModifierRaw(m_OwnerItem, "recoilModifier");
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 {
69 value = item.ConfigGetVector(modifier_name);
70 }
71 return value;
72 }
73
74}
static vector GetModifierRaw(ItemBase item, string modifier_name, vector value="1 1 1")
float m_Weapon void PropertyModifiers(ItemBase owner)
float CalculateBarrelLength(ItemBase owner)
float GetBarrelLength()
Get Barrel Legth in mm.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
InventoryItem m_Weapon
Weapons - cache.