Portal targets. The check is broken, I don't know why yet

This commit is contained in:
Tony Garnock-Jones 2023-01-06 17:00:34 +01:00
parent 8ca1c44af1
commit 4f4c793c42
3 changed files with 23 additions and 3 deletions

View File

@ -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",

View File

@ -1,4 +1,10 @@
version 1 .
Portal = <portal @name string @destination PortalDestination> .
PortalDestination =
/ @local #!any
/ @remote <remote <ws @url string> @sturdyref sturdy.SturdyRef>
.
; Message
Touch = <touch @subject string @object string> .

View File

@ -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({