mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 04:42:49 +02:00
Update portal to ensure that properties exist
This commit is contained in:
parent
7227e5770a
commit
47d7e89699
1 changed files with 24 additions and 17 deletions
|
@ -1,40 +1,47 @@
|
|||
(function(){
|
||||
var teleport;
|
||||
var portalDestination;
|
||||
var thisEntityID;
|
||||
|
||||
function playSound() {
|
||||
Audio.playSound(teleport, { volume: 0.40, localOnly: true });
|
||||
var properties = Entities.getEntityProperties(thisEntityID, 'position');
|
||||
if (properties) {
|
||||
Audio.playSound(teleport, { position: properties.position, volume: 0.40, localOnly: true });
|
||||
}
|
||||
};
|
||||
|
||||
this.preload = function(entityID) {
|
||||
thisEntityID = entityID;
|
||||
teleport = SoundCache.getSound("atp:/sounds/teleport.raw");
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
portalDestination = properties.userData;
|
||||
|
||||
print("portal.js | The portal destination is " + portalDestination);
|
||||
var properties = Entities.getEntityProperties(entityID, 'userData');
|
||||
if (properties) {
|
||||
portalDestination = properties.userData;
|
||||
print("portal.js | The portal destination is " + portalDestination);
|
||||
}
|
||||
}
|
||||
|
||||
this.enterEntity = function(entityID) {
|
||||
print("portal.js | enterEntity");
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID); // in case the userData/portalURL has changed
|
||||
portalDestination = properties.userData;
|
||||
var properties = Entities.getEntityProperties(entityID, 'userData'); // in case the userData/portalURL has changed
|
||||
if (properties) {
|
||||
portalDestination = properties.userData;
|
||||
|
||||
print("portal.js | enterEntity() .... The portal destination is " + portalDestination);
|
||||
print("portal.js | enterEntity() .... The portal destination is " + portalDestination);
|
||||
|
||||
if (portalDestination.length > 0) {
|
||||
if (portalDestination[0] == '/') {
|
||||
print("Teleporting to " + portalDestination);
|
||||
Window.location = portalDestination;
|
||||
if (portalDestination.length > 0) {
|
||||
if (portalDestination[0] == '/') {
|
||||
print("Teleporting to " + portalDestination);
|
||||
Window.location = portalDestination;
|
||||
} else {
|
||||
print("Teleporting to hifi://" + portalDestination);
|
||||
Window.location = "hifi://" + portalDestination;
|
||||
}
|
||||
} else {
|
||||
print("Teleporting to hifi://" + portalDestination);
|
||||
Window.location = "hifi://" + portalDestination;
|
||||
location.goToEntry(); // going forward: no data means go to appropriate entry point
|
||||
}
|
||||
} else {
|
||||
location.goToEntry(); // going forward: no data means go to appropriate entry point
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.leaveEntity = function(entityID) {
|
||||
|
|
Loading…
Reference in a new issue