Quick followup to the big one, v41.0.0. This transitions interactions and triggerItem (experimental and hopefully unused) over to the new key based paradigm.
breaking changes
game.interact() now takes arguments mapId: string, key: string, in that order (previously was objId, mapId). This is the object key, no longer the object id.
event playerInteracts has been replaced with playerInteractsWithObject, which uses key instead of objId, and mapId is required, but is otherwise the same.
other changes
new helper game.getObjectByKey(mapId: string, key: string) (to be the key equivalent of game.getObject (by id))
I feel I speak for the other TS coders when I say thank you for removing the optional nature of mapId in the PlayerInteractsWithObject (previously PlayerInteracts). My guard clauses and undefined fallbacks can finally be deleted (after some testing, of course).
I look forward to using the more streamlined key->object accessor pattern. I’ll be updating GT-Helper this weekend with all the changes, for those devs worried these changes will impact their pre-v41 code.
I noticed that the old event playerInteracts still works on older clients.
Do you have any predictions as to when such event might cease to be sent in favor of playerInteractsWithObject ?
I’m tracking a metric which shows how many people still depend on it, and once that gets down to a low level I’ll merge the PR to remove it entirely
The way we do upgrades is we support both the new and old actions/events on the server-side, then publish new clients which only use the new stuff, wait a week or so for people to update gradually (api users and browser clients alike), and then remove support server-side.