SmashKarts Player Highlight

Makes all players visible by modifying shaders

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         SmashKarts Player Highlight
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Makes all players visible by modifying shaders
// @author       Havvingyy
// @match        *://smashkarts.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function showPopup(message) {
        const popup = document.createElement('div');
        popup.style.position = 'fixed';
        popup.style.top = '0';
        popup.style.left = '0';
        popup.style.width = '100%';
        popup.style.backgroundColor = '#333';
        popup.style.color = '#fff';
        popup.style.padding = '10px';
        popup.style.textAlign = 'center';
        popup.style.zIndex = '9999';
        popup.style.fontFamily = 'monospace';
        popup.innerHTML = message + '<button style="margin-left:10px;background:#ff6600;color:#fff;border:none;padding:5px 10px;border-radius:5px;cursor:pointer;" onclick="this.parentNode.remove()">Close</button>';
        document.body.appendChild(popup);
    }

    showPopup("Player Red Borders Enabled!");

    const originalShader = WebGL2RenderingContext.prototype.shaderSource;

    WebGL2RenderingContext.prototype.shaderSource = function(shader, src) {
        const isPlayerShader = src.includes("hlslcc_mtx4x4unity_ObjectToWorld[4]") &&
                               src.includes("hlslcc_mtx4x4unity_MatrixVP[4]") &&
                               !src.includes("hlslcc_mtx4x4glstate_matrix_projection") &&
                               !src.includes("unity_FogParams");

        if (isPlayerShader) {
            if (src.includes("vs_COLOR0")) {
                src = src.replace(/void\s+main\(\)[\s\S]*?{([\s\S]*?)}/, `void main() {
                    gl_Position = gl_Position;
                    vs_COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); // red border
                    return;
                }`);
            } else {
                src = src.replace(/return;/, `
                    vs_COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); // red border
                    return;
                `);
            }
        }

        return originalShader.apply(this, [shader, src]);
    };
})();