where appropriate, returns valid attachment slot ID even without proper selection
116 {
117 int slotId = InventorySlots.INVALID;
118 int count;
119 Building building;
121 ConstructionActionData constructionActionData = player.GetConstructionActionData();
122 InventoryLocation loc;
123 bool found;
125 if (Class.CastTo(baseBuilding, targetEntity))
126 {
127 if (item.IsExternalLockType())
128 {
129 loc = new InventoryLocation();
132 if (found && slotId != InventorySlots.INVALID)
133 {
134 return slotId;
135 }
136 }
137 else
138 {
139 string selection = baseBuilding.GetActionComponentName(target.GetComponentIndex());
141
142 if (slotId != InventorySlots.INVALID)
143 {
145 {
146 return slotId;
147 }
148 }
149 }
150 }
151 else if (Class.CastTo(building, targetEntity) && building.CanUseConstruction())
152 {
153 if (item.IsExternalLockType())
154 {
155 int doorIndex = building.
GetDoorIndex(target.GetComponentIndex());
157 {
158 AdditionalDoorInfo doorInfo = building.
GetDoorInfo(doorIndex);
160 return InventorySlots.INVALID;
161
163 {
165 if (slotEntity)
166 continue;
167
168 slotId = InventorySlots.GetSlotIdFromString(
slotName);
169 GameInventory inventory = building.GetInventory();
171 break;
172
173 slotId = InventorySlots.INVALID;
174 }
175
176 if (slotId != InventorySlots.INVALID)
177 {
178 return slotId;
179 }
180 }
181 }
182 else
183 {
185 building.GetActionComponentNameList(target.GetComponentIndex(),
m_ComponentNames, LOD.NAME_VIEW);
187 if (count > 0)
188 {
190 {
192 if (slotId != InventorySlots.INVALID)
193 return slotId;
194 }
195 }
196 }
197 }
198 else
199 {
201 targetEntity.GetActionComponentNameList(target.GetComponentIndex(),
m_ComponentNames, LOD.NAME_VIEW);
203 if (count > 0)
204 {
206 {
208 if (slotId != InventorySlots.INVALID)
209 {
210 return slotId;
211 }
212 }
213 }
214 }
215
216 return InventorySlots.INVALID;
217 }
PlayerSpawnPreset slotName
FindInventoryLocationType
flags for searching locations in inventory
ref array< string > m_ComponentNames
ref TStringArray m_RelatedInventorySlotNames
Lock compatibility type, now in door config. Lockpick enabled by default if undefined.
override bool IsPlayerInside(PlayerBase player, string selection)
override bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
AdditionalDoorInfo GetDoorInfo(int doorIdx)
proto native bool IsDoorLocked(int index)
When the door is locked.
proto native bool IsDoorOpen(int index)
When the door is requested to be fully open (animation wanted phase is greater than 0....
proto native int GetDoorIndex(int componentIndex)
Gets the index of the door based on the view geometry component index.
int GetAttachmentSlotFromSelection(PlayerBase player, EntityAI target, ItemBase item_to_attach, string selection)
proto native bool CanAddAttachmentEx(notnull EntityAI e, int slot)
Check if attachment can be added to slot @NOTE: Note that slot index IS NOT slot ID!...
proto native int GetSlot()
returns slot id if current type is Attachment