SquidDev-CC / plethora

A peripheral provider for ComputerCraft
https://plethora.madefor.cc/
MIT License
56 stars 23 forks source link

Arbitrary Tools #149

Closed shelbykauth closed 5 years ago

shelbykauth commented 5 years ago

So... I remember some CC addon at some point in time allowed you to put arbitrary tools on a turtle. There's actually a big discussion of it at this link: http://www.computercraft.info/forums2/index.php?/topic/20101-tool-durability-and-turtles/

That was from four years ago. The CC1.6 update allowed swapping of tools, which was the first step forward with it. I'm kinda surprised it hasn't been followed up yet. I'm asking this here instead of CC:Tweaked because even though I personally think it should be included in the ComputerCraft core, the addon I'm remembering was named something to do with peripherals, and it is specifically related to what peripherals a turtle can use, much like the ability to access inventories in a fast and meaningful way (a feature which I definitely think should be in the core).

I know I've been asking a lot of you, and I know you do this for free. And maybe a lot of what I'm asking has a lot of specific-to-me purposes. Please tell me if I'm asking too much. My specific idea currently is I want to do the Computer Craft Challenge, where you start with a turtle, a little bit of fuel, and a tool, and then everything else must be done through CC interfaces. Like you're not allowed to place or break anything yourself. I think it would be really cool to start the challenge with a wooden axe, with durability, instead of a diamond pickaxe. Because you can't get diamonds without a diamond pickaxe. I also want to use Tinkers Construct, like a lot, and want to actually have a purpose for TConstruct tools in the CC Challenge. (My bare-bones modpack contains CCTweaked, Plethora, and Tinkers Construct.)

I know a lot of tool mechanics have to be overhauled for this to work. Number one, the dig/attack method is a bit weird. Both use the left click action and neither uses the right click action. To shear a sheep, you attack. I can't get the turtle to collect leaves with a shear. I personally don't think the pickaxe should be able to break wood. I like the idea of the turtle's tools losing durability, on config basis like using fuel. I, again, don't know how this works under the hood. In theory, you should be able to use whatever left click and right click call to in order to do the thing. And if there's a right-click tool on both sides, use whatever logic the game uses when a player has those items in off-hand and selected slots. But I don't know if the mods are that cohesive or not. Like... Ideally it would be so cohesive that you could equip a bucket or a bottle or a Forstry pipette or Binnie's Mod drink glass and fill and empty them from tanks or sources. But I know it's not an ideal world.

But yeah. It would be really amazing if we could get arbitrary tools on turtles.

SquidDev commented 5 years ago

I know I've been asking a lot of you, and I know you do this for free. And maybe a lot of what I'm asking has a lot of specific-to-me purposes. Please tell me if I'm asking too much.

Absolutely not! Most of the cool features in this mod have come from other people's suggestions, so I absolutely welcome any feedback! I'm insanely grateful for it, as well as the additional effort you put into them - it's really useful to have that extra description + rationale.

But yeah. It would be really amazing if we could get arbitrary tools on turtles.

It's not documented right now (sorry!), but the kinetic augment can be used in turtles. This makes turtle.dig and turtle.swing use the currently selected item, just like turtle.place does.

This really doesn't do much beyond "swinging" the item at the block/entity, which means it a) consumes durability and b) isn't guaranteed to break the block on the first try. You'll have to do something like while turtle.detect() do turtle.dig() end. I think this is a fair compromise for being able to use any tool, though any ways of making this better are welcome!

You can also wrap the augment as a peripheral which provides use and swing and use methods. These allow you to right and left click respectively with the item. This should be enough to sheer sheep (and leaves).

I haven't tested right clicking to transfer fluids, but it should work. Minecraft's buckets are a little funky, but our logic is almost identical to a player's, so you should be OK.

I personally don't think the pickaxe should be able to break wood.

Yeah. It's always been a little strange how mining turtles do everything. I think it's probably better for the sake of "convenience" (you don't want your program to fail if it finds an abandoned mineshaft with lots of wood), but it's definitely not logical.

shelbykauth commented 5 years ago

I'm so glad to hear that my feedback is useful.

It's not documented right now (sorry!), but the kinetic augment can be used in turtles. This makes turtle.dig and turtle.swing use the currently selected item, just like turtle.place does

our logic is almost identical to a player's

Wow. Yeah, that is insanely useful information. I will have to do some testing to see if I can get everything to work right. So I'll leave this open until I can test it all out. But yeah, that should do it.

Funny enough, I didn't know about turtle.swing(). I should have. I now remember reading it somewhere, but can't remember exactly. Oh.... That's why there's turtle.native functions, isn't it?

I wonder if I could even get it to punch trees using the kinetic augment and no tool. That would be so cool. I mean, a bit expensive to put lower-end tools on every turtle that the first turtle makes. But worth it. And it makes sense. And gold is easier than diamonds at any rate.

You'll have to do something like while turtle.detect() do turtle.dig() end. I think this is a fair compromise for being able to use any tool,

Oh yeah. That's fine. I'm actually working on a big program suite right now. It's not developed enough to release at the moment, but it's on GitHub at shelbykauth/ThorneCC. I was kinda hoping someday when it's complete enough, it could be put in treasure disks. I'm going to write an installer script along with it. It's an inventory system, a bot system, etc, a group of APIs and programs. And in the bot system, when you say move forward 5, depending on whether or not you allow the use of force, the turtle will dig or attack (or just try moving if there's no force) until it successfully moves forward. (You specify the use of force with capitalization of the commands. "Mf4" moves forward with force while "mf4" does not allow force. And you can string the commands together to submit them all at once.). So yeah, it already does the while not turtle.forward() loop to handle gravel falling. Easy enough to modify as needed. So yeah. Totally a fair compromise.

As for the pickaxe thing, yeah... I guess it is better to not have to switch tools all the time to make it work, especially for smaller pieces. To only need 3 diamonds instead of 8 to attack, mine, and chop trees. But man oh man. I cannot wait to test the kinetic augment and a mattock to mine dirt, chop a tree, and sew farmland.

On a side note, if I have like... A laundry list of little enhancement requests, is it better to put them all in one issue request or make a bunch of separate issue requests? Some go together, like using buckets, using tools, and breaking levers and buttons without tools (like you can in adventure mode). Others don't so much. Like accessing the TConstruct smeltery controller or being able to access handheld inventory like backpacks and pouches.

SquidDev commented 5 years ago

On a side note, if I have like... A laundry list of little enhancement requests, is it better to put them all in one issue request or make a bunch of separate issue requests?

Hrmr. If they're related, just chuck them into one issue. Otherwise, separate issues are probably better, as it's just a wee bit easier to keep track of.

being able to access handheld inventory like backpacks and pouches.

If an item exposes IItemHandler, you should be able to wrap it as an inventory with .getItem on an introspection module, or transfer in and out of it. I've only really tested this on the neural interface, but it should apply to everything.

SquidDev commented 5 years ago

As a small note, I've added a short section on using kinetic augments on turtles.

SquidDev commented 5 years ago

Closing this for now as I don't think there's anything to do on my end. If something crops up, I'll happily reopen it.