summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2020-07-30 00:40:41 +0000
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2020-07-30 00:40:41 +0000
commit34cb0e768202d29a26af127b2cb0c47180714c84 (patch)
treed3cb0ea7b35706532f2e0b3d29a8bc67e46711bd
parentcb58a646cfbb4f6dadb5bd17db4f63ef889d85a8 (diff)
parent505fc7cc49dcdf6195c7435ed3d989cc09953206 (diff)
downloadpipeworks-34cb0e768202d29a26af127b2cb0c47180714c84.tar
pipeworks-34cb0e768202d29a26af127b2cb0c47180714c84.tar.gz
pipeworks-34cb0e768202d29a26af127b2cb0c47180714c84.tar.bz2
pipeworks-34cb0e768202d29a26af127b2cb0c47180714c84.tar.xz
pipeworks-34cb0e768202d29a26af127b2cb0c47180714c84.zip
Merge branch 'master' into 'master'
Add "get_recipe" digiline command for querying the current autocrafter recipe. See merge request VanessaE/pipeworks!23
-rw-r--r--autocrafter.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/autocrafter.lua b/autocrafter.lua
index db23a14..825b248 100644
--- a/autocrafter.lua
+++ b/autocrafter.lua
@@ -389,6 +389,27 @@ minetest.register_node("pipeworks:autocrafter", {
end
end
after_recipe_change(pos,inv)
+ elseif msg == "get_recipe" then
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ local recipe = {}
+ for y=0,2,1 do
+ local row = {}
+ for x=1,3,1 do
+ local slot = y*3+x
+ table.insert(row, inv:get_stack("recipe",slot):get_name())
+ end
+ table.insert(recipe, row)
+ end
+ local setchan = meta:get_string("channel")
+ local output = inv:get_stack("output", 1)
+ digiline:receptor_send(pos, digiline.rules.default, setchan, {
+ recipe = recipe,
+ result = {
+ name = output:get_name(),
+ count = output:get_count(),
+ }
+ })
elseif msg == "off" then
update_meta(meta, false)
minetest.get_node_timer(pos):stop()