You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tobspr_shapez.io/mod_examples/pasting.js

24 lines
644 B

// @ts-nocheck
const METADATA = {
website: "https://tobspr.io",
author: "tobspr",
name: "Mod Example: Pasting",
version: "1",
id: "pasting",
description: "Shows how to properly receive paste events ingame",
minimumGameVersion: ">=1.5.0",
};
class Mod extends shapez.Mod {
init() {
this.signals.gameInitialized.add(root => {
root.gameState.inputReciever.paste.add(event => {
event.preventDefault();
const data = event.clipboardData.getData("text");
this.dialogs.showInfo("Pasted", `You pasted: '${data}'`);
});
});
}
}