Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CharacterBloodAttributeDynamicDescription.c
Go to the documentation of this file.
1 
4 [BaseContainerProps(), BaseContainerCustomStringTitleField("Blood level warnings (CUSTOM)")]
6 {
7  [Attribute("1", desc: "If true will show the description if value is set to less or equal than unconcious level. If false will set the description if set greater than unconcious level")]
8  protected bool m_bLessOrEqualThan;
9 
10  [Attribute("1", desc: "If true it will only show this description if unconsciousness is enabled, else it will only show if disabled")]
11  protected bool m_bOnlyShowIfUnconsciousnessEnabled;
12 
13  protected SCR_AttributesManagerEditorComponent m_AttributeManager;
14 
15  protected bool m_bEntityUnconsciousnessPermitted = false;
16  protected float m_fUnconsciousLevel;
17  protected float m_fStartingValue;
18 
19  //------------------------------------------------------------------------------------------------
20  override void InitDynamicDescription(notnull SCR_BaseEditorAttribute attribute, notnull SCR_BaseEditorAttributeUIComponent attributeUi)
21  {
22  super.InitDynamicDescription(attribute);
23 
25 
26  if (!bloodSlider)
27  {
28  Print("'SCR_CharacterBloodAttributeDynamicDescription' is not attached to an attribute with the 'SCR_SliderBloodAttributeComponent' ui!", LogLevel.ERROR);
29  return;
30  }
31 
32  if (!m_AttributeManager)
33  m_AttributeManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
34 
35  SCR_BaseEditorAttributeVar var = attribute.GetVariableOrCopy();
36  if (!var)
37  return;
38 
39  m_fStartingValue = var.GetFloat();
40  m_fUnconsciousLevel = bloodSlider.GetUnconsciousLevel();
41 
42  }
43 
44  //------------------------------------------------------------------------------------------------
45  protected bool IsUnconsciousnessEnabled()
46  {
47  //~ If attribute found check if enabled from the attribute
48  SCR_BaseEditorAttributeVar unconciousVar;
49  if (m_AttributeManager.GetAttributeVariable(SCR_CharUnconsciousnessEditorAttribute, unconciousVar))
50  return unconciousVar.GetBool();
51 
52  BaseGameMode gameMode = GetGame().GetGameMode();
53  if (gameMode)
54  {
55  SCR_GameModeHealthSettings healthSettings = SCR_GameModeHealthSettings.Cast(gameMode.FindComponent(SCR_GameModeHealthSettings));
56  if (healthSettings)
57  {
58  return healthSettings.IsUnconsciousnessPermitted();
59  }
60  }
61 
62  return false;
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  override bool IsValid(notnull SCR_BaseEditorAttribute attribute, notnull SCR_BaseEditorAttributeUIComponent attributeUi)
67  {
68  if (!super.IsValid(attribute, attributeUi) || !m_AttributeManager || m_bOnlyShowIfUnconsciousnessEnabled != IsUnconsciousnessEnabled())
69  return false;
70 
71  SCR_BaseEditorAttributeVar var = attribute.GetVariableOrCopy();
72  if (!var)
73  return false;
74 
75  float value = var.GetFloat();
76 
77  if (m_bLessOrEqualThan)
78  {
79  if (m_fStartingValue <= m_fUnconsciousLevel || value > m_fUnconsciousLevel)
80  return false;
81 
82  return true;
83  }
84  else
85  {
86  if (m_fStartingValue > m_fUnconsciousLevel || value <= m_fUnconsciousLevel)
87  return false;
88 
89  return true;
90  }
91  }
92 };
SCR_BaseAttributeDynamicDescription
Definition: SCR_BaseAttributeDynamicDescription.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
BaseContainerCustomStringTitleField
class SCR_HitZoneGroupNameHolder BaseContainerCustomStringTitleField("USE INHERENT VERSION ONLY!")
Definition: SCR_HitZoneGroupNameHolder.c:27
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition: SCR_BaseEditorAttribute.c:3
SCR_BaseEditorAttributeUIComponent
Definition: SCR_BaseEditorAttributeUIComponent.c:3
SCR_CharacterBloodAttributeDynamicDescription
Definition: SCR_CharacterBloodAttributeDynamicDescription.c:5
SCR_SliderBloodAttributeComponent
Definition: SCR_SliderBloodAttributeComponent.c:1
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
SCR_CharUnconsciousnessEditorAttribute
Definition: SCR_CharUnconsciousnessEditorAttribute.c:2