From 4f4c793c42ab19d203e0d4846806f2467d57407d Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 6 Jan 2023 17:00:34 +0100 Subject: [PATCH] Portal targets. The check is broken, I don't know why yet --- package.json | 2 +- protocols/schemas/scene.prs | 6 ++++++ src/index.ts | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f27fea8..c6f3546 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "vr experiments 3", "scripts": { "prepare": "yarn regenerate && yarn compile && yarn rollup", - "regenerate": "rm -rf ./src/gen && preserves-schema-ts --output ./src/gen ./protocols/schemas", + "regenerate": "rm -rf ./src/gen && preserves-schema-ts --module sturdy=@syndicate-lang/core:Schemas.sturdy --xref node_modules/@syndicate-lang/core/protocols/schemas --output ./src/gen ./protocols/schemas", "regenerate:watch": "yarn regenerate --watch", "compile": "syndicate-tsc", "compile:watch": "syndicate-tsc -w --verbose --intermediate-directory src.ts", diff --git a/protocols/schemas/scene.prs b/protocols/schemas/scene.prs index 61993e4..26aa4e1 100644 --- a/protocols/schemas/scene.prs +++ b/protocols/schemas/scene.prs @@ -1,4 +1,10 @@ version 1 . +Portal = . +PortalDestination = +/ @local #!any +/ @remote @sturdyref sturdy.SturdyRef> +. + ; Message Touch = . diff --git a/src/index.ts b/src/index.ts index c7fbd22..e8cd9fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -127,8 +127,22 @@ function bootApp(ds: Ref, scene: Scene) { } at sceneDs { - on message SceneProtocol.Touch({ "subject": $subject, "object": $object }) => { - console.log('touch!', subject, object); + on message SceneProtocol.Touch({ "subject": id, "object": $o }) => { + console.log('touch!', o); + react { + on stop console.log('portal check ending', o); + during SceneProtocol.Portal({ + "name": o, + "destination": $dest: SceneProtocol.PortalDestination + }) => { + console.log('portal!', dest); + } + const checkFacet = Turn.activeFacet; + Turn.active.sync(sceneDs).then(() => checkFacet.turn(() => { + console.log('synced'); + stop; + })); + } } assert Shapes.Sprite({