mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 02:31:51 +00:00
Improve mod developing so mods are directly ready to be deployed, load mods from local file server
This commit is contained in:
parent
f3b8d329fc
commit
6fa2515d85
@ -146,7 +146,7 @@ gulp.task("main.webserver", () => {
|
|||||||
*/
|
*/
|
||||||
function serve({ version = "web" }) {
|
function serve({ version = "web" }) {
|
||||||
browserSync.init({
|
browserSync.init({
|
||||||
server: buildFolder,
|
server: [buildFolder, path.join(baseDir, "src", "js")],
|
||||||
port: 3005,
|
port: 3005,
|
||||||
ghostMode: {
|
ghostMode: {
|
||||||
clicks: false,
|
clicks: false,
|
||||||
|
|||||||
@ -71,6 +71,7 @@ module.exports = ({ watch = false, standalone = false, chineseVersion = false, w
|
|||||||
type: "javascript/auto",
|
type: "javascript/auto",
|
||||||
},
|
},
|
||||||
{ test: /\.(png|jpe?g|svg)$/, loader: "ignore-loader" },
|
{ test: /\.(png|jpe?g|svg)$/, loader: "ignore-loader" },
|
||||||
|
{ test: /\.nobuild/, loader: "ignore-loader" },
|
||||||
{
|
{
|
||||||
test: /\.md$/,
|
test: /\.md$/,
|
||||||
use: [
|
use: [
|
||||||
|
|||||||
@ -177,6 +177,7 @@ module.exports = ({
|
|||||||
type: "javascript/auto",
|
type: "javascript/auto",
|
||||||
},
|
},
|
||||||
{ test: /\.(png|jpe?g|svg)$/, loader: "ignore-loader" },
|
{ test: /\.(png|jpe?g|svg)$/, loader: "ignore-loader" },
|
||||||
|
{ test: /\.nobuild/, loader: "ignore-loader" },
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
enforce: "pre",
|
enforce: "pre",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
/* typehints:start */
|
/* typehints:start */
|
||||||
import { ModLoader } from "./modloader";
|
import { ModLoader } from "./modloader";
|
||||||
|
import { Component } from "../game/component";
|
||||||
import { MetaBuilding } from "../game/meta_building";
|
import { MetaBuilding } from "../game/meta_building";
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ import { Loader } from "../core/loader";
|
|||||||
import { LANGUAGES } from "../languages";
|
import { LANGUAGES } from "../languages";
|
||||||
import { matchDataRecursive, T } from "../translations";
|
import { matchDataRecursive, T } from "../translations";
|
||||||
import { gBuildingVariants, registerBuildingVariant } from "../game/building_codes";
|
import { gBuildingVariants, registerBuildingVariant } from "../game/building_codes";
|
||||||
import { gMetaBuildingRegistry } from "../core/global_registries";
|
import { gComponentRegistry, gMetaBuildingRegistry } from "../core/global_registries";
|
||||||
import { MODS_ADDITIONAL_SHAPE_MAP_WEIGHTS } from "../game/map_chunk";
|
import { MODS_ADDITIONAL_SHAPE_MAP_WEIGHTS } from "../game/map_chunk";
|
||||||
|
|
||||||
const LOG = createLogger("mod-interface");
|
const LOG = createLogger("mod-interface");
|
||||||
@ -106,6 +107,14 @@ export class ModInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {typeof Component} component
|
||||||
|
*/
|
||||||
|
registerComponent(component) {
|
||||||
|
gComponentRegistry.register(component);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
|
|||||||
@ -41,8 +41,12 @@ export class ModLoader {
|
|||||||
if (G_IS_STANDALONE) {
|
if (G_IS_STANDALONE) {
|
||||||
mods = await getIPCRenderer().invoke("get-mods");
|
mods = await getIPCRenderer().invoke("get-mods");
|
||||||
} else if (G_IS_DEV && globalConfig.debug.loadDevMod) {
|
} else if (G_IS_DEV && globalConfig.debug.loadDevMod) {
|
||||||
// @ts-expect-error
|
const mod = await (
|
||||||
mods = [require("!!raw-loader!./dev_mod")];
|
await fetch("http://localhost:3005/mods/demo_mod.nobuild/index.js", {
|
||||||
|
method: "GET",
|
||||||
|
})
|
||||||
|
).text();
|
||||||
|
mods.push(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
mods.forEach(modCode => {
|
mods.forEach(modCode => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user