-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turtles should be able to detect Equipped Pickaxes #964
Comments
I'm curious as to what you need this for? Is this just to ensure that the turtle has a valid tool? I'm not opposed to this in principle, but I do want to ensure people don't end up writing code like |
Im working on a Turtle Command and control System that assigns Turtles jobs, and one of those jobs will be mining, it would be nice to be able to quickly verify that the turtle has a digging tool equipped. i don't need to explicitly detect if it has a Diamond Pick i was just wanting an easy wait to see if the turtle can dig with out 1. accidently breaking a important block by calling turtle.dig() and checking the results or 2. unequipping checking inventory, and reequipping. |
Maybe Something like this may be: {
type = "pickaxe",
miningLevel = 5
} Also, currently one could check that |
That would work and it gives more info on what's equipped and its ability. Also, I was under the impression that turtle.dig was always defined. as far as i know it returns false and a string on why it failed to dig, such as No tool, No block, or unbreakable block, or true when it does break. |
As alternative instead of adding new functions how about making tools and crafting table report their existence as peripherals? They would be stub peripherals without any methods but having tools report at This would also get around the |
Turtles can have a block peripheral (e.g. disk drive, chest) and tool upgrade (pick, sword) at the same time, so creating phantom peripherals doesn't feel very nice. |
That was my original suggestion that they report back with the find function. Either way works, i just think that there needs to be some way for it to be known to the turtle. Also crafting tables report under the workbench peripheral |
If tools do become full peripherals then being able to interrogate their mining level would be nice and help justify their classification as a peripheral. I'm now trying to think of some other peripheral/peripheral-like methods that could be placed on tools. Maybe the ability to strip logs with axes via a peripheral method. Making paths with shovels, which turtle might already be able to do from a block away. Using a hoe to till farmland, which I already know that turtles can do by digging one block away. |
The only issue with making them peripherals is it would completely break compatibly with almost every turtle script since digging would become a peripheral call instead of a turtle call. we would have to make turtle.dig use the pickaxe peripheral which i imagine isnt impossible but may be annoying idk im lua newbie |
|
If the hand is (hands are) a peripheral, the turtle can call it's dig function which would left-click the item it contains. advanced programs could query the item stack. The last problem would be querying the tool capabilities ["pickaxe", "shovel", …] and maybe a convenience function hasCapability("pickaxe"). |
Advanced peripherals has digBlock(). You can use labels for identification and also everything mentioned can be coded. |
Turtles currently have no way of know if they have pickaxe equipped.
My current workaround is unequipping and detecting if anything appeared in the turtles inventory
It would be nice if turtles, could use the peripheral.Find to detect if theres a pickaxe.
would save me like 2 headaches.
The text was updated successfully, but these errors were encountered: