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_WeaponRackSlotEntity.c
Go to the documentation of this file.
1
[
EntityEditorProps
(
category
:
"GameScripted/Campaign"
, description:
"A weapon rack slot to be filled with a weapon."
, color:
"0 0 255 255"
)]
2
class
SCR_WeaponRackSlotEntityClass
: GenericEntityClass
3
{
4
};
5
6
//------------------------------------------------------------------------------------------------
7
class
SCR_WeaponRackSlotEntity
:
GenericEntity
8
{
9
[
Attribute
(
"0"
,
UIWidgets
.Flags,
""
, enums: ParamEnumArray.FromEnum(
SCR_EArsenalItemType
))]
10
protected
SCR_EArsenalItemType
m_eSupportedItemTypes
;
11
12
[
Attribute
(
"0"
,
UIWidgets
.Flags,
""
, enums: ParamEnumArray.FromEnum(
SCR_EArsenalItemMode
))]
13
protected
SCR_EArsenalItemMode
m_eSupportedItemModes
;
14
15
protected
SCR_EArsenalItemType
m_eCurrentItemType
;
16
protected
SCR_EArsenalItemMode
m_eCurrentItemMode
;
17
18
//------------------------------------------------------------------------------------------------
19
SCR_EArsenalItemType
GetSlotSupportedItemTypes
()
20
{
21
return
m_eSupportedItemTypes
;
22
}
23
24
//------------------------------------------------------------------------------------------------
25
SCR_EArsenalItemMode
GetSlotSupportedItemModes
()
26
{
27
return
m_eSupportedItemModes
;
28
}
29
30
//------------------------------------------------------------------------------------------------
31
SCR_EArsenalItemMode
GetCurrentOccupiedItemType
()
32
{
33
return
m_eCurrentItemType
;
34
}
35
36
//------------------------------------------------------------------------------------------------
37
SCR_EArsenalItemMode
GetCurrentOccupiedItemMode
()
38
{
39
return
m_eCurrentItemMode
;
40
}
41
42
//------------------------------------------------------------------------------------------------
44
void
RemoveItem
()
45
{
46
IEntity
child =
GetChildren
();
47
if
(child)
48
{
49
RplComponent.DeleteRplEntity(child,
false
);
50
}
51
}
52
53
//------------------------------------------------------------------------------------------------
57
bool
CanSpawnItem
(
bool
deleteExisting =
false
)
58
{
59
if
(deleteExisting)
60
return
true
;
61
62
return
!
GetChildren
();
63
}
64
65
//------------------------------------------------------------------------------------------------
73
// TODO: notnull itemResource & arsenalData
74
void
SpawnNewItem
(
Resource
itemResource,
SCR_ArsenalItem
arsenalData,
SCR_ArsenalItemDisplayData
itemDisplayData = null,
bool
deleteExisting =
false
)
75
{
76
IEntity
child =
GetChildren
();
77
if
(child)
78
{
79
if
(deleteExisting)
80
RplComponent.DeleteRplEntity(child,
false
);
81
else
82
return
;
83
}
84
85
EntitySpawnParams
params
=
new
EntitySpawnParams
();
86
params
.Parent =
this
;
87
params
.TransformMode = ETransformMode.WORLD;
88
89
IEntity
item =
GetGame
().SpawnEntityPrefab(itemResource,
GetWorld
(),
params
);
90
if
(!item)
91
return
;
92
93
// Since item is in hierarchy in which parent (slotEntity) is not traceable (also has no volume), we'll have
94
// to clear its proxy flag so we can trace the item safely. Proxy flag is reset on pickup via item slots
95
item.
ClearFlags
(
EntityFlags
.PROXY);
96
97
vector
positionOffset, rotationOffset =
vector
.Zero;
98
if
(itemDisplayData)
99
{
100
positionOffset = itemDisplayData.GetItemOffset();
101
rotationOffset = itemDisplayData.GetItemRotation();
102
}
103
104
// set weapon rotation
105
item.
SetAngles
(rotationOffset);
106
107
// offset the item locally
108
vector
mat[4];
109
item.
GetLocalTransform
(mat);
110
mat[3] = mat[3] + positionOffset;
111
item.
SetLocalTransform
(mat);
112
113
if
(item.
FindComponent
(
MagazineComponent
))
114
item.
SetFlags
(
EntityFlags
.PROXY);
115
116
item.
ClearFlags
(
EntityFlags
.ACTIVE);
117
118
InventoryItemComponent
itemComp =
InventoryItemComponent
.Cast(item.
FindComponent
(
InventoryItemComponent
));
119
if
(itemComp)
120
{
121
itemComp.DisablePhysics();
122
}
123
124
item.
Update
();
125
126
m_eCurrentItemType
= arsenalData.
GetItemType
();
127
m_eCurrentItemMode
= arsenalData.
GetItemMode
();
128
}
129
130
//------------------------------------------------------------------------------------------------
131
void
SCR_WeaponRackSlotEntity
(
IEntitySource
src,
IEntity
parent)
132
{
133
}
134
135
//------------------------------------------------------------------------------------------------
136
void
~SCR_WeaponRackSlotEntity
()
137
{
138
}
139
140
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
SCR_EArsenalItemMode
SCR_EArsenalItemMode
Definition
SCR_EArsenalItemMode.c:2
SCR_EArsenalItemType
SCR_EArsenalItemType
Definition
SCR_EArsenalItemType.c:3
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
GenericEntity
Definition
GenericEntity.c:16
IEntity::IEntity
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::SetAngles
proto external void SetAngles(vector angles)
Same as SetYawPitchRoll(), but sets rotation around X, Y and Z axis.
IEntity::SetLocalTransform
proto external bool SetLocalTransform(vector mat[4])
See IEntity::SetTransform. Returns false, if there is no change in transformation.
IEntity::GetChildren
proto external IEntity GetChildren()
IEntity::Update
proto external int Update()
IEntity::GetWorld
proto external BaseWorld GetWorld()
IEntity::SetFlags
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
IEntity::ClearFlags
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
IEntity::GetLocalTransform
proto external void GetLocalTransform(out vector mat[])
See IEntity::GetTransform.
IEntitySource
Definition
IEntitySource.c:13
InventoryItemComponent
Definition
InventoryItemComponent.c:13
MagazineComponent
Definition
MagazineComponent.c:13
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
SCR_ArsenalItemDisplayData
Definition
SCR_ArsenalItemDisplayData.c:3
SCR_ArsenalItem
Definition
SCR_ArsenalItem.c:3
SCR_ArsenalItem::GetItemType
SCR_EArsenalItemType GetItemType()
Definition
SCR_ArsenalItem.c:39
SCR_ArsenalItem::GetItemMode
SCR_EArsenalItemMode GetItemMode()
Definition
SCR_ArsenalItem.c:46
SCR_WeaponRackSlotEntityClass
Definition
SCR_WeaponRackSlotEntity.c:3
SCR_WeaponRackSlotEntity::m_eCurrentItemType
SCR_EArsenalItemType m_eCurrentItemType
Definition
SCR_WeaponRackSlotEntity.c:15
SCR_WeaponRackSlotEntity::m_eSupportedItemTypes
SCR_EArsenalItemType m_eSupportedItemTypes
Definition
SCR_WeaponRackSlotEntity.c:10
SCR_WeaponRackSlotEntity::RemoveItem
void RemoveItem()
Delete the slot's item (first found child).
Definition
SCR_WeaponRackSlotEntity.c:44
SCR_WeaponRackSlotEntity::SCR_WeaponRackSlotEntity
void SCR_WeaponRackSlotEntity(IEntitySource src, IEntity parent)
Definition
SCR_WeaponRackSlotEntity.c:131
SCR_WeaponRackSlotEntity::GetSlotSupportedItemTypes
SCR_EArsenalItemType GetSlotSupportedItemTypes()
Definition
SCR_WeaponRackSlotEntity.c:19
SCR_WeaponRackSlotEntity::GetCurrentOccupiedItemMode
SCR_EArsenalItemMode GetCurrentOccupiedItemMode()
Definition
SCR_WeaponRackSlotEntity.c:37
SCR_WeaponRackSlotEntity::~SCR_WeaponRackSlotEntity
void ~SCR_WeaponRackSlotEntity()
Definition
SCR_WeaponRackSlotEntity.c:136
SCR_WeaponRackSlotEntity::SpawnNewItem
void SpawnNewItem(Resource itemResource, SCR_ArsenalItem arsenalData, SCR_ArsenalItemDisplayData itemDisplayData=null, bool deleteExisting=false)
Definition
SCR_WeaponRackSlotEntity.c:74
SCR_WeaponRackSlotEntity::GetSlotSupportedItemModes
SCR_EArsenalItemMode GetSlotSupportedItemModes()
Definition
SCR_WeaponRackSlotEntity.c:25
SCR_WeaponRackSlotEntity::m_eCurrentItemMode
SCR_EArsenalItemMode m_eCurrentItemMode
Definition
SCR_WeaponRackSlotEntity.c:16
SCR_WeaponRackSlotEntity::CanSpawnItem
bool CanSpawnItem(bool deleteExisting=false)
Definition
SCR_WeaponRackSlotEntity.c:57
SCR_WeaponRackSlotEntity::m_eSupportedItemModes
SCR_EArsenalItemMode m_eSupportedItemModes
Definition
SCR_WeaponRackSlotEntity.c:13
SCR_WeaponRackSlotEntity::GetCurrentOccupiedItemType
SCR_EArsenalItemMode GetCurrentOccupiedItemType()
Definition
SCR_WeaponRackSlotEntity.c:31
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityFlags
EntityFlags
Various entity flags.
Definition
EntityFlags.c:14
scripts
Game
Campaign
SCR_WeaponRackSlotEntity.c
Generated by
1.17.0