Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
ForestGeneratorClusters.c
Go to the documentation of this file.
1
2[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
3class ForestGeneratorCluster
4{
5 [Attribute(defvalue: "", uiwidget: UIWidgets.Object, desc: "Define which tree groups should spawn in this cluster.")]
6 ref array<ref SmallForestGeneratorClusterObject> m_aObjects;
7
8 [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "The minimum density of the filling in number of clusters for hectare.", params: "0 inf")]
9 float m_fMinCDENSHA;
10
11 [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "The maximum density of the filling in number of clusters for hectare.", params: "0 inf")]
12 float m_fMaxCDENSHA;
13
14 [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Generate this cluster?")]
15 bool m_bGenerate;
16
17 [Attribute(defvalue: "1", uiwidget: UIWidgets.ComboBox, desc: "Can the cluster be present in main forest only, outline only or both", enums: { ParamEnum("Both", "0"), ParamEnum("Forest only", "1"), ParamEnum("Outline only", "2") })]
18 int m_iPlacementArea;
19
20 SCR_EForestGeneratorClusterType m_Type;
21 float m_fRadius;
22
23 //------------------------------------------------------------------------------------------------
24 // constructor
25 void ForestGeneratorCluster()
26 {
27 if (!m_aObjects)
28 return;
29
30 foreach (SmallForestGeneratorClusterObject object : m_aObjects)
31 {
32 if (object.m_fMaxRadius > m_fRadius)
33 m_fRadius = object.m_fMaxRadius;
34
35 if (object.m_fMinRadius > m_fRadius)
36 m_fRadius = object.m_fMinRadius;
37 }
38 }
39}
40
41[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
42class ForestGeneratorCircleCluster : ForestGeneratorCluster
43{
44 //------------------------------------------------------------------------------------------------
45 // constructor
46 void ForestGeneratorCircleCluster()
47 {
48 m_Type = SCR_EForestGeneratorClusterType.CIRCLE;
49 }
50}
51
52[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
53class ForestGeneratorStripCluster : ForestGeneratorCluster
54{
55 [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, desc: "Offset that is applied to generated objects to avoid seeing the exact shape of the curve. [m]")]
56 float m_fMaxXOffset;
57
58 [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, desc: "Offset that is applied to generated objects to avoid seeing the exact shape of the curve. [m]")]
59 float m_fMaxYOffset;
60
61 [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "Defines how many times should the curve repeat for this strip.")]
62 float m_fFrequency;
63
64 [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, desc: "Defines the maximum extent of the curve. [m]")]
65 float m_fAmplitude;
66
67 //------------------------------------------------------------------------------------------------
68 // constructor
69 void ForestGeneratorStripCluster()
70 {
71 m_Type = SCR_EForestGeneratorClusterType.STRIP;
72 }
73}
74
75[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
76class WideForestGeneratorClusterObject : SmallForestGeneratorClusterObject
77{
78 [Attribute(desc: "Capsule start, defines offset from the pivot of the object, serves for collision detection")]
79 vector m_CapsuleStartInEditor;
80
81 [ForestGeneratorCapsuleStartAttribute()]
82 vector m_CapsuleStart;
83
84 [Attribute(desc: "Capsule end, defines offset from the pivot of the object, serves for collision detection")]
85 vector m_CapsuleEndInEditor;
86
87 [ForestGeneratorCapsuleEndAttribute()]
88 vector m_CapsuleEnd;
89
90 [Attribute(defvalue: "1", desc: "This overrides the setting from template library!")]
91 bool m_bAlignToNormal;
92
93 float m_fYaw;
94 protected float m_fMinDistanceFromLine = -1;
95
96 //------------------------------------------------------------------------------------------------
98 void Rotate()
99 {
100 m_CapsuleStart = Rotate2D(m_CapsuleStartInEditor * m_fScale, Math.DEG2RAD * m_fYaw);
101 m_CapsuleEnd = Rotate2D(m_CapsuleEndInEditor * m_fScale, Math.DEG2RAD * m_fYaw);
102 }
103
104 //------------------------------------------------------------------------------------------------
109 vector Rotate2D(vector vec, float rads)
110 {
111 float sin = Math.Sin(rads);
112 float cos = Math.Cos(rads);
113
114 return {
115 vec[0] * cos - vec[2] * sin,
116 0,
117 vec[0] * sin + vec[2] * cos
118 };
119 }
120
121 //------------------------------------------------------------------------------------------------
123 float GetMinDistanceFromLine()
124 {
125 if (m_fMinDistanceFromLine != -1)
126 return m_fMinDistanceFromLine;
127
128 float distance = m_CapsuleStart.Length();
129 if (distance > m_fMinDistanceFromLine)
130 m_fMinDistanceFromLine = distance;
131
132 distance = m_CapsuleEnd.Length();
133 if (distance > m_fMinDistanceFromLine)
134 m_fMinDistanceFromLine = distance;
135
136 return m_fMinDistanceFromLine;
137 }
138}
139
140[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
141class SmallForestGeneratorClusterObject : SCR_ForestGeneratorTreeBase
142{
143 [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "Minimum count of this object to spawn", params: "0 inf 1")]
144 int m_iMinCount;
145
146 [Attribute(defvalue: "2", uiwidget: UIWidgets.SpinBox, desc: "Maximum count of this object to spawn", params: "0 inf 1")]
147 int m_iMaxCount;
148
149 [Attribute(defvalue: "-1", uiwidget: UIWidgets.Slider, desc: "Define the bell curve (see Wikipedia's Normal Distribution article)\n0 = closest to min, 100 = closest to max\n-1 = disabled", params: "-1 100 1")]
150 int m_iRandomMidPercent;
151
152 [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "Minimum distance of this object from the center of this cluster", params: "0 inf")]
153 float m_fMinRadius;
154
155 [Attribute(defvalue: "2", uiwidget: UIWidgets.SpinBox, desc: "Maximum distance of this object from the center of this cluster", params: "0 inf")]
156 float m_fMaxRadius;
157
158 //------------------------------------------------------------------------------------------------
159 override void AdjustScale()
160 {
162 }
163}
164
165[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
166class MiddleForestGeneratorClusterObject : SmallForestGeneratorClusterObject
167{
168 [Attribute(defvalue: "5", uiwidget: UIWidgets.SpinBox, "Minimum required radius in the middle layer for this object to spawn", params: "0 inf"), ForestGeneratorDistaceAttribute(DistanceType.MID)]
169 float m_fMidDistance;
170
171 //------------------------------------------------------------------------------------------------
172 override void AdjustScale()
173 {
175 m_fMidDistance *= m_fScale;
176 }
177}
178
179[BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
180class BigForestGeneratorClusterObject : MiddleForestGeneratorClusterObject
181{
182 [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, "Minimum required radius in the top layer for this object to spawn"), ForestGeneratorDistaceAttribute(DistanceType.TOP)]
183 float m_fTopDistance;
184
185 //------------------------------------------------------------------------------------------------
186 override void AdjustScale()
187 {
189 m_fMidDistance *= m_fScale;
190 m_fTopDistance *= m_fScale;
191 }
192}
193
194enum SCR_EForestGeneratorClusterType
195{
196 CIRCLE,
197 STRIP,
198}
float m_fBotDistance
float m_fScale
void ForestGeneratorDistaceAttribute(DistanceType distanceType)
void AdjustScale()
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
float distance
EEditableEntityType m_Type
@ CIRCLE
void Rotate(float tDelta, out vector transform[4], float rotationValue)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
float m_fFrequency
This class defines forest generator clusters - which trees with which density should be present in th...
SCR_FieldOfViewSettings Attribute
DistanceType