SmashKarts Player Highlight

Makes all players visible by modifying shaders

目前為 2025-11-13 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         SmashKarts Player Highlight
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Makes all players visible by modifying shaders
// @author       DogeSmashMonkey
// @match        *://smashkarts.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Popup
    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 Highlight Enabled! May not work on all maps.");

    // Shader override
    const originalShader = WebGL2RenderingContext.prototype.shaderSource;

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

        if (query) {
            if (src.includes("vs_COLOR0")) {
                src = src.replace(/void\s+main\(\)[\s\S]*?{([\s\S]*?)}/, `void main() {
                    gl_Position.z = 0.5;
                    vs_TEXCOORD0 = in_TEXCOORD0;
                    return;
                }`);
            } else {
                src = src.replace(/return;/, `
                    gl_Position.z = 0.5;
                    return;
                `);
            }
        }

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