Starblast.io Custom Station Modules

Use custom station modules client-side

// ==UserScript==
// @name         Starblast.io Custom Station Modules
// @namespace    https://greasyfork.org/en/users/226344
// @version      0.1
// @description  Use custom station modules client-side
// @license      MIT
// @icon         https://cdn.upload.systems/uploads/DDPfEofl.png
// @author       Pixelmelt and Hackerman
// @include      /^https\:\/\/starblast\.io\/(app.html(\?.+)*)*$/
// @run-at       document-start
// @grant        none
// ==/UserScript==

const modName = "Custom Station Modules";

const log = (msg) => console.log(`%c[${modName}] ${msg}`, "color: #3D80E1");

function injector(sbCode) {
    let src = sbCode;
  
    // run script from external soruce
    let script = document.createElement("script");
    script.src = "https://cdn.jsdelivr.net/gh/bhpsngum/starblast-snippets@latest/CustomStationModuleModels/loader.user.js";
    document.body.appendChild(script);
    log(`Mod injected`);
    return src;
}

if (!window.sbCodeInjectors) window.sbCodeInjectors = [];
window.sbCodeInjectors.push((sbCode) => {
  try {
    return injector(sbCode);
  } catch (error) {
    alert(`${modName} failed to load`);
    throw error;
  }
});

log(`Mod loaded`);