Page 1 of 1

[Mod] Replicator [replicator]

PostPosted: Thu Jun 12, 2014 12:20
by redyeti
Hello everyone,

this mod adds a Replicator, a device similar to the Autocrafter from Pipeworks. (Actually, its code is based on it.)

Just as the Autocrafter, the Replicator will use the world's recipes to automatically craft items. However, while the Autocrafter needs to be told the exact recipe, the Replicator just has to know what you want it to craft. It will then try all existing recipes to build the requested item.

Image

Usage and complete documentation: https://github.com/redyeti/minetest-replicator/blob/master/README.md

Dependencies: Pipeworks, Mesecons

License: WTFPL (applies to all parts)

Download: https://github.com/redyeti/minetest-replicator/archive/master.zip
...or browse the code: https://github.com/redyeti/minetest-replicator

Install: Download and unzip the above file, rename minetest-replicator-master to just "replicator" and move it into Minetest's mods directory.

Re: [Mod] Replicator [replicator]

PostPosted: Thu Jun 12, 2014 12:50
by Mitroman
Cool mod. I'll download it soon ;)

Re: [Mod] Replicator [replicator]

PostPosted: Thu Jun 12, 2014 14:18
by philipbenr
There is a "replicator" already in the castles mod, and I always wondered how Dan made it. I suppose that I'll take a look at yours... Anyhow, the one used in the castles mod has no dependencies.

Re: [Mod] Replicator [replicator]

PostPosted: Fri Jun 13, 2014 12:55
by Krock
Hmm does this use much ABM/CPU power?
Going through every recipe might be laggy.

Re: [Mod] Replicator [replicator]

PostPosted: Fri Jun 13, 2014 13:41
by redyeti
Krock wrote:Hmm does this use much ABM/CPU power?
Going through every recipe might be laggy.


The mod uses the APIs minetest.get_all_craft_recipes(query item) function. It returns all the recipes which can be used to craft an item. As far as I know, for most items, the number of recipes returned is 1, sometimes 3 or 4 ... so there are not much recipes to go through within the lua code of this mod.

So, I guess, the answer mainly depends on whether the get_all_craft_recipes API function runs efficiently …