Can we tell whether a playerJoins via a spawntoken?

I’m working on that auto-respawn after an hour away feature, but got stuck on how to handle joining via a spawn token. Obviously a user clicking on a calendar event with a spawn token wants to go directly to the room/spawn they specified and not be teleported automatically to spawn because they’ve been idle for more than an hour.

Watching the events generated when a user joins the space normally vs via a spawntoken, I didn’t see any obvious differences.

Is there a way to tell whether a playerJoins event is using a spawn token or not?

Not sure if this is exactly an answer, but wouldn’t teleport be a bit more functional than respawn? You could log where users enter the space, then just teleport them there after being afk. That way you could even drop them off in a specific AFK zone, instead of responding in the default room.

Hey Bill, thanks for the respawnce :wink:

We’re implementing this feature primarily to prevent a guest from logging into an office space in the middle of a meeting in progress. Further, we’re hoping that it creates this feeling of having to “walk in the front door” so to speak and potentially enhancing interaction in that way.

@julian ah, gotcha. I do not currently see a way to do this, outside of something really hacky. The spawn token is being passed to the game server(?) as a prop in the URL, and I do not think we currently have a way to listen for props in the URL (though I will be adding a request for this asap, as there are a number of cool things you can do with it).

The hacky way to do it now is not through playerJoins (which seems like it should be the place) but something like playerSetsName, or more reasonably, playerSetsAffiliation. playerJoins always returns -Infinity for the x and y of the joining player, probably because it fires before they have actually fully loaded into the space. The other events happen on players joining, but after they have a position.

So, you could have a listener for playerSetsAffiliation (iirc there is no way to manually set this and accidentally trigger it), a list of inactive UUIDs, and a list of whitelisted tiles (mapId, x, y) which match your spawn tokens (or you could compare directly to spawn tiles). If the afk person joins and loads in on one of the whitelisted tiles (via spawn token, hopefully), they stick. If they load in on any other tiles, they get sent back to the entrance.

Unless your space requires logging in, you will run into a lot of ‘dead’ Gather IDs on your AFK list. Also, if someone AFKs on the whitelist tile, they might also get to stay there. There is also a rather clunky method of having a depot room with spawn tiles, then using this method to actively teleport users off the spawn tiles, and into the meeting rooms. But I think that is far more trouble than it is worth for the usecase.

1 Like

Here’s another one, thanks @opalrose ! (bump)