Shellshock.IO Aimlocker

Locks aim to the nearest player in shellshock.io.

Stan na 30-11-2021. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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

	}
} );