Shellshock.IO Aimlocker

Locks aim to the nearest player in shellshock.io.

Versión del día 30/11/2021. Echa un vistazo a la versión más reciente.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==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 );

	}
} );