Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SalineBagUserAction.c
Go to the documentation of this file.
2{
3
4 //------------------------------------------------------------------------------------------------
7 override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
8 {
9 ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
10 if (!character)
11 return;
12
13 CharacterControllerComponent controller = character.GetCharacterController();
14 if (!controller)
15 return;
16
17 if (controller.GetLifeState() != ECharacterLifeState.ALIVE)
18 return;
19
20 SCR_ConsumableItemComponent consumableComponent = GetConsumableComponent(character);
21 if (consumableComponent)
22 consumableComponent.SetAlternativeModel(false);
23 }
24
25 //------------------------------------------------------------------------------------------------
26 override bool CanBePerformedScript(IEntity user)
27 {
28 // Target character
29 ChimeraCharacter targetCharacter = ChimeraCharacter.Cast(GetOwner());
30 if (!targetCharacter)
31 return false;
32
33 // Medic character
34 ChimeraCharacter userCharacter = ChimeraCharacter.Cast(user);
35 if (!userCharacter)
36 return false;
37
38 SCR_ConsumableItemComponent consumableComponent = GetConsumableComponent(userCharacter);
39 if (!consumableComponent)
40 return false;
41
42 SCR_ConsumableSalineBag consumableSaline = SCR_ConsumableSalineBag.Cast(consumableComponent.GetConsumableEffect());
43 if (!consumableSaline)
44 return false;
45
46 int reason;
47 if (consumableSaline.CanApplyEffectToHZ(targetCharacter, userCharacter, m_eHitZoneGroup, reason))
48 return true;
49
50 if (reason == SCR_EConsumableFailReason.UNDAMAGED)
52
53 if (reason == SCR_EConsumableFailReason.ALREADY_APPLIED)
55
56 return false;
57 }
58};
void SetCannotPerformReason(string reason)
proto external IEntity GetOwner()
Returns the parent entity of this action.
ECharacterHitZoneGroup m_eHitZoneGroup
LocalizedString m_sAlreadyApplied
SCR_ConsumableItemComponent GetConsumableComponent(notnull ChimeraCharacter userChar)
ECharacterLifeState