So, when placing a prefab (dropbox) at Outpost, everything is fine. But how can I persistently identify that dropbox via OnItemSubmit()?
The ownerID is 0 and I'm unsure if the net.ID matters because it's going to be redrawn between wipes. Is there a uniquie identifier associated with spawned items that I can use?
Entity ID?Solved
I guess the better question should be does the net.ID persist across wipes for spawned entities?
* It doesn't persist across restarts, so wipes is an obvious no. There's got to be some way to identify an entity that I placed via a hook.
Entity net ids normally persist across restarts, throughout a wipe, but using the default config of the plugin, reloading the plugin (including restarting the server) will respawn the entities, leading to new net ids every reload/restart.
Internally, the plugin has a concept of a unique id that is generated for every addon, but that id will be the same for every copy of the addon if there are multiple matching monuments. There is currently no way for you to retrieve this id, but I could add an API and hooks that help facilitate your use case.
That would be useful! I certainly don't want you to go out of your way for it. I've found I'm able to sweep the TerrainMeta.Path.Monuments for where I'm placing it and find the entity from there. (I'm confirming it's within Compound) So I'm not really able to nail down that it's specifically that one, but since there is only one, it has to be that.
But in the future if you're adding anything, some way to reliably reference the entity would be super cool. I haven't look enough into the GameObject, but maybe there's a meta possibility in there.
Thanks so much for the plugin and the quick response!
Merged post
So, quick follow up. I've placed a dropbox within Compound, and when I open it in-game, I get this kind of warning:
(21:24:27) | <color=white>Network </color>[<color=cyan>dropbox.deployed[5766783]</color>] SendNetworkUpdate
(21:24:27) | <color=white>Network </color>[<color=cyan>dropbox.deployed[5766783]</color>] InvalidateNetworkCacheEvery time it's open and closed, I'll get that warning. Oddly, (I'm working with the idtags entities) I can't right click to move those over into the dropbox, but I can drag them. Right clicking other standard items works fine. I can also right click the idtags to transfer to a dropbox that is not part of MA, so I'm assuming that warning has something to do with it. Any thought?
I pushed a change to the master branch on the GitHub repo which adds two API methods.
bool API_IsMonumentEntity(BaseEntity entity)Guid? API_GetMonumentEntityGuid(BaseEntity entity)
You can use the Guid provided by the second method to compare to a Guid constructed with the string you see in the data file.
Regarding the id tags, does it work with a dropbox that you spawn via the native spawn command (in the same location)?
You're awesome!
I didn't try, but moving the dropbox worked. Oddly, it must have had something to do with the placement (it was against the ladder wall, inside the fence). I moved it to the end of the drone shop and it's fine now.
Thank you so much!