Skip to content

Commit

Permalink
7TV Addons 1.4.24
Browse files Browse the repository at this point in the history
* Added: A new option to disable the drop shadow effect of nametag paints. Apparently when too many of them are being rendered in individual elements it can cause a drop in performance.
  • Loading branch information
Lordmau5 committed Oct 1, 2024
1 parent 84a45b5 commit 91bce1e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/7tv-emotes/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main",
"clips"
],
"version": "1.4.23",
"version": "1.4.24",
"short_name": "7TV",
"name": "7TV Emotes",
"author": "Melonify",
Expand All @@ -14,5 +14,5 @@
"website": "https://7tv.app",
"settings": "add_ons.7tv_emotes",
"created": "2021-07-12T23:18:04.000Z",
"updated": "2024-08-06T06:04:34.114Z"
"updated": "2024-10-01T15:52:22.148Z"
}
30 changes: 26 additions & 4 deletions src/7tv-emotes/modules/nametag-paints.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ export default class NametagPaints extends FrankerFaceZ.utilities.module.Module
}
});

this.settings.add('addon.seventv_emotes.nametag_paints_drop_shadows', {
default: true,
ui: {
path: 'Add-Ons > 7TV Emotes >> User Cosmetics',
title: 'Nametag Paints Drop Shadows',
description: 'Whether to show drop shadows for nametag paints **(Note: Too many drop shadows on screen can cause a drop in performance)**',
component: 'setting-check-box',
}
});

this.namepaintsApplyer = {
type: 'apply_namepaints',

Expand Down Expand Up @@ -48,20 +58,21 @@ export default class NametagPaints extends FrankerFaceZ.utilities.module.Module

this.resolve('tooltips').define('seventv-paint', target => {
const paint_id = target?.dataset?.seventvPaintId;
const paint_name = this.paintNames.get(paint_id);
const paint_name = this.paints.get(paint_id)?.name;

if (!paint_name) return FrankerFaceZ.utilities.tooltip.NoContent;

return createElement('span', { className: 'seventv-paint-tooltip' }, paint_name);
});

this.paintSheet = false;
this.paintNames = new Map();
this.paints = new Map();
this.userPaints = new Map();
}

onEnable() {
this.on('settings:changed:addon.seventv_emotes.nametag_paints', () => this.updateChatLines());
this.on('settings:changed:addon.seventv_emotes.nametag_paints_drop_shadows', () => this.updatePaintSheet());
}

getPaintStylesheet() {
Expand Down Expand Up @@ -136,8 +147,16 @@ export default class NametagPaints extends FrankerFaceZ.utilities.module.Module
this.setUserPaintByID(user.id, paint_id);
}

updatePaintSheet() {
for (const paint of this.paints.values()) {
this.updatePaintStyle(paint);
}

this.updateChatLines();
}

updatePaintStyle(paint, remove = false) {
this.paintNames.set(paint.id, paint.name);
this.paints.set(paint.id, paint);

const sheet = this.getPaintStylesheet();
if (!sheet) {
Expand All @@ -161,8 +180,11 @@ export default class NametagPaints extends FrankerFaceZ.utilities.module.Module
}

const gradients = paint.gradients.map(g => this.createGradientFromPaint(g));

const drop_shadows_enabled = this.settings.get('addon.seventv_emotes.nametag_paints_drop_shadows');

const filter = (() => {
if (!paint.shadows) {
if (!drop_shadows_enabled || !paint.shadows) {
return '';
}

Expand Down

0 comments on commit 91bce1e

Please sign in to comment.