mindustry
v0.2.4
Published
headless mindustry!
Downloads
23
Readme
headless!
How to use
join game
var {NetClient}=require("mindustry");
var c=new NetClient();
c.on("connect",()=>{
c.join("username","AAAAAAAAAAA=","AAAAAAAAAAA=");//name,uuid,usid
c.connectConfirm();
c.sendChatMessage("Hello, world!")
});
c.on("SendMessageCallPacket2",p=>{
console.log(p.message)
})
c.connect(3000,"130.61.78.82")//port,ip
join game and get map png
var {Mindustry}=require("mindustry");
var c=new Mindustry();
c.netClient.on("connect",()=>{
c.netClient.join("username","AAAAAAAAAAA=","AAAAAAAAAAA=");
c.events.on("WorldLoadEvent",()=>{
require("fs").writeFileSync("./map.png",c.world.toPNG())
})
});
c.netClient.on("SendMessageCallPacket2",p=>{
console.log(p.message)
})
c.netClient.connect(3000,"130.61.78.82")
get server info
require("mindustry").pingHost(3000,"130.61.78.82",(data,err)=>{//port,ip,callback
if(err){
console.error(err.stack)
} else {
console.log(JSON.stringify(data))
}
})