Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ConsumableEffectHealthItems.c
Go to the documentation of this file.
2 class SCR_ConsumableEffectHealthItems : SCR_ConsumableEffectBase
3 {
4  //------------------------------------------------------------------------------------------------
5  override bool ActivateEffect(IEntity target, IEntity user, IEntity item, ItemUseParameters animParams = null)
6  {
7  ItemUseParameters localAnimParams = animParams;
8  if (!localAnimParams)
9  {
10  //user-held healthitem needs to get data from target to perform anim
11  localAnimParams = GetAnimationParameters(item, target);
12  }
13 
14  if (!localAnimParams)
15  return false;
16 
17  if (!super.ActivateEffect(target, user, item, localAnimParams))
18  return false;
19 
20  ChimeraCharacter character = ChimeraCharacter.Cast(target);
21  if (!character)
22  return false;
23 
24  CharacterControllerComponent controller = character.GetCharacterController();
25  if (!controller)
26  return false;
27 
28  if (localAnimParams.GetIntParam() == EBandagingAnimationBodyParts.LeftLeg || localAnimParams.GetIntParam() == EBandagingAnimationBodyParts.RightLeg)
29  {
30  if (controller.GetStance() == ECharacterStance.STAND)
31  controller.SetStanceChange(ECharacterStanceChange.STANCECHANGE_TOCROUCH);
32  }
33 
34  return true;
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  override void ApplyEffect(notnull IEntity target, notnull IEntity user, IEntity item, ItemUseParameters animParams)
39  {
40  InventoryItemComponent itemComp = InventoryItemComponent.Cast(item.FindComponent(InventoryItemComponent));
41  if (itemComp)
42  itemComp.RequestUserLock(user, false);
43  }
44 
45  //------------------------------------------------------------------------------------------------
46  override bool UpdateAnimationCommands(IEntity user)
47  {
48  ChimeraCharacter char = ChimeraCharacter.Cast(user);
49  if (!char)
50  return false;
51 
52  CharacterAnimationComponent animationComponent = char.GetAnimationComponent();
53  if (!animationComponent)
54  return false;
55 
56  m_iPlayerApplyToSelfCmdId = animationComponent.BindCommand("CMD_HealSelf");
57  m_iPlayerApplyToOtherCmdId = animationComponent.BindCommand("CMD_HealOther");
58  m_iPlayerReviveCmdId = animationComponent.BindCommand("CMD_Revive");
59  if (m_iPlayerApplyToSelfCmdId < 0 || m_iPlayerApplyToOtherCmdId < 0)
60  {
61  Print("One or both healing animationCommands have incorrect ID's!!", LogLevel.ERROR);
62  return false;
63  }
64 
65  return true;
66  }
67 
68  //------------------------------------------------------------------------------------------------
74  bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason = SCR_EConsumableFailReason.NONE);
75 
76  //------------------------------------------------------------------------------------------------
79  TAnimGraphCommand GetReviveAnimCmnd(IEntity user)
80  {
81  UpdateAnimationCommands(user);
82  return m_iPlayerReviveCmdId;
83  }
84 }
ECharacterHitZoneGroup
ECharacterHitZoneGroup
Definition: SCR_CharacterDamageManagerComponent.c:1
SCR_ConsumableEffectHealthItems
Definition: SCR_ConsumableEffectHealthItems.c:2
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
ItemUseParameters
Definition: ItemUseParameters.c:15
ECharacterStanceChange
ECharacterStanceChange
Definition: ECharacterStanceChange.c:12
InventoryItemComponent
Definition: InventoryItemComponent.c:12
EBandagingAnimationBodyParts
EBandagingAnimationBodyParts
Definition: SCR_CharacterHitZone.c:27
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