more light toggling additions

This commit is contained in:
ericrius1 2015-09-21 15:57:03 -07:00
parent 8678e07c21
commit e4d630b1fc
2 changed files with 13 additions and 4 deletions

View file

@ -31,7 +31,14 @@
startNearGrab: function() {
print("TOGGLE LIGHT")
this.lightState = getEntityCustomData(this.lightStateKey, this.entityID, defaultLightData);
if (this.lightState.on === true) {
//Delete the all the sconce lights
var entities = Entities.findEntities(MyAvatar.position, 100);
entities.forEach(function(entity){
var resetData = getEntityCustomData(this.resetKey, entity, {})
});
}
// var position = Entities.getEntityProperties(this.entityID, "position").position;
// Audio.playSound(clickSound, {
// position: position,
@ -64,7 +71,8 @@
});
setEntityCustomData(this.resetKey, this.sconceLight1, {
resetMe: true
resetMe: true,
lightType: "sconceLight"
});
},

View file

@ -56,8 +56,9 @@ function deleteAllToys() {
entities.forEach(function(entity) {
//params: customKey, id, defaultValue
var shouldReset = getEntityCustomData(resetKey, entity, false);
if (shouldReset) {
var shouldReset = getEntityCustomData(resetKey, entity, {}).resetMe;
print("should reset " + JSON.stringify(shouldReset));
if (shouldReset === true) {
Entities.deleteEntity(entity);
}
})