Change the Sky Color of Shell Shockers

Change the color of the sky in shell shockers!

Install this script?
Author's suggested script

You may also like Mod Panel for Shell Shockers.

Install this script
  1. // ==UserScript==
  2. // @name Change the Sky Color of Shell Shockers
  3. // @version 0.2
  4. // @author A3+++
  5. // @description Change the color of the sky in shell shockers!
  6. // @match *://shellshock.io/*
  7. // @run-at document-start
  8. // @grant none
  9. // @namespace https://greatest.deepsurf.us/users/815159
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. function hexToRgb(hex) {
  14. let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  15. return result ? {
  16. r: parseInt(result[1], 16) / 255,
  17. g: parseInt(result[2], 16) / 255,
  18. b: parseInt(result[3], 16) / 255
  19. } : null;
  20. }
  21.  
  22. window.data = {
  23. set scene(e) { this.gameScene = e },
  24. gameScene: null,
  25. skyColor: "#FFFFFF",
  26. mesh: null,
  27. updateSky: function () {
  28. if (!this.mesh && this.gameScene) {
  29. this.mesh = this.gameScene.getMeshByID("skyBox");
  30. }
  31. if (this.mesh) {
  32.  
  33. const color = hexToRgb(this.skyColor);
  34. this.mesh.material.emissiveColor.r = color.r;
  35. this.mesh.material.emissiveColor.g = color.g;
  36. this.mesh.material.emissiveColor.b = color.b;
  37.  
  38. this.mesh.material.reflectionTexture = null;
  39.  
  40. }
  41. }
  42. }
  43.  
  44. window.XMLHttpRequest = class extends window.XMLHttpRequest {
  45. constructor() {
  46. super(...arguments);
  47. }
  48. open() {
  49. if (arguments[1] && arguments[1].includes("js/shellshock.js")) {
  50. this.scriptMatch = true;
  51. }
  52.  
  53. super.open(...arguments);
  54. }
  55. get response() {
  56.  
  57. if (this.scriptMatch) {
  58. let responseText = super.response;
  59.  
  60. let match = responseText.match(/([A-z][A-z])\.fogDensity=.01\);/);
  61. if (match) responseText = responseText.replace(match[0], match[0] + `data.scene=${match[1]};`);
  62. return responseText;
  63. }
  64. return super.response;
  65. }
  66. };
  67.  
  68.  
  69. let html = [`<div><p>Sky Color: <input type="color" value="#0000ff" id="colorPicker"></div>`].join();
  70.  
  71.  
  72. let interval = setInterval(function () {
  73. let pauseButtons = document.getElementById("pauseButtons");
  74. if (pauseButtons) {
  75. clearInterval(interval);
  76. let skyColorDiv = document.createElement("div");
  77. skyColorDiv.innerHTML = '<br>' + html;
  78. pauseButtons.appendChild(skyColorDiv);
  79.  
  80. let colorPicker = document.getElementById("colorPicker");
  81.  
  82. colorPicker.addEventListener("input", function () {
  83. data.skyColor = this.value;
  84. data.updateSky()
  85. });
  86.  
  87. }
  88.  
  89. }, 1000);
  90. }())