mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-13 10:11:50 +00:00
Add sandbox example
This commit is contained in:
parent
1287bc9bf1
commit
ade7176dba
@ -41,6 +41,7 @@ To get into shapez.io modding, I highly recommend checking out all of the exampl
|
||||
| [modify_existing_building.js](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](modify_ui.js) | Shows how to add custom IU elements to builtin game states (the Main Menu in this case) | Extending builtin UI states, Adding CSS |
|
||||
| [pasting.js](pasting.js) | Shows a dialog when pasting text in the game | Listening to paste events |
|
||||
| [sandbox.js](sandbox.js) | Makes blueprints free and always unlocked | Overriding builtin methods |
|
||||
|
||||
### Advanced Examples
|
||||
|
||||
|
||||
21
mod_examples/sandbox.js
Normal file
21
mod_examples/sandbox.js
Normal file
@ -0,0 +1,21 @@
|
||||
// @ts-nocheck
|
||||
const METADATA = {
|
||||
website: "https://tobspr.io",
|
||||
author: "tobspr",
|
||||
name: "Sandbox",
|
||||
version: "1",
|
||||
id: "sandbox",
|
||||
description: "Blueprints are always unlocked and cost no money, also all buildings are unlocked",
|
||||
minimumGameVersion: "^1.5.0",
|
||||
};
|
||||
|
||||
class Mod extends shapez.Mod {
|
||||
init() {
|
||||
this.modInterface.replaceMethod(shapez.Blueprint, "getCost", function () {
|
||||
return 0;
|
||||
});
|
||||
this.modInterface.replaceMethod(shapez.HubGoals, "isRewardUnlocked", function () {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user