Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

client_follow

Carries a world or branch switch, or a root scene opened, in an agent's own client over to the user's client. zeromind.swap, world.checkout and zm checkout call ClientFollow.after(request, opts.follow) once their switch has landed, and layers.load of a root scene calls ClientFollow.afterScene(request, opts.follow) once the scene has loaded.

local ClientFollow = require("modules.client_follow")
ClientFollow.after({ world = guid, branch = "feature" }, nil)
ClientFollow.afterScene({ scene = sceneGuid, name = "scenes/level2.scene", world = guid, branch = "main" }, nil)
  • follow = false asks nothing; nil asks, and the host follows from an agent's own default sub-client; true asks, and the host also follows from a sub-client the agent made with client create.
  • Only the world, the branch and the version are carried; the user's client keeps its own play/edit mode.
  • The host answers at once: { followed = true } when it took the switch on and { followed = false, reason } when the call is not one the user's client follows (the user's own client, another agent's sub-client, a call of no agent, a switch to where the user's client already is). It makes the switch on its own time; a switch it could not make is told to the calling agent as a notice, and the engine state's split lists the sub-client until the user's client has caught up.
  • A host that cannot be reached raises, and the error says the switch was made in this client.
  • An engine with no client control, and code with no caller, follow nothing and answer nil.
  • A scene follow carries the scene's guid and name and the world and branch it was opened on; the user's client opens it once it is on that world and branch, in its own play/edit mode. follow = false is told to the host, and a scene open the user's client does not follow (said not to, refused, or failing there) reaches the owning agent as a notice naming the scene the user's client stayed on. state.split lists a sub-client on another scene than the user's client.