Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
ForestGeneratorClusters.c
Go to the documentation of this file.
1 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
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.")]
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.")]
12  float m_fMaxCDENSHA;
13 
14  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Generate this cluster?")]
15  bool m_bGenerate;
16 
17  SCR_EForestGeneratorClusterType m_Type;
18  float m_fRadius;
19 
20  //------------------------------------------------------------------------------------------------
21  // constructor
23  {
24  if (!m_aObjects)
25  return;
26 
27  foreach (SmallForestGeneratorClusterObject object : m_aObjects)
28  {
29  if (object.m_fMaxRadius > m_fRadius)
30  m_fRadius = object.m_fMaxRadius;
31 
32  if (object.m_fMinRadius > m_fRadius)
33  m_fRadius = object.m_fMinRadius;
34  }
35  }
36 }
37 
38 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
39 class ForestGeneratorCircleCluster : ForestGeneratorCluster
40 {
41  //------------------------------------------------------------------------------------------------
42  void ForestGeneratorCircleCluster()
43  {
44  m_Type = SCR_EForestGeneratorClusterType.CIRCLE;
45  }
46 }
47 
48 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
49 class ForestGeneratorStripCluster : ForestGeneratorCluster
50 {
51  [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, desc: "Offset that is applied to generated objects to avoid seeing the exact shape of the curve. [m]")]
52  float m_fMaxXOffset;
53 
54  [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, desc: "Offset that is applied to generated objects to avoid seeing the exact shape of the curve. [m]")]
55  float m_fMaxYOffset;
56 
57  [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "Defines how many times should the curve repeat for this strip.")]
58  float m_fFrequency;
59 
60  [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, desc: "Defines the maximum extent of the curve. [m]")]
61  float m_fAmplitude;
62 
63  //------------------------------------------------------------------------------------------------
64  void ForestGeneratorStripCluster()
65  {
66  m_Type = SCR_EForestGeneratorClusterType.STRIP;
67  }
68 }
69 
70 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
71 class WideForestGeneratorClusterObject : SmallForestGeneratorClusterObject
72 {
73  [Attribute(desc: "Capsule start, defines offset from the pivot of the object, serves for collision detection")]
74  vector m_CapsuleStartInEditor;
75 
76  [ForestGeneratorCapsuleStartAttribute()]
77  vector m_CapsuleStart;
78 
79  [Attribute(desc: "Capsule end, defines offset from the pivot of the object, serves for collision detection")]
80  vector m_CapsuleEndInEditor;
81 
82  [ForestGeneratorCapsuleEndAttribute()]
83  vector m_CapsuleEnd;
84 
85  [Attribute(defvalue: "1", desc: "This overrides the setting from template library!")]
86  bool m_bAlignToNormal;
87 
88  float m_fYaw;
89  protected float m_fMinDistanceFromLine = -1;
90 
91  //------------------------------------------------------------------------------------------------
92  void Rotate()
93  {
94  m_CapsuleStart = Rotate2D(m_CapsuleStartInEditor * m_fScale, Math.DEG2RAD * m_fYaw);
95  m_CapsuleEnd = Rotate2D(m_CapsuleEndInEditor * m_fScale, Math.DEG2RAD * m_fYaw);
96  }
97 
98  //------------------------------------------------------------------------------------------------
99  vector Rotate2D(vector vec, float rads)
100  {
101  float sin = Math.Sin(rads);
102  float cos = Math.Cos(rads);
103 
104  return Vector(
105  vec[0] * cos - vec[2] * sin,
106  0,
107  vec[0] * sin + vec[2] * cos);
108  }
109 
110  //------------------------------------------------------------------------------------------------
111  float GetMinDistanceFromLine()
112  {
113  if (m_fMinDistanceFromLine != -1)
114  return m_fMinDistanceFromLine;
115 
116  float distance = m_CapsuleStart.Length();
117  if (distance > m_fMinDistanceFromLine)
118  m_fMinDistanceFromLine = distance;
119 
120  distance = m_CapsuleEnd.Length();
121  if (distance > m_fMinDistanceFromLine)
122  m_fMinDistanceFromLine = distance;
123 
124  return m_fMinDistanceFromLine;
125  }
126 }
127 
128 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
129 class SmallForestGeneratorClusterObject : SCR_ForestGeneratorTreeBase
130 {
131  [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "Minimum count of this object to spawn")];
132  int m_iMinCount;
133 
134  [Attribute(defvalue: "2", uiwidget: UIWidgets.SpinBox, desc: "Maximum count of this object to spawn")];
135  int m_iMaxCount;
136 
137  [Attribute(defvalue: "1", uiwidget: UIWidgets.SpinBox, desc: "Minimum distance of this object from the center of this cluster")]
138  float m_fMinRadius;
139 
140  [Attribute(defvalue: "2", uiwidget: UIWidgets.SpinBox, desc: "Maximum distance of this object from the center of this cluster")]
141  float m_fMaxRadius;
142 
143  //------------------------------------------------------------------------------------------------
144  override void AdjustScale()
145  {
147  }
148 }
149 
150 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
151 class MiddleForestGeneratorClusterObject : SmallForestGeneratorClusterObject
152 {
153  [Attribute(defvalue: "5", uiwidget: UIWidgets.SpinBox, "Minimum required radius in the middle layer for this object to spawn"), ForestGeneratorDistaceAttribute(DistanceType.MID)]
154  float m_fMidDistance;
155 
156  //------------------------------------------------------------------------------------------------
157  override void AdjustScale()
158  {
160  m_fMidDistance *= m_fScale;
161  }
162 }
163 
164 [BaseContainerProps(namingConvention: NamingConvention.NC_MUST_HAVE_NAME)]
165 class BigForestGeneratorClusterObject : MiddleForestGeneratorClusterObject
166 {
167  [Attribute(defvalue: "10", uiwidget: UIWidgets.SpinBox, "Minimum required radius in the top layer for this object to spawn"), ForestGeneratorDistaceAttribute(DistanceType.TOP)]
168  float m_fTopDistance;
169 
170  //------------------------------------------------------------------------------------------------
171  override void AdjustScale()
172  {
174  m_fMidDistance *= m_fScale;
175  m_fTopDistance *= m_fScale;
176  }
177 }
178 
179 enum SCR_EForestGeneratorClusterType
180 {
181  CIRCLE,
182  STRIP,
183 }
184 
DistanceType
DistanceType
Definition: DistanceType.c:12
Rotate
protected void Rotate(float tDelta, out vector transform[4], float rotationValue)
Definition: SCR_PreviewEntityEditorUIComponent.c:439
ForestGeneratorDistaceAttribute
void ForestGeneratorDistaceAttribute(DistanceType distanceType)
Definition: ForestGeneratorObjects.c:3
m_fBotDistance
float m_fBotDistance
Definition: ForestGeneratorObjects.c:50
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
distance
float distance
Definition: SCR_DestructibleTreeV2.c:29
m_Type
protected EEditableEntityType m_Type
Definition: SCR_EntitiesToolbarEditorUIComponent.c:3
m_fRadius
float m_fRadius
Definition: SCR_AITargetClusterState.c:30
ForestGeneratorCluster
This class defines forest generator clusters - which trees with which density should be present in th...
Definition: ForestGeneratorClusters.c:3
m_fFrequency
float m_fFrequency
Definition: SCR_VonDisplay.c:14
CIRCLE
@ CIRCLE
Definition: SCR_MapConstants.c:75
AdjustScale
void AdjustScale()
m_fScale
float m_fScale
Definition: ForestGeneratorObjects.c:65
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468