-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: janusweb
action: commit
revision:
path_from:
revision_from: fd84966893898a63f91df3fe4f2126148a8f17cb:
path_to:
revision_to:

git.thebackupbox.net

janusweb

git://git.thebackupbox.net/janusweb

commit fd84966893898a63f91df3fe4f2126148a8f17cb
Author: James Baicoianu <james_github@baicoianu.com>
Date:   Sun Jan 28 20:23:19 2018 -0800

    Teleporter and raycaster fixesy

diff --git a/scripts/elements/raycaster.js b/scripts/elements/raycaster.js

index 3d09b557b727080c201952b448183762d5544aea..

index ..e06297245360a4df63c87be8f573167de79cac6d 100644

--- a/scripts/elements/raycaster.js
+++ b/scripts/elements/raycaster.js
@@ -1,24 +1,27 @@
-elation.component.add('janusweb.elements.raycaster', {
-  createChildren() {
-    this.lasthitobject = null;
-  },
-  update() {
-    var hits = this.raycast(null, null, this.class);
-    if (hits.length > 0) {
-      var hit = hits[0],
-          hitobject = hit.object;
-
-      if (hitobject != this.lasthitobject) {
-        if (this.lasthitobject) {
-          this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: hit}});
+elation.require(['janusweb.janusbase'], function() {
+  elation.component.add('janusweb.elements.raycaster', {
+    createChildren() {
+      this.lasthitobject = null;
+    },
+    update() {
+      var hits = this.raycast(null, null, this.class);
+      if (hits.length > 0) {
+        var hit = hits[0],
+            hitobject = hit.object;
+
+        if (hitobject != this.lasthitobject) {
+          if (this.lasthitobject) {
+            this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: hit}});
+          }
+          this.dispatchEvent({type: 'raycastenter', data: {object: hit.object, intersection: hit}});
+          this.lasthitobject = hitobject;
         }
-        this.dispatchEvent({type: 'raycastenter', data: {object: hit.object, intersection: hit}});
-        this.lasthitobject = hitobject;
+        this.dispatchEvent({type: 'raycastmove', data: {object: hit.object, intersection: hit}});
+      } else if (this.lasthitobject) {
+        this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: null}});
+        this.dispatchEvent({type: 'raycastenter', data: {object: this.lasthitobject.room, intersection: null}});
+        this.lasthitobject = this.lasthitobject.room;
       }
-    } else if (this.lasthitobject) {
-      this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: null}});
-      this.dispatchEvent({type: 'raycastenter', data: {object: this.lasthitobject.room, intersection: null}});
-      this.lasthitobject = this.lasthitobject.room;
     }
-  }
-}, elation.janusweb.janusbase);
+  }, elation.janusweb.janusbase);
+});
diff --git a/scripts/elements/teleporter.js b/scripts/elements/teleporter.js

index ac33bce7bd65921f84d4930d78c17623042cc3c1..

index ..47985e282922323ef950bddeedc65f358bcbeba5 100644

--- a/scripts/elements/teleporter.js
+++ b/scripts/elements/teleporter.js
@@ -1,13 +1,14 @@
-elation.component.add('janusweb.elements.teleporter', {
+elation.require(['janusweb.janusbase'], function() {
+  elation.component.add('janusweb.elements.teleporter', {
     active: false,
     longpresstime: 250,
     deadzone: 5,

     createChildren() {
       this.marker = this.createObject('Object', {
-        id: 'pipe',
-        col: '#009',
-        scale: V(.5,.05,.5)
+        id: 'cylinder',
+        col: V(0,0,155,.5),
+        scale: V(.5,1.6,.5)
       });
       this.light = this.createObject('Light', {
         col: '#009',
@@ -39,7 +40,7 @@ elation.component.add('janusweb.elements.teleporter', {
       this.setRoom(this.room);
       this.disableCursor();
       window.addEventListener('mousemove', this.handleMouseMove);
-      window.addEventListener('touchmove', this.handleTouchMove);
+      window.addEventListener('touchmove', this.handleTouchMove, true);
     },
     setRoom(room) {
       if (!room.addEventListener) room = room.getProxyObject();
@@ -81,9 +82,13 @@ elation.component.add('janusweb.elements.teleporter', {
         if (distance > this.deadzone) {
           clearTimeout(this.longpresstimer);
         }
+        if (this.active) {
+          ev.stopPropagation();
+          ev.preventDefault();
+        }
       }
     },
-    handleMouseUp() {
+    handleMouseUp(ev) {
       if (this.longpresstimer) {
         clearTimeout(this.longpresstimer);
       }
@@ -98,10 +103,12 @@ elation.component.add('janusweb.elements.teleporter', {
       this.pos = player.cursor_pos;
       this.visible = true;
       this.active = true;
+      this.particles.start();
     },
     disableCursor() {
       this.visible = false;
       this.active = false;
+      this.particles.stop();
     },
     update() {
       if (this.active) {
@@ -109,3 +116,4 @@ elation.component.add('janusweb.elements.teleporter', {
       }
     }
   });
+});

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 18:04:21 2024