When you fire an item event with objFireItemEvent does gItem and gSource get set and reset when it gets returned or is it up to the caller to do those things?
Given two devices of the same type and data installed on a single ship would they evaluate eq to True?
Given two armors of the same type and data installed on a single ship would they evaluate eq to True?
bonus question: In onUninstall is gItem installed. (assuming gItem is the item being uninstalled)
When you fire an item event with objFireItemEvent does gItem and gSource get set and reset when it gets returned or is it up to the caller to do those things?
gItem and gSource are set and reset.
Betelgeuse wrote:Given two devices of the same type and data installed on a single ship would they evaluate eq to True?
Given two armors of the same type and data installed on a single ship would they evaluate eq to True?
No, in both cases. The installation location will be different for each item (a different device slot or a different armor segment location).
Betelgeuse wrote:bonus question: In onUninstall is gItem installed. (assuming gItem is the item being uninstalled)
There may be a bug here.
For devices, it is called BEFORE the item is uninstalled. But for armor, it is called just AFTER.
I think for armor I will move the call to before the item is uninstalled.
Note that in either case, the item is in a transition state. The original goal of the OnUninstall event is to give you a hook to undo things that the item did on install (such as add an overlay to the ship). If you try to manipulate the item itself, there probably are bugs and unintended consequences.
Also, in the future I will provide a way to prevent an item from being uninstalled.
george moromisato wrote:Also, in the future I will provide a way to prevent an item from being uninstalled.
Sweet. I've always wanted some evil Advanced Sentient Patch Spiders that cling to your ship and eat your hull until you manage to get them blasted off.
Last Cause Of Death: Destroyed by Karl Svalbard's last Lucifer missile, right after I blew him up. And the crowd cheers.
thanks, in onUnInstall I want to do stuff based on installed items, but now that I know that eq evaluates to nil even in cases where everything other than location is the same makes it possible to filter out the current item (because it isn't going to be installed after the event occurs)
Betelgeuse wrote:thanks, in onUnInstall I want to do stuff based on installed items, but now that I know that eq evaluates to nil even in cases where everything other than location is the same makes it possible to filter out the current item (because it isn't going to be installed after the event occurs)
Cool, you can rely on that.
One bug that I found: Currently, you shouldn't manipulate any items in the OnUninstall call--for example, adding items to the ship in the middle of OnUninstall will either crash or corrupt memory. I'll fix that in RC3 [But even then, you probably shouldn't manipulate the item being uninstalled.]
is gItem installed or not consistently with armors and devices? Also does the onUnInstall bug effect uninstalling in onUnInstall and installing devices in onInstall? (I was going to use virtual 0 slot devices)
Betelgeuse wrote:is gItem installed or not consistently with armors and devices? Also does the onUnInstall bug effect uninstalling in onUnInstall and installing devices in onInstall? (I was going to use virtual 0 slot devices)
In RC3, it is consistent between armors and devices. In RC2 it is not.
I think, as long as the item existed on the ship prior to OnUninstall/OnInstall, then I think you're OK--but I'm not sure. Either way, it is fixed in RC3.
(And you'll be able to add virtual items and install/uninstall in OnInstall/OnUninstall--at least I hope so: it's a bug if not.)
BTW, also in RC3 is a way to enumerate virtual items.
Betelgeuse wrote:is gItem installed or not consistently with armors and devices? Also does the onUnInstall bug effect uninstalling in onUnInstall and installing devices in onInstall? (I was going to use virtual 0 slot devices)
In RC3, it is consistent between armors and devices. In RC2 it is not.
oh sorry I meant to say in onInstall is gItem installed or not ...
enumerating virtual items is going to be helpful 8)
edit: is there a way of using a UNID in objGetItems?