PrismarineJS / mineflayer-navigate

mineflayer plugin which gives bots a high level 3d navigating API using A*
59 stars 22 forks source link

Sugar for queuing #8

Closed yocontra closed 11 years ago

yocontra commented 11 years ago

Is it possible to get some sugar for chaining navigation requests? Maybe this belongs in the main repo but I want to be able to define a structure as a JSON document and have the bot build it step by step - this is possible right now but you end up in callback hell. Would be nice to have something like

var script = mineflayer.script()
  .walkTo(x,y)
  .dig(someBlock)
  .walkTo(x,y)
  .placeBlock(refBlock);

bot.runScript(script);

If it is out of the scope of the library I'd be happy to make it myself as a standlone - turning an async API into a queued chaining API is pretty simple to do these days. Just curious what your thoughts are about this - would be cool to eventually make some kind of a platform for kids to learn programming by writing minecraft scripts

andrewrk commented 11 years ago

Yep - cool idea, out of scope. You could pretty easily follow the plugin pattern of this module to build the "mineflayer-script" API yourself if you're interested. I'd link to it in mineflayer's readme.

rom1504 commented 11 years ago

Contra, I'm doing things a bit like what you want to do in https://github.com/rom1504/rbot . The code isn't very clean right now (I'm trying to get it better) but some things work so maybe you'd like to look at it.