Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_OverrideCharacterMedicalEditorAttribute.c
Go to the documentation of this file.
1 
4 // Script File
7 {
8  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
9  {
10  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
11  if (!editableEntity)
12  return null;
13 
14  IEntity owner = editableEntity.GetOwner();
15  if (!owner)
16  return null;
17 
18  ChimeraCharacter character = ChimeraCharacter.Cast(owner);
19  if (!character)
20  return null;
21 
22  SCR_CharacterDamageManagerComponent characterDamageManager = SCR_CharacterDamageManagerComponent.Cast(character.GetDamageManager());
23  if (!characterDamageManager)
24  return null;
25 
26  if (characterDamageManager.GetState() == EDamageState.DESTROYED)
27  return null;
28 
29  return SCR_BaseEditorAttributeVar.CreateBool(characterDamageManager.GetOverrideCharacterMedical());
30  }
31 
32  override void UpdateInterlinkedVariables(SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, bool isInit = false)
33  {
34  if (isInit)
35  {
36  manager.SetAttributeAsSubAttribute(SCR_CharRegenEditorAttribute);
37  manager.SetAttributeAsSubAttribute(SCR_CharBleedingEditorAttribute);
38  manager.SetAttributeAsSubAttribute(SCR_CharUnconsciousnessEditorAttribute);
39  }
40 
41  bool isOverridden = var && var.GetBool();
42 
43  manager.SetAttributeEnabled(SCR_CharRegenEditorAttribute, isOverridden);
44  manager.SetAttributeEnabled(SCR_CharBleedingEditorAttribute, isOverridden);
45  manager.SetAttributeEnabled(SCR_CharUnconsciousnessEditorAttribute, isOverridden);
46  }
47 
48  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
49  {
50  if (!var)
51  return;
52 
53  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
54  if (!editableEntity)
55  return;
56 
57  IEntity owner = editableEntity.GetOwner();
58  if (!owner)
59  return;
60 
61  ChimeraCharacter character = ChimeraCharacter.Cast(owner);
62  if (!character)
63  return;
64 
65  SCR_CharacterDamageManagerComponent characterDamageManager = SCR_CharacterDamageManagerComponent.Cast(character.GetDamageManager());
66  if (!characterDamageManager || characterDamageManager.GetState() == EDamageState.DESTROYED)
67  return;
68 
69  bool value = var.GetBool();
70 
71  if (!value)
72  {
73  SCR_GameModeHealthSettings gameModeHealthSettings = SCR_GameModeHealthSettings.Cast(GetGame().GetGameMode().FindComponent(SCR_GameModeHealthSettings));
74  if (!gameModeHealthSettings)
75  return;
76 
77  characterDamageManager.SetDOTScale(gameModeHealthSettings.GetBleedingScale(), false);
78  characterDamageManager.SetRegenScale(gameModeHealthSettings.GetRegenScale(), false);
79  characterDamageManager.SetPermitUnconsciousness(gameModeHealthSettings.IsUnconsciousnessPermitted(), true);
80  }
81 
82  characterDamageManager.SetOverrideCharacterMedical(value);
83  }
84 };
SCR_CharBleedingEditorAttribute
Definition: SCR_CharBleedingEditorAttribute.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_OverrideCharacterMedicalEditorAttribute
Definition: SCR_OverrideCharacterMedicalEditorAttribute.c:6
SCR_CharRegenEditorAttribute
Definition: SCR_CharRegenEditorAttribute.c:2
EDamageState
EDamageState
Definition: EDamageState.c:12
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_CharacterDamageManagerComponent
Definition: SCR_CharacterDamageManagerComponent.c:18
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_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
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