Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ProjectileWindTable.c
Go to the documentation of this file.
1[BaseContainerProps(configRoot: true)]
3{
4 [Attribute(desc: "Data")]
5 protected ref array<ref SCR_ProjectileWindData> m_aData;
6
7 //------------------------------------------------------------------------------------------------
11 {
13 if (!pmc)
14 return null;
15
16 ProjectileMoveComponentClass data = ProjectileMoveComponentClass.Cast(pmc.GetComponentData(projectile));
17 ResourceName rn = data.GetProjectileWindTable();
18 if (rn.IsEmpty())
19 return null;
20
21 Resource res = BaseContainerTools.LoadContainer(rn);
22 if (!res.IsValid())
23 return null;
24
25 BaseContainer container = res.GetResource().ToBaseContainer();
26 if (!container)
27 return null;
28
29 return SCR_ProjectileWindTable.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
30 }
31
32 //------------------------------------------------------------------------------------------------
36 {
37 Resource res = Resource.Load(projectileResource);
38 if (!res.IsValid())
39 return null;
40
41 BaseResourceObject resObject = res.GetResource();
42 if (!resObject)
43 return null;
44
45 IEntitySource projectileEntitySrc = resObject.ToEntitySource();
46 if (!projectileEntitySrc)
47 return null;
48
49 return GetProjectileWindageData(projectileEntitySrc);
50 }
51
52 //------------------------------------------------------------------------------------------------
56 {
57 ResourceName rn;
58 IEntityComponentSource componentSrc;
59 for (int i, componentsCount = projectileEntitySrc.GetComponentCount(); i < componentsCount; i++)
60 {
61 componentSrc = projectileEntitySrc.GetComponent(i);
62 if (!componentSrc)
63 continue;
64
65 if (!componentSrc.GetClassName().ToType().IsInherited(ProjectileMoveComponent))
66 continue;
67
68 componentSrc.Get("ProjectileWindTableConfig", rn);
69 break;
70 }
71
72 if (rn.IsEmpty())
73 return null;
74
75 Resource res = BaseContainerTools.LoadContainer(rn);
76 if (!res.IsValid())
77 return null;
78
79 BaseContainer container = res.GetResource().ToBaseContainer();
80 if (!container)
81 return null;
82
83 return SCR_ProjectileWindTable.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
84 }
85
86 //------------------------------------------------------------------------------------------------
98 array<float> GetDataByAngleDeg(float angle, float windSpeed, float initSpeedCoef = 1)
99 {
100 angle = SCR_Math.ConvertToRadians(angle, SCR_EOpticsAngleUnits.DEGREES);
101 return GetDataByAngle(angle, windSpeed, initSpeedCoef);
102 }
103
104 //------------------------------------------------------------------------------------------------
116 array<float> GetDataByAngle(float angle, float windSpeed = 10, float initSpeedCoef = 1)
117 {
119 {
120 if (initSpeedCoef != data.GetInitSpeedCoef())
121 continue;
122
123 if (windSpeed != data.GetWindSpeed())
124 continue;
125
126 return data.GetDataByAngle(angle);
127 }
128
129 return null;
130 }
131
132 //------------------------------------------------------------------------------------------------
145 array<float> GetDataByDisance(float distance, bool directFire, float windSpeed, float initSpeedCoef = 1)
146 {
148 {
149 if (initSpeedCoef != data.GetInitSpeedCoef())
150 continue;
151
152 if (windSpeed != data.GetWindSpeed())
153 continue;
154
155 return data.GetDataByDisance(distance, directFire);
156 }
157
158 return null;
159 }
160
161 //------------------------------------------------------------------------------------------------
162 // constructor
164 void SCR_ProjectileWindTable(array<ref SCR_ProjectileWindData> data)
165 {
166 if (data)
167 m_aData = data;
168 }
169}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
float distance
SCR_EOpticsAngleUnits
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
static float ConvertToRadians(float angleFrom, SCR_EOpticsAngleUnits fromUnitType)
Definition SCR_Math.c:323
static SCR_ProjectileWindTable GetProjectileWindageData(ResourceName projectileResource)
static SCR_ProjectileWindTable GetProjectileWindageData(notnull IEntity projectile)
ref array< ref SCR_ProjectileWindData > m_aData
static SCR_ProjectileWindTable GetProjectileWindageData(notnull IEntitySource projectileEntitySrc)
void SCR_ProjectileWindTable(array< ref SCR_ProjectileWindData > data)
array< float > GetDataByAngleDeg(float angle, float windSpeed, float initSpeedCoef=1)
array< float > GetDataByAngle(float angle, float windSpeed=10, float initSpeedCoef=1)
array< float > GetDataByDisance(float distance, bool directFire, float windSpeed, float initSpeedCoef=1)
SCR_FieldOfViewSettings Attribute