Jump to content




Slot control for turtle.suck when used on inventories


6 replies to this topic

#1 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 15 August 2016 - 10:26 PM

The current methods which turtles have to manipulate inventories are more than a bit lacking when the inventory has multiple slots accessible from the current side (chests are a good example in contrast to furnaces).

It would be very useful for turtles to be able to take and place items into chests and decide the slot to interact with rather than being limited to the first slot which can fulfil the requested command.

Proposed added functionality (keeping the default suck and drop functions for compatibility and if the programmer doesn't need the new functionality).
turtle.precisionSuck(slotNum, [item count]) --#with up and down variants like turtle.suck
turtle.precisionDrop(slotNum, [item count]) --#with up and down variants like turtle.drop

Edited by Lupus590, 15 August 2016 - 10:26 PM.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 15 August 2016 - 11:06 PM

What would be the behavior if the number of items requested does not fit in the slot. For example, say slot 1 has 63 dirt. If you attempt to suck 2 dirt items into slot 1, would it overflow as turtle.suck already does?

If this is the case, since turtle.suck attempts to add the items to the currently selected slot, turtle.precisionSuck is already codable:

function turtle.precisionSuck( slotNum, itemCount )
  local oldSlot = turtle.getSelectedSlot()
  turtle.select( slotNum )
  return turtle.suck( itemCount ), turtle.select( oldSlot )
end


#3 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 15 August 2016 - 11:20 PM

You have this the wrong way round, perhaps my explanation was poor, I want to be able to suck the chest's second/fifth/Nth slot into whichever slot I have selected in the turtle (and vice versa for drop)

I also realise that some useful functions to compliment this may be functions which allow the turtle to tell how many slots there are and to inspect the slots. As well as other functions which turtles already have with their built in inventories.

Think OpenPeripherals chest peripheral.

Edited by Lupus590, 15 August 2016 - 11:38 PM.


#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 15 August 2016 - 11:30 PM

Oh, yeah that would be very helpful indeed. You can workaround but it's a pain.

#5 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 11 May 2017 - 06:47 AM

i thought this is the case... So my next projekt, the storage room with CC, has failed before it started...

#6 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 11 May 2017 - 07:57 AM

View PostJummit, on 11 May 2017 - 06:47 AM, said:

i thought this is the case... So my next projekt, the storage room with CC, has failed before it started...

CC is opensource now, so the functionality may get added. (I do plan on learning java and having a go at implementing this and other suggestions once I'm done with my university stuff)

#7 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 14 May 2017 - 10:56 AM

Cool! I cant wait to see the new cheap storage solutions! :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users