Skip to content

Commit

Permalink
Merge branch 'main' into Beta---give-darkness-aoe-a-texture,-truesigh…
Browse files Browse the repository at this point in the history
…t-should-be-visible-darkvision-range-now,-move-light-drawings-below-so-darkness-aoe-is-not-reveal-by-it-
  • Loading branch information
Azmoria authored Oct 22, 2023
2 parents d7366a6 + e01e68a commit 9520918
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 133 deletions.
12 changes: 6 additions & 6 deletions Fog.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
const POLYGON_CLOSE_DISTANCE = 15;
const doorColors = {
0: {
'open': "rgba(255, 100, 255, 0.5)",
'open': "rgba(255, 100, 255, 0.5)", // door
'closed': "rgba(255, 100, 255, 1)"
},
1: {
'open': "rgba(255, 255, 0, 0.5)",
'open': "rgba(255, 255, 0, 0.5)", // window
'closed': "rgba(255, 255, 0, 1)"
},
2: {
'open': "rgba(150, 50, 150, 0.5)",
'open': "rgba(150, 50, 150, 0.5)", // locked door
'closed': "rgba(150, 50, 150, 1)"
},
3: {
'open': "rgba(150, 150, 0, 0.5)",
'open': "rgba(150, 150, 0, 0.5)", // locked window
'closed': "rgba(150, 150, 0, 1)"
},
4: {
'open': "rgba(100, 0, 255, 0.5)",
'open': "rgba(100, 0, 255, 0.5)", //secret door
'closed': "rgba(100, 0, 255, 1)"
},
5: {
'open': "rgba(50, 0, 180, 0.5)",
'open': "rgba(50, 0, 180, 0.5)", // secret locked door
'closed': "rgba(50, 0, 180, 1)"
},
};
Expand Down
2 changes: 1 addition & 1 deletion Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ class Token {
'--token-rotation': `${rotation}deg`,
'--token-scale': imageScale
})
$(`.isAoe[data-id='${this.options.id}']:not(.token) .token-image`).css("transform", "scale(var(--token-scale)) rotate(var(--token-rotation))");


setTimeout(function() {old.find(".token-image").css("transition", "")}, 200);

Expand Down
173 changes: 49 additions & 124 deletions TokenMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,75 +146,35 @@ function token_context_menu_expanded(tokenIds, e) {
let y1 = parseInt(door.attr('data-y1'));
let y2 = parseInt(door.attr('data-y2'));

let locked = door.hasClass('locked');
let secret = door.hasClass('secret');

let isDoor = door.children('.door').length>0;

let doors = window.DRAWINGS.filter(d => (d[1] == "wall" && doorColorsArray.includes(d[2]) && parseInt(d[3]) == x1 && parseInt(d[4]) == y1 && parseInt(d[5]) == x2 && parseInt(d[6]) == y2))
let color = doors[0][2];
let isOpen = (/rgba.*0\.5\)/g).test(color) ? 'open' : 'closed';

if(door.children('.door').length>0){

body.append($('<div class="token-image-modal-footer-title" style="margin-top:10px">Door Type</div>'));

let button = $(`<button>Unlocked</button>`);
button.on("click", function() {
door.toggleClass(['locked', 'secret'], false);
window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[0][isOpen],
x1,
y1,
x2,
y2,
12,
doors[0][8]
];
window.DRAWINGS.push(data);

redraw_light_walls();
redraw_light();


sync_drawings();
});
body.append(button);


button = $(`<button>Locked</button>`);
button.on("click", function() {
door.toggleClass('locked', true);
door.toggleClass(['secret', 'open'], false);
body.append($('<div class="token-image-modal-footer-title" style="margin-top:10px">Door Type</div>'));


window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[2]['closed'],
x1,
y1,
x2,
y2,
12,
doors[0][8]
];
window.DRAWINGS.push(data);

redraw_light_walls();
redraw_light();


sync_drawings();
});
body.append(button);
let lockedButton = $(`<button class="${door.hasClass('locked') ? 'single-active active-condition' : 'none-active'} context-menu-icon-hidden door-lock material-icons">Locked</button>`)
lockedButton.off().on("click", function(clickEvent){
let clickedItem = $(this);
let locked = door.hasClass('locked');
let secret = door.hasClass('secret');

const type = isDoor ? (secret ? (!locked ? 5 : 4) : (!locked ? 2 : 0)) : (!locked ? 3 : 1)

button = $(`<button>Secret</button>`);
button.on("click", function() {
door.toggleClass('locked', false);
door.toggleClass('secret', true);
isOpen = !locked ? 'closed' : isOpen;

window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
door.toggleClass('locked', !locked);
window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[4][isOpen],
doorColors[type][isOpen],
x1,
y1,
x2,
Expand All @@ -229,86 +189,51 @@ function token_context_menu_expanded(tokenIds, e) {


sync_drawings();
});
body.append(button);

button = $(`<button>Secret & Locked</button>`);
button.on("click", function() {
door.toggleClass(['locked', 'secret'], true);
door.toggleClass('open', false);
window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[5]['closed'],
x1,
y1,
x2,
y2,
12,
doors[0][8]
];
window.DRAWINGS.push(data);
clickedItem.removeClass("single-active all-active some-active active-condition");

redraw_light_walls();
redraw_light();
clickedItem.addClass(`${!locked ? 'single-active active-condition' : ''}`);
});
body.append(lockedButton);


sync_drawings();
});
body.append(button);

}
else if(door.children('.window').length>0){
body.append($('<div class="token-image-modal-footer-title" style="margin-top:10px">Window Type</div>'));

if(door.children('.door').length>0){
let secretButton = $(`<button class="${door.hasClass('secret') ? 'single-active active-condition' : 'none-active'} context-menu-icon-hidden door-secret material-icons">Secret</button>`)
secretButton.off().on("click", function(clickEvent){
let clickedItem = $(this);
let locked = door.hasClass('locked');
let secret = door.hasClass('secret');

let button = $(`<button>Unlocked</button>`);
button.on("click", function() {
door.toggleClass('locked', false);
window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[1][isOpen],
x1,
y1,
x2,
y2,
12,
doors[0][8]
];
window.DRAWINGS.push(data);
const type = !secret ? (locked ? 5 : 4) : (locked ? 2 : 0)

redraw_light_walls();
redraw_light();
isOpen = locked ? 'closed' : isOpen;

door.toggleClass('secret', !secret);
window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[type][isOpen],
x1,
y1,
x2,
y2,
12,
doors[0][8]
];
window.DRAWINGS.push(data);

sync_drawings();
});
body.append(button);
redraw_light_walls();
redraw_light();

button = $(`<button>Locked</button>`);
button.on("click", function() {
door.toggleClass('locked', true);
door.toggleClass('open', false);
window.DRAWINGS = window.DRAWINGS.filter(d => d != doors[0]);
let data = ['line',
'wall',
doorColors[3]['closed'],
x1,
y1,
x2,
y2,
12,
doors[0][8]
];
window.DRAWINGS.push(data);

redraw_light_walls();
redraw_light();
sync_drawings();

clickedItem.removeClass("single-active all-active some-active active-condition");

sync_drawings();
clickedItem.addClass(`${!secret ? 'single-active active-condition' : ''}`);
});
body.append(button);
body.append(secretButton);
}

}
Expand Down
13 changes: 11 additions & 2 deletions abovevtt.css
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,16 @@ div#scene_properties form > div {
content:"\e898";
}

.door-lock.material-icons:before{
content:"\e897";
padding: 2px 0px;
}

.door-secret.material-icons:before{
content: "S";
margin: 0px 0px 0px 2px;
color: #dc0000;
}

.condition-lock.locked.material-symbols-outlined:before,
.condition-lock.material-symbols-outlined:hover:before {
Expand Down Expand Up @@ -6359,12 +6369,11 @@ div.ddbc-tab-options--layout-pill>button{


[data-darkness]{
transform: rotate(var(--token-rotation));
z-index:15 !important;
opacity: 1 !important;
}



[data-darkness] .aoe-style-darkness,
[data-darkness] .aoe-border-cone{
opacity: 1 !important;
Expand Down

0 comments on commit 9520918

Please sign in to comment.