Shellshock.IO Aimlocker

Locks aim to the nearest player in shellshock.io.

当前为 2021-11-30 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Shellshock.IO Aimlocker
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  Locks aim to the nearest player in shellshock.io.
// @author       Zertalious (Zert)
// @match        *://shellshock.io/*
// @icon         https://www.google.com/s2/favicons?domain=shellshock.io
// @grant        none
// ==/UserScript==

window.enabled = true;

window.addEventListener( 'keyup', function ( event ) {

	if ( String.fromCharCode( event.keyCode ) === 'B' ) {

		window.enabled = ! window.enabled;

	}

} );

Node.prototype.appendChild = new Proxy( Node.prototype.appendChild, {
	apply( target, thisArgs, [ script ] ) {

		if ( script.tagName === 'SCRIPT' ) {

			script.innerHTML = script.innerHTML.replace( 'Sr.render()', `Sr.render(), ( function () {

				const players = Dr;
				const myPlayer = Ir;
				const BABYLON = e;

				if ( ! myPlayer ) {

					return;

				}

				for ( let i = 0; i < players.length; i ++ ) {

					const player = players[ i ];

					if ( ! player ) {

						continue;

					}

					if ( player.sphere === undefined ) {

						const material = new BABYLON.StandardMaterial( 'myMaterial', player.actor.scene );
						material.emissiveColor = material.diffuseColor = new BABYLON.Color3( 1, 0, 0 );
						material.wireframe = true;

						const sphere = BABYLON.Mesh.CreateSphere( 'mySphere', 8, 1, player.actor.scene );
						sphere.material = material;
						sphere.position.y = 0.2;
						
						sphere.parent = player.actor.mesh;

						player.sphere = sphere;

					}

					player.sphere.visibility = window.enabled && ( player === myPlayer || myPlayer.team === 0 || myPlayer.team !== player.team );

				}

				if ( window.enabled && myPlayer.playing ) {

					let minDistance = Infinity;
					let targetPlayer;

					for ( let i = 0; i < players.length; i ++ ) {

						const player = players[ i ];

						if ( player && player !== myPlayer && player.playing && ( myPlayer.team === 0 || player.team !== myPlayer.team ) ) {

							const distance = Math.hypot( player.x - myPlayer.x, player.y - myPlayer.y, player.z - myPlayer.z );

							if ( distance < minDistance ) {

								minDistance = distance;

								targetPlayer = player;

							}

						}

					}

					if ( targetPlayer ) {

						const x = targetPlayer.x - myPlayer.x;
						const y = targetPlayer.y - myPlayer.y;
						const z = targetPlayer.z - myPlayer.z;
							
						myPlayer.yaw = Math.mod( Math.atan2( x, z ), Math.PI2 );
						myPlayer.pitch = - Math.atan2( y, Math.hypot( x, z ) ) % Math.PI;

					}

				}

			} )()` );

		}

		return Reflect.apply( ...arguments );

	}
} );