Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_IdentityItemStorageComponent.c
Go to the documentation of this file.
2{
3}
4
5class SCR_IdentityItemStorageComponent : SCR_EquipmentStorageComponent
6{
7 //------------------------------------------------------------------------------------------------
8 //~ Make sure the identity item is not shown if 'worn'
9 protected override void OnAddedToSlot(IEntity item, int slotID)
10 {
11 super.OnAddedToSlot(item, slotID);
12
14 if (!itemComponent)
15 return;
16
17 itemComponent.HideOwner();
18 }
19
20 //------------------------------------------------------------------------------------------------
21 //~ Make sure the identity item is shown when removed from the slot
22 override void OnRemovedFromSlot(IEntity item, int slotID)
23 {
24 super.OnRemovedFromSlot(item, slotID);
25
27 if (!itemComponent)
28 return;
29
30 itemComponent.ShowOwner();
31 }
32
33 //------------------------------------------------------------------------------------------------
34 //~ Only allow items to be stored in the slot if the identity slot is enabled
35 override bool CanStoreItem(IEntity item, int slotID)
36 {
38
39 return identityManager && identityManager.IsIdentityItemSlotEnabled();
40 }
41
42 //------------------------------------------------------------------------------------------------
43 //~ Only allow items to be stored in the slot if the identity slot is enabled
44 override bool CanStoreResource(ResourceName resourceName, int slotID)
45 {
47
48 return identityManager && identityManager.IsIdentityItemSlotEnabled();
49 }
50
51 //------------------------------------------------------------------------------------------------
52 //~ When identity slot is enabled it will never allow the item to be removed (Unless the item is also added when character falls Unconscious)
53 override bool CanRemoveItem(IEntity item)
54 {
55 ChimeraCharacter character = ChimeraCharacter.Cast(GetOwner());
56 if (!character)
57 return true;
58
60
61 //~ Can remove when Unconscious
62 if (identityManager && identityManager.HasIdentityItemGenerationType(SCR_EIdentityItemGenerationType.ON_UNCONSCIOUS))
63 {
64 //~ Character is unconcious
65 SCR_CharacterControllerComponent controllerComponent = SCR_CharacterControllerComponent.Cast(character.GetCharacterController());
66 if (controllerComponent && controllerComponent.GetLifeState() == ECharacterLifeState.INCAPACITATED)
67 return true;
68 }
69
70 //~ Allowed to remove the item if the character is dead
71 return character && character.GetDamageManager().GetState() == EDamageState.DESTROYED;
72 }
73
74 //------------------------------------------------------------------------------------------------
75 //~ When identity slot is enabled it will never allow the item to be replaced
76 override bool CanReplaceItem(IEntity nextItem, int slotID)
77 {
78 return false;
79 }
80}
ResourceName resourceName
Definition SCR_AIGroup.c:66
override bool CanStoreItem(IEntity item, int slotID)
SCR_EIdentityItemGenerationType
When will the identity item be generated on the character.
proto external Managed FindComponent(typename typeName)
static SCR_IdentityManagerComponent GetInstance()
bool HasIdentityItemGenerationType(SCR_EIdentityItemGenerationType type)
IEntity GetOwner()
Owner entity of the fuel tank.
ECharacterLifeState
EDamageState
void OnRemovedFromSlot(IEntity item, int slotID)
event bool CanStoreResource(ResourceName resourceName, int slotID)
Implemented logics for can insert here, Manager will provide slotID of -1 in case slot is irrelevant.
event bool CanReplaceItem(IEntity nextItem, int slotID)
Implemented logics for can replace to nextItem at slotID,.
void OnAddedToSlot(IEntity item, int slotID)
event bool CanRemoveItem(IEntity item)
Implemented logics for can remove here,.