mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 16:41:57 +02:00
more light toggling additions
This commit is contained in:
parent
8678e07c21
commit
e4d630b1fc
2 changed files with 13 additions and 4 deletions
|
@ -31,7 +31,14 @@
|
||||||
|
|
||||||
startNearGrab: function() {
|
startNearGrab: function() {
|
||||||
print("TOGGLE LIGHT")
|
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;
|
// var position = Entities.getEntityProperties(this.entityID, "position").position;
|
||||||
// Audio.playSound(clickSound, {
|
// Audio.playSound(clickSound, {
|
||||||
// position: position,
|
// position: position,
|
||||||
|
@ -64,7 +71,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
setEntityCustomData(this.resetKey, this.sconceLight1, {
|
setEntityCustomData(this.resetKey, this.sconceLight1, {
|
||||||
resetMe: true
|
resetMe: true,
|
||||||
|
lightType: "sconceLight"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,9 @@ function deleteAllToys() {
|
||||||
|
|
||||||
entities.forEach(function(entity) {
|
entities.forEach(function(entity) {
|
||||||
//params: customKey, id, defaultValue
|
//params: customKey, id, defaultValue
|
||||||
var shouldReset = getEntityCustomData(resetKey, entity, false);
|
var shouldReset = getEntityCustomData(resetKey, entity, {}).resetMe;
|
||||||
if (shouldReset) {
|
print("should reset " + JSON.stringify(shouldReset));
|
||||||
|
if (shouldReset === true) {
|
||||||
Entities.deleteEntity(entity);
|
Entities.deleteEntity(entity);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue