@@ 48,6 48,7 @@ export default class BearActor extends A
async _preUpdate(changed, options, user) {
await super._preUpdate(changed, options, user);
+ // set token vision
if (changed.data && changed.data.darkvision === true){
this.data.token.update({
dimSight: 60,
@@ 57,24 58,30 @@ export default class BearActor extends A
dimSight: 0,
});
}
-
+ // set token light emission
if (changed.data && changed.data.torch === true){
this.data.token.update({
- dimLight: 40,
- brightLight: 20
+ light: {
+ dim: 40,
+ bright: 20
+ }
});
} else if (changed.data && changed.data.torch === false) {
this.data.token.update({
- dimLight: 0,
- brightLight: 0
+ light: {
+ dim: 0,
+ bright: 0
+ }
});
}
+ // save these settings to all active linked tokens
const docs_to_update = this.getActiveTokens(true).map(token => {
// console.log(token);
token.data.dimSight = this.data.token.dimSight;
token.data.dimLight = this.data.token.dimLight;
- token.data.brightLight = this.data.token.brightLight;
+ token.data.light.bright = this.data.token.light.bright;
+ token.data.light.dim = this.data.token.light.dim;
return token.data;
});
@@ 11,7 11,6 @@ export default class BearSheet extends A
getData() {
const data = super.getData();
data.isGM = game.user.isGM;
- // console.log(data);
return data;
}
}
No newline at end of file