Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
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")]
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
33 m_AttributeManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
34
35 SCR_BaseEditorAttributeVar var = attribute.GetVariableOrCopy();
36 if (!var)
37 return;
38
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
78 {
80 return false;
81
82 return true;
83 }
84 else
85 {
87 return false;
88
89 return true;
90 }
91 }
92};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_HitZoneGroupNameHolder BaseContainerCustomStringTitleField("USE INHERITED VERSION ONLY!")
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
override void InitDynamicDescription(notnull SCR_BaseEditorAttribute attribute, notnull SCR_BaseEditorAttributeUIComponent attributeUi)
override bool IsValid(notnull SCR_BaseEditorAttribute attribute, notnull SCR_BaseEditorAttributeUIComponent attributeUi)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute