Greasy Fork is available in English.

!ARRAS - NoPush Script - Public

Prevents pushing when afking. Press KeyN to start. Public version using Arras() and dumber, less efficient code.

// ==UserScript==
// @name !ARRAS - NoPush Script - Public
// @author Salt
// @namespace a script that keeps you still
// @description Prevents pushing when afking. Press KeyN to start. Public version using Arras() and dumber, less efficient code.
// @description:en Prevents pushing when afking. Press KeyN to start. Public version using Arras() and dumber, less efficient code.
// @version 5000238923
// @match *://arras.io/*
// @match *://arras.netlify.app/*
// @run-at document-load
// ==/UserScript==   

/*

*/

const KEYCODE = "KeyN"; // changeable
const ACCURACY = 40; // don't mind this
const KEY = ((5269^29)>>2)^27;
(async function runScript() {
  const state = {
    active: false,
    socket: null,
    afkSpot: { x: 0, y: 0 },
    mouse: {x:0,y:0},
    flag: 0
  }

  while (!state.socket) {
    state.socket = (Arras(KEY)||{}).socket
    await new Promise(r=>setTimeout(r,200))
  }
  
  
  Arras(1337).socket._talk = Arras(1337).socket._talk || Arras(1337).socket.talk;
  
  Arras(1337).socket.talk = function (...data) {
    
    if (data[0] === 'C') {
      state.mouse = {x: data[1], y: data[2]}
      state.flag = data[3] & 0b1110000
    }
    
    this._talk(...data)
  }
  
  let noPushLoop = setInterval(function react() {
    if (!state.active) return

    let playerLoc = {x:Arras(KEY).player.cx, y:Arras(KEY).player.cy};
    let {mouse, flag} = state;
    let delta = {x: (playerLoc.x - state.afkSpot.x ), y: (playerLoc.y - state.afkSpot.y)}
    
    flag |= delta.y/ACCURACY > 1 ? 1 : delta.y/ACCURACY < -1 ? 2 : 0
    flag |= delta.x/ACCURACY > 1 ? 4 : delta.x/ACCURACY < -1 ? 8 : 0

    console.log(delta)
     Arras(KEY).socket._talk('C', mouse.x, mouse.y, flag)
  }, 20)
  
  window.addEventListener('keyup', key => {
    let inGame = !Arras(KEY).socket ? false : Arras(KEY).died ? false : Arras(KEY).disconnected ? false : true;
    if (inGame && key.code == KEYCODE) {
      state.afkSpot = {
        x: Arras(KEY).player.cx,
        y: Arras(KEY).player.cy
      }
      state.active = !state.active;

      alert(state.active ? 'Anti Push Activated' : "Anti Push Deactivated")
    }
  })

})()