Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BatteryHitZone.c
Go to the documentation of this file.
2{
3 //---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
4 // TODO: Collider ID retrieval is obsolete
5 //------------------------------------------------------------------------------------------------
7 override void OnInit(IEntity pOwnerEntity, GenericComponent pManagerComponent)
8 {
9 super.OnInit(pOwnerEntity, pManagerComponent);
10
11 array<string> colliderNames = {};
12 GetAllColliderNames(colliderNames);
13 if (colliderNames.IsEmpty())
14 return;
15
16 Physics physics = pOwnerEntity.GetPhysics();
17 if (!physics)
18 return;
19
20 SCR_PowerComponent powerComp = SCR_PowerComponent.Cast(pOwnerEntity.FindComponent(SCR_PowerComponent));
21 if (!powerComp)
22 return;
23
24 // Only register battery hitzones that have colliders.
25 // Logical hitzones are not supported.
26 foreach (string colliderName: colliderNames)
27 {
28 if (physics.GetGeom(colliderName) == -1)
29 continue;
30
31 powerComp.RegisterBatteryHitZone(this);
32 return;
33 }
34 }
35 //---- REFACTOR NOTE END ----
36
37 //------------------------------------------------------------------------------------------------
41 override void OnDamageStateChanged(EDamageState newState, EDamageState previousDamageState, bool isJIP)
42 {
43 SCR_PowerComponent powerComp = SCR_PowerComponent.Cast(GetOwner().FindComponent(SCR_PowerComponent));
44 if (powerComp)
45 powerComp.UpdatePowerState();
46 }
47};
proto external Managed FindComponent(typename typeName)
proto external Physics GetPhysics()
IEntity GetOwner()
Definition SCR_HitZone.c:42
EDamageState