mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 14:43:12 +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() {
|
||||
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"
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue