11 protected int m_iRotorId;
16 [
Attribute(uiwidget: UIWidgets.Slider,
desc:
"Rotor radius measured up from root in Rotor Info space\n[m]",
params:
"0.5 50 0.01",
category:
"Helicopter Damage")]
17 protected float m_fRotorRadius;
19 [
Attribute(uiwidget: UIWidgets.Slider,
desc:
"Rotor thickness measured up from root in Rotor Info space\n[m]",
params:
"0.1 10 0.01",
category:
"Helicopter Damage")]
20 protected float m_fRotorThickness;
22 [
Attribute(uiwidget: UIWidgets.Slider,
desc:
"Average blade width measured up from side to side at the tip of the blade\n[m]",
params:
"0.1 1000 0.01",
category:
"Helicopter Damage")]
23 protected float m_fBladeWidth;
25 [
Attribute(uiwidget: UIWidgets.EditBox,
desc:
"Amount of blades on this rotor",
category:
"Helicopter Damage")]
28 [
Attribute(defvalue:
"0.9", uiwidget: UIWidgets.Auto,
desc:
"Efficiency with minor damage state",
category:
"Rotor Damage")]
31 [
Attribute(defvalue:
"0.8", uiwidget: UIWidgets.Auto,
desc:
"Efficiency with major damage state",
category:
"Rotor Damage")]
34 [
Attribute(defvalue:
"0.6", uiwidget: UIWidgets.Auto,
desc:
"Efficiency with critical damage state",
category:
"Rotor Damage")]
40 override void OnInit(IEntity pOwnerEntity, GenericComponent pManagerComponent)
42 super.OnInit(pOwnerEntity, pManagerComponent);
69 vector hitTransform[3] = {damageContext.hitPosition, damageContext.hitDirection, damageContext.hitNormal};
74 return super.ComputeEffectiveDamage(damageContext, isDOT);
89 vector relativePosition = hitTransform[0].InvMultiply4(transform);
91 float distanceFromAxis = vector.DistanceXZ(relativePosition, vector.Zero);
92 if (distanceFromAxis == 0)
95 return m_fBladeWidth *
m_iBladeCount / (Math.PI2 * distanceFromAxis);
101 super.OnDamageStateChanged();
109 return m_fRotorRadius;
136 Vehicle vehicle = Vehicle.Cast(
GetOwner().GetRootParent());
143 damageManager.RegisterVehicleHitZone(
this);
145 m_Simulation = VehicleHelicopterSimulation.Cast(vehicle.FindComponent(VehicleHelicopterSimulation));
151 Vehicle vehicle = Vehicle.Cast(
GetOwner().GetRootParent());
157 damageManager.UpdateVehicleState();
164 float efficiency = 1;
193 if (m_fRotorRadius <= 0)
196 if (m_fRotorThickness <= 0)
204 vector relativePosition = worldPosition.InvMultiply4(transform);
207 if (m_fRotorThickness > 0 && relativePosition[1] < 0 || relativePosition[1] > m_fRotorThickness)
211 return vector.DistanceSqXZ(relativePosition, vector.Zero) <= m_fRotorRadius * m_fRotorRadius;
217 override void DrawDebug()
222 if (m_fRotorRadius <= 0)
225 if (m_fRotorThickness <= 0)
230 vector transformTop[4] = transform;
231 transformTop[3] = transformTop[3] + transformTop[1] * m_fRotorThickness;
233 ShapeFlags shapeFlags = ShapeFlags.ONCE | ShapeFlags.NOZBUFFER | ShapeFlags.TRANSP | ShapeFlags.DOUBLESIDE | ShapeFlags.NOOUTLINE;
236 Shape.CreateArrow(transform[3], transformTop[3], 0, Color.DARK_MAGENTA, shapeFlags);
239 SCR_Shape.DrawCircle(transform, m_fRotorRadius, Color.DARK_RED, COLOR_RED_A, shapeFlags);
240 Shape.CreateArrow(transform[3] - transform[0] * m_fRotorRadius, transform[3], 0, Color.DARK_RED, shapeFlags);
241 Shape.CreateArrow(transform[3] + transform[0] * m_fRotorRadius, transform[3], 0, Color.DARK_RED, shapeFlags);
242 Shape.CreateArrow(transform[3] - transform[2] * m_fRotorRadius, transform[3], 0, Color.DARK_RED, shapeFlags);
243 Shape.CreateArrow(transform[3] + transform[2] * m_fRotorRadius, transform[3], 0, Color.DARK_RED, shapeFlags);
246 SCR_Shape.DrawCircle(transformTop, m_fRotorRadius, Color.DARK_BLUE, COLOR_BLUE_A, shapeFlags);
247 Shape.CreateArrow(transformTop[3] - transform[0] * m_fRotorRadius, transformTop[3], 0, Color.DARK_BLUE, shapeFlags);
248 Shape.CreateArrow(transformTop[3] + transform[0] * m_fRotorRadius, transformTop[3], 0, Color.DARK_BLUE, shapeFlags);
249 Shape.CreateArrow(transformTop[3] - transform[2] * m_fRotorRadius, transformTop[3], 0, Color.DARK_BLUE, shapeFlags);
250 Shape.CreateArrow(transformTop[3] + transform[2] * m_fRotorRadius, transformTop[3], 0, Color.DARK_BLUE, shapeFlags);