1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00
tobspr_shapez.io/mod_examples/README.md
DJ1TJOO 9cb3e0c398 Squashed commit of the following:
commit ea2f32b3ff
Author: tobspr <tobias.springer1@googlemail.com>
Date:   Tue Feb 15 09:09:30 2022 +0100

    Fix examples

commit 561318b7db
Author: Dimava <dimava2@ya.ru>
Date:   Tue Feb 15 10:31:47 2022 +0300

    mark all abstract functions abstract (#1383)

commit 81d65e5801
Author: WaffleDevsAlt <81845843+WaffleDevsAlt@users.noreply.github.com>
Date:   Tue Feb 15 02:31:02 2022 -0500

    Removes unwanted ], (#1384)

    The ], breaks build, with a core error

commit 4f0af32a5e
Author: Ved_s <53968411+Ved-s@users.noreply.github.com>
Date:   Mon Feb 14 07:14:34 2022 +1100

    Update base-ru.yaml (#1312)

    * Update base-ru.yaml

    I think other's comments about the game should stay in English, as Russian translation cannot precisely describe this

    * Update base-ru.yaml

commit 3f3a2e0981
Author: Daan Breur <git@daanbreur.systems>
Date:   Sun Feb 13 21:11:52 2022 +0100

    NL Translations for Mods and puzzleDLC (#1381)

    * [NL] Mods and puzzleDLC

    * Update base-nl.yaml

    * Update base-nl.yaml

commit c4f26320a4
Author: dobidon <35607008+dobidon@users.noreply.github.com>
Date:   Sun Feb 13 23:11:38 2022 +0300

    Translating new keys (#1380)

commit cb5c3f798a
Author: Pimak <37274338+Pimak@users.noreply.github.com>
Date:   Sun Feb 13 21:11:16 2022 +0100

    Update base-fr.yaml for mods translation (#1377)

commit dee4f23b7e
Author: Sense101 <67970865+Sense101@users.noreply.github.com>
Date:   Sun Feb 13 20:11:02 2022 +0000

    Fix method for adding variants to an existing building (#1378)

commit b7bc2ac1b7
Author: jbelbaz <32191774+jbelbaz@users.noreply.github.com>
Date:   Sun Feb 13 21:10:11 2022 +0100

    Update base-fr.yaml (#1328)

    Change of a few lines in English. I was unable to verify in-game integration ... I hope my work will fit.
    glad to help :D

commit 93b9340ab7
Author: Pimak <37274338+Pimak@users.noreply.github.com>
Date:   Sun Feb 13 21:09:56 2022 +0100

    Update README.md (#1376)

    Small mistake

commit f534a88f80
Author: Bagel03 <70449196+Bagel03@users.noreply.github.com>
Date:   Sun Feb 13 15:09:41 2022 -0500

    Fix that whole export debacle (#1370)

    * Re-add setting exports

    * Update webpack.production.config.js

    * Update mod.js

    * Slight change

    * Update mod.js

    * Update webpack.production.config.js

    * Update webpack.config.js

commit dab4aa9cda
Author: Emerald Block <69981203+EmeraldBlock@users.noreply.github.com>
Date:   Sun Feb 13 14:07:02 2022 -0600

    fix fs-job sanitization (#1375)

commit 4466821557
Author: Thomas (DJ1TJOO) <44841260+DJ1TJOO@users.noreply.github.com>
Date:   Sun Feb 13 21:06:42 2022 +0100

    Added display hook for getting the signelton and the drawing (#1374)

commit 65ae26cb53
Author: Thomas (DJ1TJOO) <44841260+DJ1TJOO@users.noreply.github.com>
Date:   Sun Feb 13 21:06:24 2022 +0100

    Added hook for storage can accept item (#1373)

    * Added hook for storage can accept item

    * Fixed order

commit e5742fd577
Author: Thomas (DJ1TJOO) <44841260+DJ1TJOO@users.noreply.github.com>
Date:   Sun Feb 13 21:06:10 2022 +0100

    Added constant signal resolver hook (#1372)

    * Added constant signal resolver hook

    * Added apply

commit 41c6b1c595
Author: Thomas (DJ1TJOO) <44841260+DJ1TJOO@users.noreply.github.com>
Date:   Sun Feb 13 21:05:58 2022 +0100

    Added mod processing requirements (#1371)

    * Added mod processing requirements

    * Added missing bind

    * Renamed to mods
2022-02-15 12:02:00 +01:00

8.9 KiB

shapez.io Modding

General Instructions

Currently there are two options to develop mods for shapez.io:

  1. Writing single file mods, which doesn't require any additional tools and can be loaded directly in the game
  2. Using the create-shapezio-mod package. This package is still in development but allows you to pack multiple files and images into a single mod file, so you don't have to base64 encode your images etc.

Mod Developer Discord

A great place to get help with mod development is the official shapez.io modloader discord.

Setting up your development environment

The simplest way of developing mods is by just creating a mymod.js file and putting it in the mods/ folder of the standalone (You can find the mods/ folder by clicking "Open Mods Folder" in the shapez.io Standalone, be sure to select the 1.5.0-modloader branch on Steam).

You can then add --dev to the launch options on Steam. This adds an application menu where you can click "Restart" to reload your mod, and will also show the developer console where you can see any potential errors.

Getting started

To get into shapez.io modding, I highly recommend checking out all of the examples in this folder. Here's a list of examples and what features of the modloader they show:

Example Description Demonstrates
base.js The most basic mod Base structure of a mod
class_extensions.js Shows how to extend multiple methods of one class at once, useful for overriding a lot of methods Overriding and extending builtin methods
custom_css.js Modifies the Main Menu State look Modifying the UI styles with CSS
replace_builtin_sprites.js Replaces all color sprites with icons Replacing builtin sprites
translations.js Shows how to replace and add new translations in multiple languages Adding and replacing translations
add_building_basic.js Shows how to add a new building Registering a new building
add_building_flipper.js Adds a "flipper" building which mirrors shapes from top to bottom Registering a new building, Adding a custom shape and item processing operation (flip)
custom_drawing.js Displays a a small indicator on every item processing building whether it is currently working Adding a new GameSystem and drawing overlays
custom_keybinding.js Adds a new customizable ingame keybinding (Shift+F) Adding a new keybinding
custom_sub_shapes.js Adds a new type of sub-shape (Line) Adding a new sub shape and drawing it, making it spawn on the map, modifying the builtin levels
modify_theme.js Modifies the default game themes Modifying the builtin themes
custom_theme.js Adds a new UI and map theme Adding a new game theme
mod_settings.js Shows a dialog counting how often the mod has been launched Reading and storing mod settings
storing_data_in_savegame.js Shows how to store custom (structured) data in the savegame Storing custom data in savegame
modify_existing_building.js Makes the rotator building always unlocked and adds a new statistic to the building panel Modifying a builtin building, replacing builtin methods
modify_ui.js Shows how to add custom UI elements to builtin game states (the Main Menu in this case) Extending builtin UI states, Adding CSS
pasting.js Shows a dialog when pasting text in the game Listening to paste events
sandbox.js Makes blueprints free and always unlocked Overriding builtin methods

Advanced Examples

Example Description Demonstrates
notification_blocks.js Adds a notification block building, which shows a user defined notification when receiving a truthy signal Adding a new Component, Adding a new GameSystem, Working with wire networks, Adding a new building, Adding a new HUD part, Using Input Dialogs, Adding Translations
usage_statistics.js Displays a percentage on every building showing its utilization Adding a new component, Adding a new GameSystem, Drawing within a GameSystem, Modifying builtin buildings, Adding custom game logic
new_item_type.js Adds a new type of items to the map (fluids) Adding a new item type, modifying map generation
buildings_have_cost.js Adds a new currency, and belts cost 1 of that currency Extending and replacing builtin methods, Adding CSS and custom sprites
mirrored_cutter.js Adds a mirorred variant of the cutter Adding a new variant to existing buildings

Creating new sprites

If you want to add new buildings and create sprites for them, you can download the original Photoshop PSD files here: https://static.shapez.io/building-psds.zip