2 posts
Posted 27 October 2012 - 09:25 PM
Can you add something so that Inventory slots on a turtle could be locked to only accept one item.
Locked Slots have the following features:
-when a turtle sucks items into it, the locked slot gets a priority so it will try to fill the locked slot with that item before it uses an unlocked slot.
-locked slots can be used with turtle.compare() even if they have no items in them.
-If a turtle tries to suck an item, but all slots are locked and it cannot accept the item, then the item will remain on the ground/in the chest.
-Locked slots will stay on the turtle after being broken.
Turtles can use lock slots like this:
turtle.lockSlot([slot #]) - locks the slot to whatever item is in that slot
turtle.lockSlotFront() - locks the current slot to the block in front of it
turtle.lockSlotUp() - same as lockSlotFront except it does the block above it
turtle.lockSlotDown() - same as lockSlotFront except it does the block below it
turtle.unlockSlot([slot #]) - unlocks a slot for any item to use
[Uses]
-Lock the coal block to an inventory space. (then you can use turtle.compare())
-Lock a crop block to an inventory space. (Now your turtle can tell when a crop is done growing or not)
edit: I'm not sure how turtle.suck() works on chests, but it would be awesome if they skipped the items it cant suck and kept going until it found something it could suck or it does not and it fails.
1548 posts
Location
That dark shadow under your bed...
Posted 27 October 2012 - 09:35 PM
When I first started reading this I didn't think much of it (can code to semi-lock slots) but I have to admit it actually sounds quite cool
2 posts
Posted 27 October 2012 - 10:15 PM
Yes we can code to semi-lock something, but heres something else you can use it for:
If you have a crop and you want the turtle to know when its done growing. You can lock an inventory space to the final growth stage with turtle.lockSlotFront(). Now your turtle can look over you farms.
or what about sugar cane? It drops a sugar cane item, not the sugar cane block.
2005 posts
Posted 27 October 2012 - 10:58 PM
Hmm…I think that semi-locking is good enough for most of this. But it would be nice if turtle.compare would result in true when you had the item (or block) a block will drop rather than the actual block. Not sure how much harder that would be, since I guess that compares now (secretly) use the block IDs for comparison.
I prefer it because it's more transparent on the user side. But envisioning the code that it would take, it might be clunky and ugly compared to allowing a slot to store an ID even without having the block there, unless you can grab the drop ID off of a block (can you?). Then again, you can get most (admittedly not all) actual blocks by using a silk touch tool, making detection of those kinds of blocks appropriately difficult but not impossible (let's face it, it makes sense for there to be more difficulty matching a material friable or variable enough to drop something other than itself when mined).
And you can already successfully farm sugarcane by just leaving the bottom intact, and wheat by using bonemeal.
So…mixed feelings. If it would be easy and elegant to make compare match the drop rather than the actual block ID in front, I'm up with it. On the other hand, it does make sense for a turtle to not have the sensitivity to tell the difference between a mature plant and a green one, or to not recognize stone as being identical to cobblestone.
724 posts
Posted 28 October 2012 - 06:13 AM
Drop from blocks and mobs is random, but suggestion is not about comparing to drop.
It is interesting, can be useful. May be empty slots should be locked for nothing. Doubt it will be implemented.
2005 posts
Posted 28 October 2012 - 06:46 AM
Wait, how can the drop from blocks be random? I mean, the count is variable but blocks always drop the same things, right? Oh well, if it can't be done it can't be done. I just thought it would be a nice way to make turtle.compare do the stuff that is being desired here.
I have mixed feelings, but if it's a pain to code then I'd rather the CC team worked on things I really unambiguously want.
2447 posts
Posted 28 October 2012 - 11:05 AM
Wait, how can the drop from blocks be random? I mean, the count is variable but blocks always drop the same things, right? Oh well, if it can't be done it can't be done. I just thought it would be a nice way to make turtle.compare do the stuff that is being desired here.
I have mixed feelings, but if it's a pain to code then I'd rather the CC team worked on things I really unambiguously want.
Have you tried digging gravel? Sometimes it is gravel, sometimes it is flint.
2005 posts
Posted 28 October 2012 - 11:50 AM
Oh, forgot about that. Yeah, if it's not easy to compare if the item in the slot is a drop from the block, then I'm pretty much leaning towards keeping the entire scheme the way it is now. It only makes sense that a turtle would have difficulty sensing things that are very fragile or can't be kept in their "natural" state in the inventory.
2447 posts
Posted 28 October 2012 - 01:52 PM
Compare will be changing in a future version once I've finalized a forge addition I'm working on. Basically, if an item can be used to place an object, you should be able to use it to compare. It will use the same logic as middle clicking does.
1548 posts
Location
That dark shadow under your bed...
Posted 28 October 2012 - 02:40 PM
Oh yeah! that'll be great. grand plan man
2005 posts
Posted 28 October 2012 - 06:23 PM
Yay! That's better than checking the item drops, more in keeping (and it was a little weird that you couldn't compare lava or water). Still doesn't help wheat farmers, but then that's fairly realistic.