FoV Script

A FoV script for the Diep.io game.

  1. // ==UserScript==
  2. // @name FoV Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.0
  5. // @description A FoV script for the Diep.io game.
  6. // @author Altanis
  7. // @match *://diep.io/*
  8. // @match *://diep-io.rivet.game/*
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. /**
  17. NOTE: This will only work on the first server you connect to.
  18. If you connect to a different server, this script will no longer work (and may even crash the game).
  19. To use this script in a different server, reload.
  20. */
  21.  
  22. const handler = {apply(r,o,args){Error.stackTraceLimit=0;return r.apply(o,args)}};Object.freeze = new Proxy(Object.freeze, handler)
  23.  
  24. window.HEAPF32 = undefined;
  25. window.fov = [];
  26.  
  27. const win = typeof unsafeWindow != "undefined" ? unsafeWindow : window;
  28. win.Object.defineProperty(win.Object.prototype, "HEAPF32", {
  29. get: function() {
  30. return undefined;
  31. },
  32. set: function(to) {
  33. if(!to || !this.HEAPU32) return;
  34. delete win.Object.prototype.HEAPF32;
  35. window.Module = this;
  36. window.Module.HEAPF32 = to;
  37. window.HEAPF32 = to;
  38.  
  39. console.log("HEAPF32 found");
  40. },
  41. configurable: true,
  42. enumerable: true
  43. });
  44.  
  45.  
  46. const int = setInterval(function() {
  47. if (!document.querySelector('#home-screen[x-state="awaiting-spawn"] > #spawn-input > #pre-spawn-text')) return;
  48. Array.from(window.HEAPF32).map((val, index) => {
  49. if (val === 0.3499999940395355) { // 0.550000011920929
  50. window.fov.push(index);
  51. console.log('Got index', index);
  52. }
  53. });
  54. clearInterval(int);
  55. }, 150);
  56.  
  57. document.addEventListener('keydown', async event => {
  58. if (event.key == '-') {
  59. console.log('Zooming out...');
  60. for (const fov of window.fov) {
  61. window.HEAPF32[fov] -= 0.1;
  62. }
  63. } else if (event.key == '+') {
  64. console.log('Zooming in...');
  65. for (const fov of window.fov) {
  66. window.HEAPF32[fov] += 0.1;
  67. }
  68. }
  69. });
  70. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址