growtopia.js
v1.3.5
Published
A package to create a growtopia private servers.
Downloads
231
Readme
Growtopia.js
A fork of GrowSockets to create a growtopia private servers.
Features
- Stable
- Plugins system
- Built-in ItemsDat tools & Web server
Requirements
- Node.js v16+ (No need to build from source)
Installation
npm i growtopia.js
Example
const { Client, TextPacket, Peer } = require("growtopia.js");
const client = new Client();
client.on("ready", () => {
console.log(
`ENet server: port ${client.config.enet.port} on ${client.config.enet.ip}\nHttps server: port ${client.config.https.port} on ${client.config.https.ip}`
);
});
client.on("error", (err) => {
console.log("Something wrong", err);
});
client.on("connect", (netID) => {
console.log(`Connected netID ${netID}`);
const peer = new Peer(client, netID);
peer.send(TextPacket.from(0x1));
});
client.on("disconnect", (netID) => {
console.log(`Disconnected netID ${netID}`);
});
client.on("raw", (netID, data) => {
console.log("raw", data);
});
client.on("action", (peer, data) => {
console.log(`Peer (${peer.data.netID}) action`, { data });
if (data.action === "quit") {
peer.disconnect();
}
});
client.on("tank", (peer, tank) => {
console.log(`Peer (${peer.data.netID}) tank`, { tank });
});
client.on("text", (peer, data) => {
console.log(peer.ping);
console.log(`Peer (${peer.data.netID}) text`, { data });
});
client.listen();
Plugins
To create your own plugin, take a look here
A example adding plugin to your server:
const client = new Client({
// Add a plugin here
plugins: [new IModule(), new WorldGen()]
});
Plugins list
Open a PR to add your plugin here
| Name | Link | Description | | ---------- | -------------------------------------------------------------------------------- | --------------------------- | | HelloWorld | Github | Test sending hello world :D |
Building
Requirements
- C++ Build Tools (Linux: build-essential)
- Python (Recommeded v3.11)
npm i growtopia.js --build-from-source
Links
Credits
Give a thumbs to these cool people
- Syn9673 - with his GrowSockets.