3 protected string m_sDisplayName;
4 protected string m_sDescription;
5 protected ResourceName m_sInventoryIcon;
7 protected int m_iDefaultSightDistanceSetting;
8 protected ref array<string> m_aFireModes;
10 protected int m_iRateOfFire;
11 protected float m_fMass;
12 protected ref array<int> m_aSightDistanceSettings;
16 string GetDisplayName()
23 ResourceName GetInventoryIcon()
25 return m_sInventoryIcon;
30 string GetDescription()
37 array<string> GetFireModes()
58 array<int> GetSightDistanceSettings()
60 return m_aSightDistanceSettings;
65 int GetDefaultSightDistanceSetting()
67 return m_iDefaultSightDistanceSetting;
78 Resource resource = Resource.Load(weaponResource);
79 if (!resource.IsValid())
82 IEntity entity =
GetGame().SpawnEntityPrefabLocal(resource,
null,
null);
86 WeaponComponent weaponComponent = WeaponComponent.Cast(entity.FindComponent(WeaponComponent));
93 m_iDefaultSightDistanceSetting = Math.Round(weaponComponent.GetCurrentSightsZeroing());
94 m_iMuzzleVelocity = weaponComponent.GetInitialProjectileSpeed();
95 UIInfo weaponComponentUIInfo = weaponComponent.GetUIInfo();
96 if (weaponComponentUIInfo)
103 m_aSightDistanceSettings = {};
118 MuzzleComponent muzzleComponent = MuzzleComponent.Cast(weaponComponent.FindComponent(MuzzleComponent));
121 array<BaseFireMode> fireModes = {};
122 muzzleComponent.GetFireModesList(fireModes);
126 if (fireMode.GetBurstSize() == 0)
129 m_aFireModes.Insert(fireMode.GetUIName());
130 float shotSpan = fireMode.GetShotSpan();
133 int rateOfFire = Math.Round(60 / shotSpan);
134 if (rateOfFire > m_iRateOfFire)
135 m_iRateOfFire = rateOfFire;
140 WeaponAttachmentsStorageComponent storageComponent = WeaponAttachmentsStorageComponent.Cast(entity.FindComponent(WeaponAttachmentsStorageComponent));
141 if (storageComponent)
143 m_fMass = storageComponent.GetTotalWeight();
146 BaseSightsComponent sightsComponent = weaponComponent.GetSights();