From bd15a4132abb726eef666562c09221d9e2b56f08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9tro?= <yann.roberge@polymtl.ca>
Date: Mon, 12 Oct 2020 22:33:18 -0400
Subject: [PATCH] Ajuster l'inventaire pour utiliser plus de 64 blocs

---
 carreler.lua | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/carreler.lua b/carreler.lua
index 5a79782..b552591 100644
--- a/carreler.lua
+++ b/carreler.lua
@@ -33,12 +33,33 @@ end
 function carrelerLigne(m)
     for i=1,(m-1),1
     do
-        turtle.placeDown()
+        placerSous()
         turtle.forward()
     end
+    placerSous()
+end
+
+function placerSous()
+    replacerInventaire()
     turtle.placeDown()
 end
 
+function replacerInventaire()
+    slot = turtle.getSelectedSlot()
+    -- taille de l'inventaire d'une tortue: 16
+    while slot < 16
+    do
+        if ( turtle.getItemCount() == 0 )
+        then
+            slot = slot + 1
+            turtle.select(slot)
+        else
+            return true
+        end
+    end
+    return false
+end
+
 -- Lancer le programme
 main()
 
-- 
GitLab