Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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")]
2class SCR_WeaponRackSlotEntityClass: GenericEntityClass
3{
4};
5
6//------------------------------------------------------------------------------------------------
8{
9 [Attribute("0", UIWidgets.Flags, "", enums: ParamEnumArray.FromEnum(SCR_EArsenalItemType))]
11
12 [Attribute("0", UIWidgets.Flags, "", enums: ParamEnumArray.FromEnum(SCR_EArsenalItemMode))]
14
17
18 //------------------------------------------------------------------------------------------------
23
24 //------------------------------------------------------------------------------------------------
29
30 //------------------------------------------------------------------------------------------------
35
36 //------------------------------------------------------------------------------------------------
41
42 //------------------------------------------------------------------------------------------------
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
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
114 item.SetFlags(EntityFlags.PROXY);
115
116 item.ClearFlags(EntityFlags.ACTIVE);
117
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 //------------------------------------------------------------------------------------------------
132 {
133 }
134
135 //------------------------------------------------------------------------------------------------
137 {
138 }
139
140};
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_EArsenalItemMode
SCR_EArsenalItemType
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external Managed FindComponent(typename typeName)
proto external void SetAngles(vector angles)
Same as SetYawPitchRoll(), but sets rotation around X, Y and Z axis.
proto external bool SetLocalTransform(vector mat[4])
See IEntity::SetTransform. Returns false, if there is no change in transformation.
proto external IEntity GetChildren()
proto external int Update()
proto external BaseWorld GetWorld()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
proto external void GetLocalTransform(out vector mat[])
See IEntity::GetTransform.
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
SCR_EArsenalItemType GetItemType()
SCR_EArsenalItemMode GetItemMode()
SCR_EArsenalItemType m_eCurrentItemType
SCR_EArsenalItemType m_eSupportedItemTypes
void RemoveItem()
Delete the slot's item (first found child).
void SCR_WeaponRackSlotEntity(IEntitySource src, IEntity parent)
SCR_EArsenalItemType GetSlotSupportedItemTypes()
SCR_EArsenalItemMode GetCurrentOccupiedItemMode()
void SpawnNewItem(Resource itemResource, SCR_ArsenalItem arsenalData, SCR_ArsenalItemDisplayData itemDisplayData=null, bool deleteExisting=false)
SCR_EArsenalItemMode GetSlotSupportedItemModes()
SCR_EArsenalItemMode m_eCurrentItemMode
bool CanSpawnItem(bool deleteExisting=false)
SCR_EArsenalItemMode m_eSupportedItemModes
SCR_EArsenalItemMode GetCurrentOccupiedItemType()
void EntitySpawnParams()
Definition gameLib.c:130
SCR_FieldOfViewSettings Attribute
EntityFlags
Various entity flags.
Definition EntityFlags.c:14