Insert Tools
Estimated reading time: 3 minutesModLoader’s Insert Tools are Node.js scripts for Mod packaging, ModLoader injection, and SC2 engine replacement. After building ModLoader, they live under dist-insertTools/.
Tool List
insert2html.js
Injects ModLoader into game HTML and embeds Mods listed in modList.json as local type.
Usage
Arguments
Example
Output
Creates a .mod.html file next to the source HTML, e.g.:
packModZip.js
Packages a Mod directory into .mod.zip based on boot.json.
Usage
Arguments
Example
Output
Creates {ModName}.mod.zip in the same directory as boot.json. Mod name comes from boot.json name.
Validation
packModZip runs validateBootJson and checks boot.json format and that referenced files exist.
sc2ReplaceTool.js
Replaces the SC2 engine (format.js) in compiled game HTML without recompiling the game.
Usage
Arguments
Example
Output
Creates a file with .sc2replace.html suffix:
Typical Flow
- Use sc2ReplaceTool to replace the engine
- Use insert2html to inject ModLoader into the result
sc2PatchTool.js
Applies the SC2 bootstrap patch to game HTML. Use when the game HTML does not yet have the SC2 changes ModLoader needs, instead of replacing the whole format.js.
Use sc2PatchTool or sc2ReplaceTool depending on your workflow. Usually, either build the game with the modified SC2 engine or replace format.js with sc2ReplaceTool.
Docker Packaging
Without Node.js, use Docker to run packModZip:
Run in the boot.json directory; output is a zip in the current directory.
