Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FuelHitZone.c
Go to the documentation of this file.
2 {
3  [Attribute(defvalue: "1", uiwidget: UIWidgets.Auto, desc: "Fuel Tank ID", category: "Fuel Damage Config")]
4  protected int m_iFuelTankID;
5 
6  [Attribute(EVehicleHitZoneGroup.FUEL_TANKS.ToString(), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EVehicleHitZoneGroup))]
7  protected EVehicleHitZoneGroup m_eHitZoneGroup;
8 
9  protected SCR_FuelNode m_FuelTank;
10 
11  //------------------------------------------------------------------------------------------------
12  override EHitZoneGroup GetHitZoneGroup()
13  {
14  return m_eHitZoneGroup;
15  }
16 
17  //------------------------------------------------------------------------------------------------
18  override void OnInit(IEntity pOwnerEntity, GenericComponent pManagerComponent)
19  {
20  super.OnInit(pOwnerEntity, pManagerComponent);
21 
22  SetFuelNodeID(m_iFuelTankID);
23  }
24 
25  //------------------------------------------------------------------------------------------------
26  void UpdateFuelTankState()
27  {
28  if (!m_FuelTank)
29  return;
30 
31  EDamageState state = GetDamageState();
32  float health = GetDamageStateThreshold(state);
33  m_FuelTank.SetHealth(health);
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  SCR_FuelNode GetFuelTank()
38  {
39  return m_FuelTank;
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  int GetFuelTankID()
44  {
45  return m_iFuelTankID;
46  }
47 
48  //------------------------------------------------------------------------------------------------
50  void SetFuelNodeID(int fuelNodeID)
51  {
52  m_iFuelTankID = fuelNodeID;
53 
54  FuelManagerComponent fuelManager = FuelManagerComponent.Cast(GetOwner().FindComponent(FuelManagerComponent));
55  if (!fuelManager)
56  return;
57 
58  SCR_FuelNode scrFuelNode;
59  array<BaseFuelNode> fuelNodes = {};
60  fuelManager.GetFuelNodesList(fuelNodes);
61  foreach (BaseFuelNode fuelNode : fuelNodes)
62  {
63  scrFuelNode = SCR_FuelNode.Cast(fuelNode);
64  if (scrFuelNode && scrFuelNode.GetFuelTankID() == m_iFuelTankID)
65  {
66  m_FuelTank = scrFuelNode;
67  break;
68  }
69  }
70 
71  UpdateFuelTankState();
72  }
73 
74  //------------------------------------------------------------------------------------------------
75  override void OnDamageStateChanged()
76  {
77  super.OnDamageStateChanged();
78 
79  UpdateFuelTankState();
80  }
81 
82  //------------------------------------------------------------------------------------------------
84  override float GetSecondaryExplosionScale()
85  {
86  // Truck addon fuel cargo that does not have its own health
87  float damage;
88  if (GetBaseDamageMultiplier() == 0 && GetHitZoneContainer().GetDefaultHitZone() == this)
89  damage = 1;
90  else
91  damage = 1 - GetDamageStateThreshold(GetDamageState());
92 
93  // TODO: Curve based on fuel to air ratio
94  return m_FuelTank.GetFuel() * damage;
95  }
96 }
m_eHitZoneGroup
protected ECharacterHitZoneGroup m_eHitZoneGroup
Definition: SCR_InventoryHitZonePointUI.c:403
BaseFuelNode
Definition: BaseFuelNode.c:12
SCR_DestructibleHitzone
Definition: SCR_DestructibleHitzone.c:3
EDamageState
EDamageState
Definition: EDamageState.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
m_iFuelTankID
protected int m_iFuelTankID
Definition: SCR_FuelNode.c:51
SCR_FuelHitZone
Definition: SCR_FuelHitZone.c:1
EVehicleHitZoneGroup
EVehicleHitZoneGroup
Definition: SCR_VehicleDamageManagerComponent.c:1
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180