Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CharUnconsciousnessEditorAttribute.c
Go to the documentation of this file.
3 {
4  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
5  {
7  if (!editableEntity)
8  return null;
9 
10  IEntity owner = editableEntity.GetOwner();
11  if (!owner)
12  return null;
13 
14  ChimeraCharacter character = ChimeraCharacter.Cast(owner);
15  if (!character)
16  return null;
17 
18  SCR_CharacterDamageManagerComponent characterDamageManager = SCR_CharacterDamageManagerComponent.Cast(character.GetDamageManager());
19  if (!characterDamageManager)
20  return null;
21 
22  if (characterDamageManager.GetState() == EDamageState.DESTROYED)
23  return null;
24 
25  return SCR_BaseEditorAttributeVar.CreateBool(characterDamageManager.GetPermitUnconsciousness());
26  }
27 
28  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
29  {
30  if (!var)
31  return;
32 
33  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
34  if (!editableEntity)
35  return;
36 
37  ChimeraCharacter character = ChimeraCharacter.Cast(editableEntity.GetOwner());
38  if (!character)
39  return;
40 
41  SCR_CharacterDamageManagerComponent characterDamageManager = SCR_CharacterDamageManagerComponent.Cast(character.GetDamageManager());
42  if (!characterDamageManager)
43  return;
44 
45  CharacterControllerComponent controller = CharacterControllerComponent.Cast(character.GetCharacterController());
46  if (!controller)
47  return;
48 
49  ECharacterLifeState lifeState = controller.GetLifeState();
50  if (lifeState == ECharacterLifeState.DEAD)
51  return;
52 
53  if (!characterDamageManager.IsDamageHandlingEnabled())
54  return;
55 
56  //Neutralize character if unconsciousness is disabled and character is already unconscious
57  if (lifeState == ECharacterLifeState.INCAPACITATED && !var.GetBool())
58  characterDamageManager.Kill(Instigator.CreateInstigator(null));
59 
60  characterDamageManager.SetPermitUnconsciousness(var.GetBool(), true);
61  }
62 };
ECharacterLifeState
ECharacterLifeState
Definition: ECharacterLifeState.c:12
EDamageState
EDamageState
Definition: EDamageState.c:12
Instigator
Definition: Instigator.c:6
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
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