diff --git a/Torch/Torch.js b/Torch/Torch.js
index badf0d7bc5..150f455e5d 100644
--- a/Torch/Torch.js
+++ b/Torch/Torch.js
@@ -5,13 +5,14 @@
var Torch = Torch || (function() {
'use strict';
- var version = '0.8.0',
- lastUpdate = 1430061737,
- schemaVersion = 0.1,
+ var version = '0.8.2',
+ lastUpdate = 1430666803,
+ schemaVersion = 0.1,
flickerURL = 'https://s3.amazonaws.com/files.d20.io/images/4277467/iQYjFOsYC5JsuOPUCI9RGA/thumb.png?1401938659',
flickerPeriod = 400,
flickerDeltaLocation = 2,
flickerDeltaRadius = 0.1,
+ flickerDeltaAngle = 5,
flickerInterval = false,
ch = function (c) {
@@ -49,7 +50,7 @@ var Torch = Torch || (function() {
+''
+'Commands'
+'
'
- +'
!torch ['+ch('<')+'Radius'+ch('>')+' ['+ch('<')+'Dim Start'+ch('>')+' ['+ch('<')+'All Players'+ch('>')+' ['+ch('<')+'Token ID'+ch('>')+' ... ]]]]'
+ +'
!torch ['+ch('<')+'Radius'+ch('>')+' ['+ch('<')+'Dim Start'+ch('>')+' ['+ch('<')+'All Players'+ch('>')+' ['+ch('<')+'Token ID'+ch('>')+ch('|')+ch('<')+'--Angle'+ch('>')+' ... ]]]]'
+'
'
+'
Sets the light for the selected/supplied tokens. Only GMs can supply token ids to adjust.
'
+'
Note: If you are using multiple '+ch('@')+ch('{')+'target'+ch('|')+'token_id'+ch('}')+' calls in a macro, and need to adjust light on fewer than the supplied number of arguments, simply select the same token several times. The duplicates will be removed.
'
@@ -66,6 +67,9 @@ var Torch = Torch || (function() {
+'
'
+''+ch('<')+'Token ID'+ch('>')+' '+ch('-')+' A Token ID, usually supplied with something like '+ch('@')+ch('{')+'target'+ch('|')+'Target 1'+ch('|')+'token_id'+ch('}')+'.'
+' '
+ +'
'
+ +''+ch('<')+'--Angle'+ch('>')+' '+ch('-')+' The angle of the light arc of the light. (Default: 360)'
+ +' '
+''
+'
'
+'
!snuff ['+ch('<')+'Token ID'+ch('>')+' ... ]'
@@ -78,7 +82,7 @@ var Torch = Torch || (function() {
+' '
+''
+'
'
- +'!flicker-on ['+ch('<')+'Radius'+ch('>')+' ['+ch('<')+'Dim Start'+ch('>')+' ['+ch('<')+'All Players'+ch('>')+' ['+ch('<')+'Token ID'+ch('>')+' ... ]]]]'
+ +'!flicker-on ['+ch('<')+'Radius'+ch('>')+' ['+ch('<')+'Dim Start'+ch('>')+' ['+ch('<')+'All Players'+ch('>')+' ['+ch('<')+'Token ID'+ch('>')+ch('|')+ch('<')+'--Angle'+ch('>')+' ... ]]]]'
+''
+'
Behaves identically to !torch, save that it creates a flickering light.
'
+'
'
@@ -108,7 +112,7 @@ var Torch = Torch || (function() {
+''
);
},
- setFlicker = function(o,r,d,p) {
+ setFlicker = function(o,r,d,p,a) {
var found = _.findWhere(state.Torch.flickers, {parent: o.id}),
fobj;
@@ -122,7 +126,8 @@ var Torch = Torch || (function() {
showplayers_aura1: false,
light_radius: r,
light_dimradius: d,
- light_otherplayers: p
+ light_otherplayers: p,
+ light_angle: a
});
} else {
delete state.Torch.flickers[found.id];
@@ -141,7 +146,9 @@ var Torch = Torch || (function() {
showplayers_aura1: false,
light_radius: r,
light_dimradius: d,
- light_otherplayers: p
+ light_otherplayers: p,
+ light_angle: a
+
});
} else {
delete state.Torch.flickers[found.id];
@@ -164,7 +171,9 @@ var Torch = Torch || (function() {
layer: 'objects',
light_radius: r,
light_dimradius: d,
- light_otherplayers: p
+ light_otherplayers: p,
+ light_angle: a
+
});
}
toBack(fobj);
@@ -174,7 +183,9 @@ var Torch = Torch || (function() {
active: true,
page: o.get('pageid'),
light_radius: r,
- light_dimradius: d
+ light_dimradius: d,
+ light_angle: a
+
};
},
@@ -189,6 +200,7 @@ var Torch = Torch || (function() {
light_radius: '',
ligh_dimradius: '',
light_otherplayers: false,
+ light_angle: 360,
showname: true,
top: 70,
left: 70,
@@ -199,12 +211,12 @@ var Torch = Torch || (function() {
},
handleInput = function(msg) {
- var args, radius, dim_radius, other_players, page, obj, objs=[],who;
+ var args, radius, dim_radius, arc_angle=360, other_players, page, obj, objs=[],who;
if (msg.type !== "api") {
return;
}
- var who=getObj('player',msg.playerid).get('_displayname').split(' ')[0];
+ who=getObj('player',msg.playerid).get('_displayname').split(' ')[0];
args = msg.content.split(" ");
switch(args[0]) {
@@ -221,6 +233,14 @@ var Torch = Torch || (function() {
_.chain(args)
.rest(4)
.uniq()
+ .filter(function(a){
+ var angle=a.match(/^--(\d+)$/);
+ if(angle){
+ arc_angle=(Math.min(360,Math.max(0,angle[1])));
+ return false;
+ }
+ return true;
+ })
.map(function(t){
return getObj('graphic',t);
})
@@ -229,7 +249,8 @@ var Torch = Torch || (function() {
t.set({
light_radius: radius,
light_dimradius: dim_radius,
- light_otherplayers: other_players
+ light_otherplayers: other_players,
+ light_angle: arc_angle
});
});
}
@@ -238,7 +259,8 @@ var Torch = Torch || (function() {
getObj(o._type,o._id).set({
light_radius: radius,
light_dimradius: dim_radius,
- light_otherplayers: other_players
+ light_otherplayers: other_players,
+ light_angle: arc_angle
});
});
break;
@@ -261,7 +283,8 @@ var Torch = Torch || (function() {
t.set({
light_radius: '',
light_dimradius: '',
- light_otherplayers: false
+ light_otherplayers: false,
+ light_angle: 360
});
});
}
@@ -269,7 +292,8 @@ var Torch = Torch || (function() {
getObj(o._type,o._id).set({
light_radius: '',
light_dimradius: '',
- light_otherplayers: false
+ light_otherplayers: false,
+ light_angle: 360
});
});
break;
@@ -331,6 +355,14 @@ var Torch = Torch || (function() {
objs=_.chain(args)
.rest(4)
.uniq()
+ .filter(function(a){
+ var angle=a.match(/^--(\d+)$/);
+ if(angle){
+ arc_angle=(Math.min(360,Math.max(0,angle[1])));
+ return false;
+ }
+ return true;
+ })
.map(function(t){
return getObj('graphic',t);
})
@@ -341,7 +373,7 @@ var Torch = Torch || (function() {
_.each(_.union(objs,_.map(msg.selected,function (o) {
return getObj(o._type,o._id);
})), function(o){
- setFlicker(o, radius, dim_radius, other_players);
+ setFlicker(o, radius, dim_radius, other_players,arc_angle);
});
break;
@@ -379,7 +411,7 @@ var Torch = Torch || (function() {
.each(function(fdata){
var o = getObj('graphic',fdata.parent),
f = getObj('graphic',fdata.id),
- dx, dy, dr;
+ dx, dy, dr, da;
if(!o) {
clearFlicker(fdata.id);
@@ -390,10 +422,12 @@ var Torch = Torch || (function() {
dx = randomInteger(2 * flickerDeltaLocation)-flickerDeltaLocation;
dy = randomInteger(2 * flickerDeltaLocation)-flickerDeltaLocation;
dr = randomInteger(2 * (fdata.light_radius*flickerDeltaRadius)) - (fdata.light_radius*flickerDeltaRadius);
+ da = randomInteger(2 * flickerDeltaAngle)-flickerDeltaAngle;
f.set({
top: o.get('top')+dy,
left: o.get('left')+dx,
- light_radius: fdata.light_radius+dr
+ light_radius: fdata.light_radius+dr,
+ light_angle: (360 === fdata.light_angle ? 360 : Math.min(360,Math.max(fdata.light_angle+da,0)))
});
}
}
diff --git a/Torch/package.json b/Torch/package.json
index 1ea287f66f..677df8e5ee 100644
--- a/Torch/package.json
+++ b/Torch/package.json
@@ -1,6 +1,6 @@
{
"name": "Torch",
- "version": "0.8.0",
+ "version": "0.8.2",
"description": "A simple script for giving lights to tokens and turning off and on dynamic lighting.",
"authors": "The Aaron",
"roll20userid": "104025",