mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
33 lines
929 B
JavaScript
33 lines
929 B
JavaScript
|
// @ts-nocheck
|
||
|
const METADATA = {
|
||
|
website: "https://tobspr.io",
|
||
|
author: "tobspr",
|
||
|
name: "Mod Example: Custom Keybindings",
|
||
|
version: "1",
|
||
|
id: "base",
|
||
|
description: "Shows how to add a new keybinding",
|
||
|
minimumGameVersion: ">=1.5.0",
|
||
|
|
||
|
// You can specify this parameter if savegames will still work
|
||
|
// after your mod has been uninstalled
|
||
|
doesNotAffectSavegame: true,
|
||
|
};
|
||
|
|
||
|
class Mod extends shapez.Mod {
|
||
|
init() {
|
||
|
// Register keybinding
|
||
|
this.modInterface.registerIngameKeybinding({
|
||
|
id: "demo_mod_binding",
|
||
|
keyCode: shapez.keyToKeyCode("F"),
|
||
|
translation: "Do something (always with SHIFT)",
|
||
|
modifiers: {
|
||
|
shift: true,
|
||
|
},
|
||
|
handler: root => {
|
||
|
this.dialogs.showInfo("Mod Message", "It worked!");
|
||
|
return shapez.STOP_PROPAGATION;
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
}
|