Skip to content

Commit 3c02df4

Browse files
authored
Merge pull request #2193 from nolivo/moveLighting-update
Updated moveLighting to support jumpgate lighting and the foreground …
2 parents b7b0d02 + cd52a7c commit 3c02df4

2 files changed

Lines changed: 114 additions & 4 deletions

File tree

moveLighting/0.1.5/moveLighting.js

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// By: Kastion
2+
// Contact: https://app.roll20.net/users/3173313/kastion
3+
4+
var moveLighting = moveLighting || (function(){
5+
'use strict';
6+
7+
var showHelp = function() {
8+
sendChat('Move Lighting Script',
9+
'/w gm '+
10+
'<div style="border: 1px solid black; background-color: white; padding: 3px 3px;">'+
11+
'<div style="font-weight: bold; border-bottom: 1px solid black;font-size: 130%;">'+
12+
'moveLighting'+
13+
'<div style="clear: both"></div>'+
14+
'</div>'+
15+
'<div style="padding-left:10px;margin-bottom:3px;">'+
16+
'<p>Allows the GM to move what layer a lighting path is on.</p>'+
17+
'</div>'+
18+
'<b>Commands</b>'+
19+
'<div style="padding-left:10px;"><b><span style="font-family: serif;">!movelight [layer] [ID]</span></b>'+
20+
'<div style="padding-left: 10px;padding-right:20px; font-size:12px;">'+
21+
'On Jumpgate Games, Valid Layer Options Are: map, objects, gmlayer, walls, foreground'+
22+
'</div>'+
23+
'<div style="padding-left: 10px;padding-right:20px; font-size:12px;">'+
24+
'On Legacy Games, Valid Layer Options Are: map, objects, gmlayer, walls'+
25+
'</div>'+
26+
'</div>'
27+
);
28+
},
29+
30+
handleInput = function(msg) {
31+
32+
if ( "api" !== msg.type || !playerIsGM(msg.playerid) ) {
33+
return;
34+
}
35+
36+
let parts = msg.content.split(/\s+--\s+/);
37+
let args = parts[0].split(/\s+/);
38+
const isJumpgate = () => ['jumpgate'].includes(Campaign().get('release'));
39+
var obj_type,valid_layers;
40+
41+
switch(args[0]) {
42+
case '!movelight': {
43+
var new_layer = args[1];
44+
45+
if (isJumpgate()){
46+
obj_type = "pathv2";
47+
valid_layers = ["gmlayer","walls","objects","map","foreground"];
48+
}
49+
50+
else{
51+
obj_type = "path";
52+
valid_layers = ["gmlayer","walls","objects","map"];
53+
}
54+
55+
if (valid_layers.includes(new_layer))
56+
{
57+
var path_obj = findObjs({_type: obj_type, _id: args[2]})[0];
58+
if (path_obj)
59+
{
60+
path_obj.set("layer", new_layer);
61+
}
62+
63+
else {
64+
sendChat('Move Lighting Script', '/w gm No path object found with that ID.');
65+
}
66+
67+
} else {
68+
sendChat('Move Lighting Script', '/w gm Invalid Layer Specified.');
69+
showHelp();
70+
}
71+
break;
72+
}
73+
}
74+
},
75+
76+
checkInstall = function()
77+
{
78+
var script_version = "0.1.5";
79+
if( ! state.moveLighting ) {
80+
state.moveLighting = {
81+
version: script_version,
82+
};
83+
}
84+
85+
if (state.moveLighting.version != script_version)
86+
state.moveLighting.version = script_version;
87+
88+
log("-=> Move Lighting Script v"+state.moveLighting.version+" Initialized <=-");
89+
},
90+
91+
92+
registerEventHandlers = function() {
93+
on('chat:message', handleInput);
94+
};
95+
96+
return {
97+
CheckInstall: checkInstall,
98+
RegisterEventHandlers: registerEventHandlers
99+
};
100+
101+
}());
102+
103+
on("ready", function() {
104+
'use strict';
105+
106+
moveLighting.CheckInstall();
107+
moveLighting.RegisterEventHandlers();
108+
});

moveLighting/script.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
{
22
"name": "Move Lighting",
33
"script": "moveLighting.js",
4-
"version": "0.1.4",
5-
"previousversions": [],
6-
"description": "# Page FX\n\n_v0.1.4 Updates_\n\nUse the command !movelight with the parameters of:\n\n1) the layer to move to and\n\n2) the ID of the dynamic lighting path object\n\nExample: !movelight gmlayer -LDSsme9FmMDFmf",
4+
"version": "0.1.5",
5+
"previousversions": ["0.1.4"],
6+
"description": "Move Lighting v0.1.5 adds support for Jumpgate lighting and the foreground layer.\n\nUse the command !movelight with the parameters of:\n\n1) the layer to move to and\n\n2) the ID of the dynamic lighting path object\n\nExample: !movelight gmlayer -LDSsme9FmMDFmf",
77
"authors": "Luke LeClair a.k.a Kastion",
88
"roll20userid": 3173313,
99
"useroptions": [],
1010
"dependencies": [],
1111
"modifies": {
12-
"graphic:bar1_value": "read"
12+
"path": "read",
13+
"pathv2": "read",
14+
"campaign.release":"read"
1315
},
1416
"conflicts": []
1517
}

0 commit comments

Comments
 (0)