Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LoadCasualtySupportStationUserAction.c
Go to the documentation of this file.
2 {
3  [Attribute("#AR-UserAction_LoadCasualty_NoSpace", desc: "Text shown when character can not be loaded as there is no space in the vehicle", uiwidget: UIWidgets.LocaleEditBox)]
4  protected LocalizedString m_sInvalidNoSpace;
5 
6  protected CharacterControllerComponent m_CharacterController;
7  protected FactionAffiliationComponent m_FactionAffiliation;
8 
9  //------------------------------------------------------------------------------------------------
10  protected override ESupportStationType GetSupportStationType()
11  {
12  return ESupportStationType.LOAD_CASUALTY;
13  }
14 
15  //------------------------------------------------------------------------------------------------
16  protected override void DelayedInit(IEntity owner)
17  {
18  if (!owner)
19  return;
20 
21  super.DelayedInit(owner);
22 
23  ChimeraCharacter character = ChimeraCharacter.Cast(owner);
24  if (!character)
25  return;
26 
27  m_CharacterController = character.GetCharacterController();
28  m_FactionAffiliation = FactionAffiliationComponent.Cast(owner.FindComponent(FactionAffiliationComponent));
29  }
30 
31  //------------------------------------------------------------------------------------------------
32  protected override LocalizedString GetInvalidPerformReasonString(ESupportStationReasonInvalid reasonInvalid)
33  {
34  //~ No space to load casualty
35  if (reasonInvalid == ESupportStationReasonInvalid.LOAD_CASUALTY_NO_SPACE)
36  return m_sInvalidNoSpace;
37 
38  return super.GetInvalidPerformReasonString(reasonInvalid);
39  }
40 
41  //------------------------------------------------------------------------------------------------
42  override bool CanBeShownScript(IEntity user)
43  {
44  if (!m_CharacterController || m_CharacterController.GetLifeState() != ECharacterLifeState.INCAPACITATED)
45  return false;
46 
47  if (m_FactionAffiliation)
48  {
49  FactionAffiliationComponent userFactionAffiliation = FactionAffiliationComponent.Cast(user.FindComponent(FactionAffiliationComponent));
50  if (userFactionAffiliation)
51  {
52  //~ Do not show if character is an enemy
53  Faction ownerFaction = m_FactionAffiliation.GetAffiliatedFaction();
54  if (ownerFaction && ownerFaction.IsFactionEnemy(userFactionAffiliation.GetAffiliatedFaction()))
55  return false;
56  }
57  }
58 
59  return super.CanBeShownScript(user);
60  }
61 }
ECharacterLifeState
ECharacterLifeState
Definition: ECharacterLifeState.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_CharacterController
SCR_CharacterPerceivableComponentClass m_CharacterController
ESupportStationReasonInvalid
ESupportStationReasonInvalid
Definition: ESupportStationReasonInvalid.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
ESupportStationType
ESupportStationType
Definition: ESupportStationType.c:2
Faction
Definition: Faction.c:12
SCR_BaseUseSupportStationAction
Definition: SCR_BaseUseSupportStationAction.c:1
LocalizedString
Definition: LocalizedString.c:21
SCR_LoadCasualtySupportStationUserAction
Definition: SCR_LoadCasualtySupportStationUserAction.c:1