mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Clean up fire.js
This commit is contained in:
parent
fec8049226
commit
fd929a46b3
1 changed files with 2 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
// this script turns an entity into an exploder -- anything that collides with it will be vaporized!
|
// Originally written by James Pollack, modified by Ryan Huffman for the tutorial
|
||||||
//
|
|
||||||
//
|
//
|
||||||
|
// this script turns an entity into an exploder -- anything that collides with it will be vaporized!
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
@ -58,27 +58,20 @@
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
this.EXPLOSION_SOUND = SoundCache.getSound("atp:/firepit/fire_burst.wav");
|
this.EXPLOSION_SOUND = SoundCache.getSound("atp:/firepit/fire_burst.wav");
|
||||||
print("IN FIRE SCRIPT");
|
|
||||||
},
|
},
|
||||||
collisionWithEntity: function(myID, otherID, collisionInfo) {
|
collisionWithEntity: function(myID, otherID, collisionInfo) {
|
||||||
print("FIRE SCRIPT: COLLIDED");
|
|
||||||
var otherProps = Entities.getEntityProperties(otherID);
|
var otherProps = Entities.getEntityProperties(otherID);
|
||||||
var data = null;
|
var data = null;
|
||||||
print("FIRE SCRIPT: 2 COLLIDED");
|
|
||||||
try {
|
try {
|
||||||
print("parsing..");
|
|
||||||
data = JSON.parse(otherProps.userData)
|
data = JSON.parse(otherProps.userData)
|
||||||
print("done parsing..");
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print('ERROR GETTING USERDATA!');
|
print('ERROR GETTING USERDATA!');
|
||||||
}
|
}
|
||||||
print("HERE");
|
|
||||||
if (data === null || "") {
|
if (data === null || "") {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (data.hasOwnProperty('hifiHomeKey')) {
|
if (data.hasOwnProperty('hifiHomeKey')) {
|
||||||
if (data.hifiHomeKey.reset === true) {
|
if (data.hifiHomeKey.reset === true) {
|
||||||
print('FLAMMABLE THING, EXPLODE IT!');
|
|
||||||
_this.playSoundAtCurrentPosition();
|
_this.playSoundAtCurrentPosition();
|
||||||
_this.explodeWithColor();
|
_this.explodeWithColor();
|
||||||
Entities.deleteEntity(otherID)
|
Entities.deleteEntity(otherID)
|
||||||
|
@ -90,7 +83,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
explodeWithColor: function() {
|
explodeWithColor: function() {
|
||||||
print('EXPLODE!')
|
|
||||||
var myProps = Entities.getEntityProperties(this.entityID);
|
var myProps = Entities.getEntityProperties(this.entityID);
|
||||||
var color = colors[Math.floor(Math.random() * colors.length)];
|
var color = colors[Math.floor(Math.random() * colors.length)];
|
||||||
var explosionParticleProperties = {
|
var explosionParticleProperties = {
|
||||||
|
@ -152,7 +144,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var explosion = Entities.addEntity(explosionParticleProperties);
|
var explosion = Entities.addEntity(explosionParticleProperties);
|
||||||
print('explosion is: ' + explosion)
|
|
||||||
},
|
},
|
||||||
playSoundAtCurrentPosition: function() {
|
playSoundAtCurrentPosition: function() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue