- Messages
- 5,185
I love LinkedRefs, they are an incredibly powerful feature that lets you tie items together without causing them to be kept in memory perpetually (though they can still cause persistence - I will likely write up another exhaustive guide about LinkedRefs in the future, as well as one on persistence).
One thing I literally just learned tonight, is that when an item is scrapped in Workshop mode by the player, and those items are also linked via WorkshopStackedItemParentKeyword, ALL LinkedRefs to it are pseudo-severed. I say pseudo, because they only appear to be severed in one direction.
Let's say you link two items together:
And those items were also linked via WorkshopStackedItemParentKeyword (that keyword is a special one that allows those items to move together in workshop mode - think about when you pick up a rug and the things on top move with it) and then the player scraps kSomeOtherRef.
If you were to check kSomeOtherRef for GetLinkedRefChildren(MyKeyword), you'd expect it to return kSomeRef, instead it will return nothing. If you were to then check kSomeRef.GetLinkedRef(MyKeyword), you will correctly get back kSomeOtherRef. So it appears to only half break the links.
This is likely a bug in the way linked refs are cut by scrapping, but it's interesting to know - and even important to know if you are expecting to use linkrefs as a way to do some cleanup work after an object is scrapped.
In fact, this is likely the reason Sim Settlements can sometimes leave items behind, and a good reason for me to go do some more bug hunting!
One thing I literally just learned tonight, is that when an item is scrapped in Workshop mode by the player, and those items are also linked via WorkshopStackedItemParentKeyword, ALL LinkedRefs to it are pseudo-severed. I say pseudo, because they only appear to be severed in one direction.
Let's say you link two items together:
Code:
kSomeRef.SetLinkedRef(kSomeOtherRef, MyKeyword)
And those items were also linked via WorkshopStackedItemParentKeyword (that keyword is a special one that allows those items to move together in workshop mode - think about when you pick up a rug and the things on top move with it) and then the player scraps kSomeOtherRef.
If you were to check kSomeOtherRef for GetLinkedRefChildren(MyKeyword), you'd expect it to return kSomeRef, instead it will return nothing. If you were to then check kSomeRef.GetLinkedRef(MyKeyword), you will correctly get back kSomeOtherRef. So it appears to only half break the links.
This is likely a bug in the way linked refs are cut by scrapping, but it's interesting to know - and even important to know if you are expecting to use linkrefs as a way to do some cleanup work after an object is scrapped.
In fact, this is likely the reason Sim Settlements can sometimes leave items behind, and a good reason for me to go do some more bug hunting!
Last edited: