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_EquipItemAction.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
3
class
SCR_EquipItemAction
:
SCR_InventoryAction
4
{
5
[
Attribute
(
"-1"
,
desc
:
"If this value is different thatn -1 then script will ignore slot that is normally used fot this\ntype of an item and it will try to use the slot with provided id.\nFirst slot number is 0 while last is 9"
,
params
:
"-1 9 1"
)]
6
protected
int
m_iEquipmentSlotIdOverride
;
7
8
protected
bool
m_bShowBindingInfo
;
9
10
protected
const
LocalizedString
REASON_NO_SPACE
=
"#AR-SupportStation_Resupply_ActionInvalid_NoInventorySpace"
;
11
protected
const
LocalizedString
TEXT_SLOT_ID
=
"#AR-ControlsHint_BindToQuickslot"
;
12
protected
const
string
FORMAT
=
"%1 (%2)"
;
13
14
//------------------------------------------------------------------------------------------------
15
override
bool
CanBePerformedScript
(
IEntity
user)
16
{
17
if
(!super.CanBePerformedScript(user))
18
return
false
;
19
20
SCR_InventoryStorageManagerComponent
pInventoryManager
= SCR_InventoryStorageManagerComponent.Cast(user.
FindComponent
(SCR_InventoryStorageManagerComponent));
21
if
(!
pInventoryManager
)
22
return
false
;
23
24
if
(!
pInventoryManager
.CanInsertItem(
GetOwner
()))
25
{
26
m_bShowBindingInfo
=
false
;
27
SetCannotPerformReason
(
REASON_NO_SPACE
);
28
return
false
;
29
}
30
31
if
(
m_iEquipmentSlotIdOverride
< 0)
32
return
true
;
33
34
SCR_CharacterInventoryStorageComponent
characterStorage =
pInventoryManager
.GetCharacterStorage();
35
if
(!characterStorage)
36
return
false
;
37
38
IEntity
boundItem = characterStorage.
GetItemFromQuickSlot
(
m_iEquipmentSlotIdOverride
);
39
if
(boundItem && boundItem.
GetPrefabData
().GetPrefabName() ==
GetOwner
().
GetPrefabData
().GetPrefabName())
40
m_bShowBindingInfo
=
false
;
41
else
42
m_bShowBindingInfo
=
true
;
43
44
return
true
;
45
}
46
47
//------------------------------------------------------------------------------------------------
48
override
protected
void
PerformActionInternal
(SCR_InventoryStorageManagerComponent manager,
IEntity
pOwnerEntity,
IEntity
pUserEntity)
49
{
50
SCR_InvEquipAnyItemCB inventoryCallBack =
new
SCR_InvEquipAnyItemCB();
51
inventoryCallBack.m_pItem = pOwnerEntity;
52
inventoryCallBack.m_pStorageToPickUp = manager.GetCharacterStorage();
53
inventoryCallBack.m_iSlotToFocus =
m_iEquipmentSlotIdOverride
;
54
inventoryCallBack.m_bShouldEquip =
true
;
55
56
manager.InsertItem(pOwnerEntity, cb: inventoryCallBack);
57
}
58
59
//------------------------------------------------------------------------------------------------
60
override
bool
GetActionNameScript
(out
string
outName)
61
{
62
if
(!
m_bShowBindingInfo
)
63
return
false
;
64
65
UIInfo
info =
GetUIInfo
();
66
if
(!info)
67
return
false
;
68
69
outName = info.GetName();
70
if
(
m_iEquipmentSlotIdOverride
< 0)
71
return
true
;
72
73
outName =
string
.Format(
FORMAT
, outName,
WidgetManager
.Translate(
TEXT_SLOT_ID
,
m_iEquipmentSlotIdOverride
+ 1));
74
return
true
;
75
}
76
}
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
pInventoryManager
SCR_InventoryStorageManagerComponent pInventoryManager
Definition
SCR_UniversalInventoryStorageComponent.c:25
GetPrefabData
SCR_VehicleDamageManagerComponentClass GetPrefabData()
Definition
SCR_VehicleDamageManagerComponent.c:393
BaseUserAction::SetCannotPerformReason
void SetCannotPerformReason(string reason)
Definition
BaseUserAction.c:21
BaseUserAction::GetOwner
proto external IEntity GetOwner()
Returns the parent entity of this action.
BaseUserAction::GetUIInfo
proto external UIInfo GetUIInfo()
Returns the UIInfo set for this user action or null if none.
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetPrefabData
proto external EntityPrefabData GetPrefabData()
LocalizedString
Definition
LocalizedString.c:22
SCR_CharacterInventoryStorageComponent
Definition
SCR_CharacterInventoryStorageComponent.c:90
SCR_CharacterInventoryStorageComponent::GetItemFromQuickSlot
IEntity GetItemFromQuickSlot(int index)
Definition
SCR_CharacterInventoryStorageComponent.c:510
SCR_EquipItemAction
modded version for to be used with the inventory 2.0
Definition
SCR_EquipItemAction.c:4
SCR_EquipItemAction::TEXT_SLOT_ID
const LocalizedString TEXT_SLOT_ID
Definition
SCR_EquipItemAction.c:11
SCR_EquipItemAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_EquipItemAction.c:15
SCR_EquipItemAction::PerformActionInternal
void PerformActionInternal(SCR_InventoryStorageManagerComponent manager, IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_EquipItemAction.c:48
SCR_EquipItemAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_EquipItemAction.c:60
SCR_EquipItemAction::m_iEquipmentSlotIdOverride
int m_iEquipmentSlotIdOverride
Definition
SCR_EquipItemAction.c:6
SCR_EquipItemAction::m_bShowBindingInfo
bool m_bShowBindingInfo
Definition
SCR_EquipItemAction.c:8
SCR_EquipItemAction::FORMAT
const string FORMAT
Definition
SCR_EquipItemAction.c:12
SCR_EquipItemAction::REASON_NO_SPACE
const LocalizedString REASON_NO_SPACE
Definition
SCR_EquipItemAction.c:10
SCR_InventoryAction
modded version for to be used with the inventory 2.0
Definition
SCR_InventoryAction.c:4
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
WidgetManager
Definition
WidgetManager.c:16
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UserActions
SCR_EquipItemAction.c
Generated by
1.17.0