Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WeaponAttachmentSuppressorAttributes.c
Go to the documentation of this file.
2{
3 [Attribute("1.0", UIWidgets.EditBox, "Muzzle Velocity Coefficient. Values >1 speed up the bullet, values below slow it down")]
4 protected float m_fMuzzleSpeedCoefficient;
5 [Attribute("1", UIWidgets.CheckBox, "Override sound for shots")]
6 protected bool m_bOverrideShot;
7 [Attribute("1", UIWidgets.CheckBox, "Override muzzle effects")]
9 [Attribute("1.0", UIWidgets.EditBox, "Muzzle Dispersion Factor. Affects the radius of impact at the given range in the weapon. Smaller than 1.0 makes the weapon more accurate")]
11
12 [Attribute("0.0", UIWidgets.EditBox, "Extra Obstruction Length")]
14
15
16 [Attribute("1 1 1", "Linear Recoil Factors for X/Y/Z Direction. Smaller values reduce recoil.")]
18 [Attribute("1 1 1", "Angular Recoil Factors for X/Y/Z Direction. Smaller values reduce recoil.")]
20 [Attribute("1 1 1", "Turning Recoil Factors for X/Y/Z Direction. Smaller values reduce recoil.")]
22
23 override bool ApplyModifiers(BaseWeaponStatsManagerComponent statsManager, int muzzleIndex, IEntity attachedEntity)
24 {
25 if (muzzleIndex == -1)
26 return false; // Should not happen
27
28 if (!statsManager.SetMuzzleVelocityCoefficient(attachedEntity, muzzleIndex, m_fMuzzleSpeedCoefficient))
29 return false;
30
31 if (!statsManager.SetMuzzleDispersionFactor(attachedEntity, muzzleIndex, m_fMuzzleDispersionFactor))
32 return false;
33
35 if (!statsManager.SetShotSoundOverride(attachedEntity, muzzleIndex, true))
36 return false;
37
39 {
40 if (!statsManager.SetMuzzleEffectOverride(attachedEntity, muzzleIndex, true))
41 return false;
42 array<Managed> comArray = {};
43 attachedEntity.FindComponents(MuzzleEffectComponent, comArray);
44 foreach (Managed component : comArray)
45 {
46 MuzzleEffectComponent muzzleEffect = MuzzleEffectComponent.Cast(component);
47 if (muzzleEffect)
48 statsManager.AddMuzzleEffectOverride(attachedEntity, muzzleIndex, muzzleEffect);
49 }
50 }
51
52 if (!statsManager.SetExtraObstructionLength(attachedEntity, m_fExtraObstructionLength))
53 return false;
54
55 if (!statsManager.SetRecoilLinearFactors(attachedEntity, muzzleIndex, m_vLinearFactors))
56 return false;
57
58 if (!statsManager.SetRecoilAngularFactors(attachedEntity, muzzleIndex, m_vAngularFactors))
59 return false;
60
61 if (!statsManager.SetRecoilTurnFactors(attachedEntity, muzzleIndex, m_vTurnFactors))
62 return false;
63
64 return true;
65 }
66
67 override void ClearModifiers(BaseWeaponStatsManagerComponent statsManager, int muzzleIndex, IEntity attachedEntity)
68 {
69 if (muzzleIndex == -1)
70 return;
71 statsManager.ClearMuzzleVelocityCoefficient(attachedEntity, muzzleIndex);
72 statsManager.ClearMuzzleDispersionFactor(attachedEntity, muzzleIndex);
73
75 statsManager.ClearShotSoundOverride(attachedEntity, muzzleIndex);
76
78 statsManager.ClearMuzzleEffectOverride(attachedEntity, muzzleIndex);
79
80 statsManager.ClearExtraObstructionLength(attachedEntity);
81 statsManager.ClearRecoilLinearFactors(attachedEntity, muzzleIndex);
82 statsManager.ClearRecoilAngularFactors(attachedEntity, muzzleIndex);
83 statsManager.ClearRecoilTurnFactors(attachedEntity, muzzleIndex);
84 }
85}
proto external int FindComponents(typename typeName, notnull array< Managed > outComponents)
override bool ApplyModifiers(BaseWeaponStatsManagerComponent statsManager, int muzzleIndex, IEntity attachedEntity)
override void ClearModifiers(BaseWeaponStatsManagerComponent statsManager, int muzzleIndex, IEntity attachedEntity)
SCR_FieldOfViewSettings Attribute