Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BatteryHitZone.c
Go to the documentation of this file.
2 {
3  //------------------------------------------------------------------------------------------------
5  override void OnInit(IEntity pOwnerEntity, GenericComponent pManagerComponent)
6  {
7  super.OnInit(pOwnerEntity, pManagerComponent);
8 
9  array<string> colliderNames = {};
10  GetAllColliderNames(colliderNames);
11  if (colliderNames.IsEmpty())
12  return;
13 
14  Physics physics = pOwnerEntity.GetPhysics();
15  if (!physics)
16  return;
17 
18  SCR_PowerComponent powerComp = SCR_PowerComponent.Cast(pOwnerEntity.FindComponent(SCR_PowerComponent));
19  if (!powerComp)
20  return;
21 
22  // Only register battery hitzones that have colliders.
23  // Logical hitzones are not supported.
24  foreach (string colliderName: colliderNames)
25  {
26  if (physics.GetGeom(colliderName) == -1)
27  continue;
28 
29  powerComp.RegisterBatteryHitZone(this);
30  return;
31  }
32  }
33 
34  //------------------------------------------------------------------------------------------------
38  override void OnDamageStateChanged()
39  {
40  SCR_PowerComponent powerComp = SCR_PowerComponent.Cast(GetOwner().FindComponent(SCR_PowerComponent));
41  if (powerComp)
42  powerComp.UpdatePowerState();
43  }
44 };
SCR_VehicleHitZone
Definition: SCR_VehicleHitZone.c:1
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_BatteryHitZone
Definition: SCR_BatteryHitZone.c:1