Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MultiOccupantVehicleTooltipDetail.c
Go to the documentation of this file.
3 {
4  protected SCR_MultiTextTooltipUIComponent m_MultiLineTextWidget
5  protected SCR_BaseCompartmentManagerComponent m_CompartmentManager;
6 
7  protected PlayerManager m_PlayerManager;
8 
9  [Attribute("#AR-Editor_TooltipDetail_Compartment_Empty")]
10  private string m_sEmptyDriverText;
11 
12  [Attribute("#AR-Editor_TooltipDetail_Compartment_Player")]
13  private string m_sPlayerText;
14 
15  [Attribute("0", UIWidgets.ComboBox, "Compartment type to Check", "The type of compartment that this tooltip checks to see if they are filled", ParamEnumArray.FromEnum(ECompartmentType) )]
16  protected ECompartmentType m_iCompartmentTypeToCheck;
17 
18  //------------------------------------------------------------------------------------------------
19  override bool NeedUpdate()
20  {
21  return m_CompartmentManager != null;
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  override void UpdateDetail(SCR_EditableEntityComponent entity)
26  {
27  if (!m_CompartmentManager || !m_MultiLineTextWidget)
28  return;
29 
30  m_MultiLineTextWidget.ClearAllText();
31 
32  array<BaseCompartmentSlot> compartments = {};
33  m_CompartmentManager.GetCompartmentsOfType(compartments, m_iCompartmentTypeToCheck);
34  int total = compartments.Count();
35 
36  IEntity occupant;
37  SCR_EditableEntityComponent editableGunner;
38 
39  for (int i = 0; i < total; i++)
40  {
41  occupant = compartments[i].GetOccupant();
42 
43  if (!occupant)
44  {
45  m_MultiLineTextWidget.AddText(m_sEmptyDriverText);
46  }
47  else
48  {
49  editableGunner = SCR_EditableEntityComponent.GetEditableEntity(occupant);
50 
51  int playerID = editableGunner.GetPlayerID();
52 
53  if (playerID <= 0 || !m_PlayerManager)
54  m_MultiLineTextWidget.AddText(editableGunner.GetDisplayName());
55  else
56  m_MultiLineTextWidget.AddText(m_sPlayerText, m_PlayerManager.GetPlayerName(playerID));
57  }
58  }
59  }
60 
61  //------------------------------------------------------------------------------------------------
62  override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
63  {
64  m_MultiLineTextWidget = SCR_MultiTextTooltipUIComponent.Cast(widget.FindHandler(SCR_MultiTextTooltipUIComponent));
65  if (!m_MultiLineTextWidget)
66  return false;
67 
68  m_CompartmentManager = SCR_BaseCompartmentManagerComponent.Cast(entity.GetOwner().FindComponent(SCR_BaseCompartmentManagerComponent));
69 
71  return false;
72 
73  array<BaseCompartmentSlot> compartments = {};
74  m_CompartmentManager.GetCompartmentsOfType(compartments, m_iCompartmentTypeToCheck);
75 
76  if (compartments.IsEmpty())
77  return false;
78 
79  DamageManagerComponent damageManager = DamageManagerComponent.Cast(entity.GetOwner().FindComponent(DamageManagerComponent));
80  if (damageManager && damageManager.GetState() == EDamageState.DESTROYED)
81  return false;
82 
83  m_PlayerManager = GetGame().GetPlayerManager();
84 
85  return true;
86  }
87 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ECompartmentType
ECompartmentType
Definition: ECompartmentType.c:7
EDamageState
EDamageState
Definition: EDamageState.c:12
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_CompartmentManager
protected SCR_BaseCompartmentManagerComponent m_CompartmentManager
Definition: SCR_VehicleDamageManagerComponent.c:191
SCR_MultiTextTooltipUIComponent
Definition: SCR_MultiTextTooltipUIComponent.c:1
SCR_EntityTooltipDetail
Definition: SCR_EntityTooltipDetail.c:2
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
m_PlayerManager
protected PlayerManager m_PlayerManager
Definition: SCR_PlayerTeleportedFeedbackComponent.c:9
DamageManagerComponent
Definition: DamageManagerComponent.c:12
PlayerManager
Definition: PlayerManager.c:12
SCR_MultiOccupantVehcileTooltipDetail
Definition: SCR_MultiOccupantVehicleTooltipDetail.c:2
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