Greasy Fork is available in English.

Shellshock.IO Aimlocker

Locks aim to the nearest player in shellshock.io.

Ekde 2021/11/30. Vidu La ĝisdata versio.

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

	}
} );