Greasy Fork is available in English.

Anti Invisible Buildings [No bundle]

Draws invisible objects (Sets a new dir (angle) for them)

  1. // ==UserScript==
  2. // @name Anti Invisible Buildings [No bundle]
  3. // @namespace -
  4. // @version 0.1
  5. // @description Draws invisible objects (Sets a new dir (angle) for them)
  6. // @author Nudo#3310
  7. // @match *://moomoo.io/*
  8. // @match *://sandbox.moomoo.io/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=moomoo.io
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. /**
  15. * @class AntiInvisible
  16. */
  17. let AntiInvisible = {}
  18.  
  19. let { rotate } = CanvasRenderingContext2D.prototype
  20.  
  21. /**
  22. * When the game is fully loaded, the main AntiInvisible parameters will be set
  23. * @method init
  24. */
  25. AntiInvisible.init = function() {
  26. /**Activate AntiInvisible*/
  27. AntiInvisible.toggler = true
  28.  
  29. /**How transparent will the object itself be*/
  30. AntiInvisible.opacity = .6
  31.  
  32. /**On which dir (angle) will AntiInvisible work*/
  33. AntiInvisible.invisibleAngle = 38e38
  34. }
  35.  
  36. AntiInvisible.init()
  37.  
  38. /**
  39. * Return fixed object direction.
  40. * @method getFixedDir
  41. * @param {Number} angle
  42. * @returns {Number} New object angle
  43. */
  44. AntiInvisible.getFixedDir = function(angle) {
  45. return Math.atan2(Math.sin(angle), Math.cos(angle))
  46. }
  47.  
  48. /**
  49. * If it does not match the game normal dir then returns true otherwise false
  50. * @method isAbnormalDir
  51. * @param {Number} angle
  52. * @returns {Boolean}
  53. */
  54. AntiInvisible.isAbnormalDir = function(angle) {
  55. if (angle <= -AntiInvisible.invisibleAngle || angle >= AntiInvisible.invisibleAngle) {
  56. return true
  57. }
  58. return false
  59. }
  60.  
  61. /**
  62. * Set opacity (globalAlpha) for an object
  63. * @method setOpacity
  64. * @param {Number} opacity
  65. */
  66. AntiInvisible.setOpacity = function(opacity) {
  67. this.globalAlpha = opacity
  68. }
  69.  
  70. /**
  71. * Rotates the image
  72. * @method rotate
  73. * @param {Number} angle
  74. * @returns {function}
  75. */
  76. CanvasRenderingContext2D.prototype.rotate = function(angle) {
  77. if (AntiInvisible.isAbnormalDir(angle) && AntiInvisible.toggler) {
  78. angle = AntiInvisible.getFixedDir(angle)
  79.  
  80. AntiInvisible.setOpacity.call(this, AntiInvisible.opacity)
  81.  
  82. return rotate.call(this, angle)
  83. }
  84.  
  85. return rotate.apply(this, arguments)
  86. }
  87. })()