您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Stutter and respawn fix!
当前为
// ==UserScript== // @name Wormax.IO Zoom [WORKS ONLY ON THORIUM] [Stutter fix] // @namespace http://tampermonkey.net/ // @version 3.4 // @description Stutter and respawn fix! // @author AdamStorme // @match *://*.wormax.io/* // @grant none // @license MIT // ==/UserScript== (function () { const script = document.createElement('script'); script.textContent = '(' + function () { let zoomTarget = 1.0; let zoomCurrent = 1.0; let currentCamera = null; let currentController = null; let cameraPatched = false; function findCameraController() { const stack = [window]; const visited = new WeakSet(); while (stack.length) { const obj = stack.pop(); if (!obj || typeof obj !== 'object' || visited.has(obj)) continue; visited.add(obj); for (const key in obj) { try { const val = obj[key]; if ( val && typeof val === 'object' && val.camera && typeof val.camera.zoom === 'number' && 'updateZoom' in val && 'follow' in val ) { return val; } if (val && typeof val === 'object') { stack.push(val); } } catch {} } } return null; } function patchZoomProperty(camera) { if (!camera || cameraPatched) return; cameraPatched = true; try { Object.defineProperty(camera, 'zoom', { get: () => zoomCurrent, set: (v) => { zoomTarget = Math.max(0.1, Math.min(5.0, v)); }, configurable: true }); console.log('[ZoomMod] camera.zoom property trapped'); } catch (e) { console.warn('[ZoomMod] Failed to trap zoom:', e); } } function mainZoomLoop() { function step() { // Controller re-detection every 500ms const controller = findCameraController(); if ( controller && controller.camera && typeof controller.camera.zoom === 'number' && controller !== currentController ) { currentController = controller; currentCamera = controller.camera; controller.updateZoom = false; cameraPatched = false; patchZoomProperty(currentCamera); console.log('[ZoomMod] Rehooked camera after respawn'); } if (currentCamera) { const diff = zoomTarget - zoomCurrent; zoomCurrent += diff * 0.15; if (Math.abs(diff) < 0.0005) zoomCurrent = zoomTarget; currentCamera.update?.(); } requestAnimationFrame(step); } requestAnimationFrame(step); } function setupInput() { window.addEventListener('wheel', (e) => { const step = e.altKey ? 0.1 : e.shiftKey ? 1.0 : 0.2; zoomTarget = Math.max(0.1, Math.min(5.0, zoomTarget + (e.deltaY > 0 ? step : -step))); e.preventDefault(); }, { passive: false }); document.addEventListener('keydown', (e) => { if (e.key.toLowerCase() === 'r') { zoomTarget = 1.0; console.log('[ZoomMod] Zoom reset'); } }); } setupInput(); mainZoomLoop(); // Only one loop } + ')();'; document.body.appendChild(script); })();