Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_InventoryAction.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
3
class
SCR_InventoryAction
:
ScriptedUserAction
4
{
5
#ifndef DISABLE_INVENTORY
6
InventoryItemComponent
m_Item;
7
protected
const
string
SREASON_TOO_BIG
=
"#AR-Inventory_InfoTooBig"
;
8
protected
const
string
SREASON_TOO_HEAVY
=
"#AR-Inventory_InfoTooHeavy"
;
9
10
//------------------------------------------------------------------------------------------------
11
protected
string
GetReason
( SCR_InventoryStorageManagerComponent
pInventoryManager
)
12
{
13
if
( !
pInventoryManager
)
14
return
""
;
15
EInventoryRetCode ERetCode =
pInventoryManager
.GetReturnCode();
16
string
sReason =
""
;
17
18
//ERetCode &= EInventoryRetCode.RETCODE_ITEM_TOO_BIG;
19
20
if
( ( ERetCode & EInventoryRetCode.RETCODE_ITEM_TOO_BIG ) == EInventoryRetCode.RETCODE_ITEM_TOO_BIG )
21
sReason +=
" "
+
SREASON_TOO_BIG
;
22
23
if
( ( ERetCode & EInventoryRetCode.RETCODE_ITEM_TOO_HEAVY ) == EInventoryRetCode.RETCODE_ITEM_TOO_HEAVY )
24
sReason +=
" "
+
SREASON_TOO_HEAVY
;
25
return
sReason;
26
}
27
28
29
//------------------------------------------------------------------------------------------------
30
override
bool
CanBeShownScript
(
IEntity
user)
31
{
32
if
(m_Item == null || m_Item.GetParentSlot() != null || m_Item.IsLocked())
33
return
false
;
34
35
IEntity
itemEntity = m_Item.GetOwner();
36
BaseMagazineComponent
baseMagComponent =
BaseMagazineComponent
.Cast(itemEntity.
FindComponent
(
BaseMagazineComponent
));
37
if
(baseMagComponent)
38
{
39
if
(baseMagComponent.IsUsed())
40
return
false
;
41
42
// This is a temporary fix for issue #18454,
43
// we should lock items during reload instead
44
IEntity
itemParent = itemEntity.
GetParent
();
45
if
(
ChimeraCharacter
.Cast(itemParent))
46
return
false
;
47
}
48
49
return
true
;
50
}
51
//------------------------------------------------------------------------------------------------
52
override
bool
CanBePerformedScript
(
IEntity
user)
53
{
54
if
(!user)
55
return
false
;
56
Managed genericInventoryManager = user.
FindComponent
( SCR_InventoryStorageManagerComponent );
57
if
(!genericInventoryManager)
58
return
false
;
59
RplComponent genericRpl = RplComponent.Cast(user.
FindComponent
( RplComponent ));
60
if
(!genericRpl)
61
return
false
;
62
63
return
genericRpl.IsOwner();
64
}
65
//---------------------------------------------------------
66
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
67
{
68
if
(!
CanBePerformedScript
(pUserEntity))
69
return
;
70
SCR_InventoryStorageManagerComponent genericInventoryManager = SCR_InventoryStorageManagerComponent.Cast(pUserEntity.
FindComponent
( SCR_InventoryStorageManagerComponent ));
71
if
( !genericInventoryManager )
72
return
;
73
PerformActionInternal
( genericInventoryManager, pOwnerEntity, pUserEntity);
74
75
}
76
77
//------------------------------------------------------------------------------------------------
78
override
bool
GetActionNameScript
(out
string
outName)
79
{
80
return
false
;
81
}
82
83
override
bool
HasLocalEffectOnlyScript
()
84
{
85
return
true
;
86
}
87
88
protected
void
PerformActionInternal
(SCR_InventoryStorageManagerComponent manager,
IEntity
pOwnerEntity,
IEntity
pUserEntity)
89
{
90
91
}
92
93
//------------------------------------------------------------------------------------------------
94
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
95
{
96
m_Item =
InventoryItemComponent
.Cast( pOwnerEntity .FindComponent(
InventoryItemComponent
));
97
}
98
//------------------------------------------------------------------------------------------------
99
#else
100
override
bool
GetActionNameScript
(out
string
outName)
101
{
102
outName =
"#AR-Inventory_Disabled"
;
103
return
true
;
104
}
105
#endif
106
107
};
pInventoryManager
SCR_InventoryStorageManagerComponent pInventoryManager
Definition
SCR_UniversalInventoryStorageComponent.c:25
BaseMagazineComponent
Definition
BaseMagazineComponent.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetParent
proto external IEntity GetParent()
InventoryItemComponent
Definition
InventoryItemComponent.c:13
SCR_InventoryAction
modded version for to be used with the inventory 2.0
Definition
SCR_InventoryAction.c:4
SCR_InventoryAction::SREASON_TOO_BIG
const string SREASON_TOO_BIG
Definition
SCR_InventoryAction.c:7
SCR_InventoryAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_InventoryAction.c:52
SCR_InventoryAction::HasLocalEffectOnlyScript
override bool HasLocalEffectOnlyScript()
Definition
SCR_InventoryAction.c:83
SCR_InventoryAction::GetReason
string GetReason(SCR_InventoryStorageManagerComponent pInventoryManager)
Definition
SCR_InventoryAction.c:11
SCR_InventoryAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_InventoryAction.c:66
SCR_InventoryAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_InventoryAction.c:94
SCR_InventoryAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_InventoryAction.c:78
SCR_InventoryAction::SREASON_TOO_HEAVY
const string SREASON_TOO_HEAVY
Definition
SCR_InventoryAction.c:8
SCR_InventoryAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_InventoryAction.c:30
SCR_InventoryAction::PerformActionInternal
void PerformActionInternal(SCR_InventoryStorageManagerComponent manager, IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_InventoryAction.c:88
ScriptedUserAction
Definition
ScriptedUserAction.c:13
scripts
Game
UserActions
SCR_InventoryAction.c
Generated by
1.17.0