diff --git a/src/3rd/js/plugin/frontend/$chat.js b/src/3rd/js/plugin/frontend/$chat.js
index 535f31c..5d6e2e6 100644
--- a/src/3rd/js/plugin/frontend/$chat.js
+++ b/src/3rd/js/plugin/frontend/$chat.js
@@ -262,6 +262,7 @@ chatComponent.css = `
max-width: 20px;
border-radius: 20px 0px 0px 20px;
overflow: hidden;
+ margin:0;
}
#chatbar input{
border:none;
diff --git a/src/3rd/js/plugin/frontend/accessibility.js b/src/3rd/js/plugin/frontend/accessibility.js
index 1760f6d..7b90cf3 100644
--- a/src/3rd/js/plugin/frontend/accessibility.js
+++ b/src/3rd/js/plugin/frontend/accessibility.js
@@ -116,9 +116,9 @@ window.accessibility = (opts) => new Proxy({
notify(`${n.userData['aria-description']||''}` + (n.userData.href ? `
name: ${n.name}
href: ${n.userData['href']}` :'') )
}
- if( e.key == 'Enter' && objects[cache.current].userData.href ){
- xrf.navigator.to( objects[cache.current].userData.href )
- }
+ //if( e.key == 'Enter' && objects[cache.current]?.userData.href ){
+ // xrf.navigator.to( objects[cache.current].userData.href )
+ //}
// increment to next
cache.current = (cache.current + 1) % objects.length
diff --git a/src/3rd/js/plugin/frontend/chatcommand/mud.js b/src/3rd/js/plugin/frontend/chatcommand/mud.js
index f4e066a..6fd7886 100644
--- a/src/3rd/js/plugin/frontend/chatcommand/mud.js
+++ b/src/3rd/js/plugin/frontend/chatcommand/mud.js
@@ -20,12 +20,7 @@ document.addEventListener('chat.command.help', (e) => {
const listExits = (scene) => {
let message = ''
- let destinations = {}
- scene.traverse( (n) => {
- if( n.userData && n.userData.href && n.userData.href.match(/pos=/) ){
- destinations[n.name] = n.userData['aria-label'] || n.userData.href
- }
- })
+ let destinations = xrf.sceneListExits(scene, true)
for( let destination in destinations ){
message += `
${destination} ${destinations[destination]}`
}
@@ -56,8 +51,13 @@ document.addEventListener('chat.input', (e) => {
}
if( e.detail.message.trim() == 'look' ){
- let scene = xrf.frag.pos.last ? xrf.scene.getObjectByName(xrf.frag.pos.last) : xrf.scene
- let message = `
${xrf.sceneToTranscript(scene)}
possible destinations in this area:${listExits(scene)}`
+ let transcript = xrf.sceneToTranscript(false,false,true)
+ .map( (n) => `${n.name} ${n.description}` )
+ .join(". ")
+ let exits = xrf.listExits(false,true)
+ .map( (n) => `${n.name}` )
+ .join("
")
+ let message = `${transcript}
possible destinations in this area:
${exits}`
e.detail.halt = true // dont print command to screen
$chat.send({message})
}
diff --git a/src/3rd/js/plugin/frontend/frontend.js b/src/3rd/js/plugin/frontend/frontend.js
index 033c94e..038b97d 100644
--- a/src/3rd/js/plugin/frontend/frontend.js
+++ b/src/3rd/js/plugin/frontend/frontend.js
@@ -128,7 +128,13 @@ window.frontend = (opts) => new Proxy({
}
let root = data.mesh.portal ? data.mesh.portal.stencilObject : data.mesh
let transcript = xrf.sceneToTranscript(root,data.mesh)
- if( transcript.length ) html += `
transcript:
${transcript}
`
+ console.dir(transcript)
+ if( transcript.length ){
+ transcript = xrf.sceneToTranscript(false,false,true)
+ .map( (n) => `${n.name} ${n.description}` )
+ .join(". ")
+ html += `
transcript:
${transcript}
`
+ }
if (hasMeta && !data.mesh.portal && metadata.XRF.src ) html += `
Visit embedded scene`
if( !html ) return
diff --git a/src/3rd/js/three/util/transcript.js b/src/3rd/js/three/util/transcript.js
index 194d52e..536a78f 100644
--- a/src/3rd/js/three/util/transcript.js
+++ b/src/3rd/js/three/util/transcript.js
@@ -1,11 +1,23 @@
-xrf.sceneToTranscript = (scene, ignoreMesh ) => {
- let transcript = ''
+xrf.sceneToTranscript = (scene, node, currentPosition ) => {
+ let items = []
+ scene = currentPosition && xrf.frag.pos.last ? xrf.scene.getObjectByName(xrf.frag.pos.last) : scene || xrf.scene
scene.traverse( (n) => {
let isSRC = false
n.traverseAncestors( (m) => m.userData.src ? isSRC = true : false )
- if( !isSRC && n.userData['aria-description'] && (!ignoreMesh || n.uuid != ignoreMesh.uuid) ){
- transcript += `#${n.name} ${n.userData['aria-description']}. `
+ if( !isSRC && n.userData['aria-description'] && (!node || n.uuid != node.uuid) ){
+ items.push({name: n.name, description: n.userData['aria-description']})
}
})
- return transcript
+ return items
+}
+
+xrf.listExits = (scene, currentPosition ) => {
+ let destinations = []
+ scene = currentPosition && xrf.frag.pos.last ? xrf.scene.getObjectByName(xrf.frag.pos.last) : scene || xrf.scene
+ scene.traverse( (n) => {
+ if( n.userData && n.userData.href && n.userData.href.match(/pos=/) ){
+ destinations.push({name: n.name, destination: n.userData['aria-label'] || n.userData.href})
+ }
+ })
+ return destinations
}