Jump to content
Sign in to follow this  

RadioMod - Problem with SlotManagerComponent

Recommended Posts

Hello, after few days of a constant fight with the workbench we re almost out of ideas by now so I came here on our behalf ( RadioMod Team) and probably someone from BI will only be able to answer this: currently, we're trying to add attachment slots to the radio in order to attach the battery and antenna but tried two ways (actually far more) and all failed...


  1.  I tried to use SlotManagerComponent to which I added two slots populated with prefabs and they show up properly and I'm able to get a lot of information like EntitySlotInfo which allows me to sift through multiple slots and find the one that I want, IEntity with GetAttachedEntity but the problem that I faced is that when I try to remove this item from this slot it persists in it for at least two reasons
    1. when I try to get storage of that slot with GetStorage() it returns null despite the fact that radio has BaseInventoryStorageComponent which in turn (i suspect) causes TryMoveItemToStorage and/or TryRemoveItemFromStorage to fail (returns false)
    2. because of the failure of the 'Try' functions I tried to force detachment by using m_attachmentSlot.DetachEntity(false) (cuz with true - default value - everything crashes) and that helped to a degree if i open the inventory ill see the battery on the left side 'in the vicinity but it's not on the ground as it will be always there even when ill move away from that spot and additionally its visibly still attached to the radio and only when I move that battery (which is in the  vicinity) to my inventory then it will detach from the radio
  2. Bacon suggestions tried using AttachmenSlotComponent but this presented a lot of different problems:
    1. there doesn't seem to be any way to detect which slots grabbed besides checking what attachment type it has (attachmentComponent.GetAttachmentSlotType().Type() == AttachmentPRC152Battery)
    2. additionally although prefabs are attached it will still return null when I try to use attachmentComponent.GetAttachedEntity() (edited)
  3. This might be the root cause of those issues as for unknown reason to me BaseInventoryStorageComponent will return 0 when I ask it for the number of slots with GetSlotsCount() and I seem to be unable to 'connect' those slots to it as I can't use SetupSlotHooks(InventoryStorageSlot owned lot, int slotID)

Share this post

Link to post
Share on other sites

Found a way.
Thanks to narcoleptic marshmallow


vector mat[4];
IEntity ent = slot.GetAttachedEntity();


  • Like 1

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this