CC: Tweaked

CC: Tweaked

57M Downloads

Setting values for Redstone components like repeater delay or comparator setting

MileyHollenberg opened this issue · 13 comments

commented

In older versions of CC I wasn't able to place any redstone components due to the orientation always being the same no matter how I placed it, this has been fixed in CC:Tweaked which is really useful but I would still not be able to have my turtles place redstone contraptions for me if they require specific timing on repeaters, subtraction mode on comparators or maybe even a noteblock to be set to a specific tone.

The way I would see it implemented would be through either the redstone api or the turtle api

Though redstone I would add

  • redstone.setRepeaterDelay(delay)
  • redstone.getRepeaterDelay()
  • redstone.setComparatorMode("comparison"|"subtraction")
  • redstone.getComparatorMode()
  • redstone.setNote(note)
  • redstone.getNote()

Or through the turtle API something like

  • turtle.setBlockData(data) where data is numeric, 0-16, and the comparator would see 0 as comparison and 1 as subtraction
  • turtle.getBlockData()

My main use-case is that I would like to be able to write a program that can read all block states of a contraption and then us that information to rebuild it and copy it, basically a CC turtle version of litematica/schematica

commented

I wonder if the more appropriate thing to do would be to do something like #125, and just allow turtles to right click arbitrary blocks. It obviously requires more work within Lua to reach a specific state, but saves adding lots of special cases to CC.

As you mention, the alternative would be to have a function to set the block data/state, some inverse to turtle.inspect. This would sadly also require us to special-case blocks/states, as obviously you don't want people to be set arbitrary states. Being able to place fully-grown crops (for instance) would be terribly broken!

commented

Having a turtle.use() would be both easier to use/implement and give more power to the turtles. Your latest comment on that issue mentions though that you're not comfortable with adding that in the core of CC, is that still the case? If not then that would be the best way to go about it yeah. IIRC turtle.insepct() can already read out detailed data so there wouldn't actually be a need for the turtle.getBlockData I suggested

commented

Your latest comment on that issue mentions though that you're not comfortable with adding that in the core of CC, is that still the case?

I don't know :D:! It's a feature I think will be very useful, but also my gut doesn't really like it. Yes, I'm aware that's an absurd way to decide features :/.

commented

Wwell here is a list of the vanilla blocks it could affect at least (not adding any modded blocks/items since I only have CC in my world as a core game changer, the rest is basically vanilla+ and a couple data packs)

Setting noteblock notes
Tilling farmland (though this may already be possible through turtle.attack with a hoe turtle)
Flicking a lever
Making redstone ore glow
Opening and closing a fence or trapdoor (though the turtle can't pass through it still)
Pressing a button
Toggling a daylight sensor
Placing spawn eggs
Setting repeater delay
Changing comparator mode
Interacting with a composter? (not sure if placing food items in there is already supported and if it already pops out the bonemeal)
Activating a bell

Most of these functionalities are already possible through workaround via the redstone api, having a turtle.rightClick would just make it a lot easier to utilize and honestly wouldn't really break anything. The interaction with other mods kinda depends on their implementation, any item that requires a GUI is inaccessible and it's what limited this list as well (though I've probably missed something anyways)

commented

Do bells react to redstone?

They do

commented

Like I said in my last comment at the end, most of these things are already doable through other workarounds but the list itself is about what a turtle.rightClick method could actually do/interact with

commented

I’m certain the arbitrary list of blocks that’s mentioned by Squid could be reduced to “if player can right click on it and it’s not an inventory, so too can the turtle,” no? I haven’t looked into forge modding at all but I know in fabric, block entities have an activate method that could totally be hooked into via turtle.

commented

arbitrary list of blocks that’s mentioned by Squid

What list are you referring to exactly?

commented

Tilling farmland (though this may already be possible through turtle.attack with a hoe turtle)

Dig with an air gap between the turtle and the dirt I think.

Flicking a lever
Pressing a button

Turtles have access to the redstone API, you could have them trigger the wire behind the lever/button

Placing spawn eggs

Does turtle.place() not work?

Interacting with a composter? (not sure if placing food items in there is already supported and if it already pops out the bonemeal)

I know that this doesn't work and also expected turtle.drop() do be able to do it.

Opening and closing a fence or trapdoor (though the turtle can't pass through it still)

Turtles can fly and fences typically are outside or in spacious areas. Also, redstone API

Activating a bell

Do bells react to redstone?

commented

I wonder if the more appropriate thing to do would be to do something like #125, and just allow turtles to right click arbitrary blocks. It obviously requires more work within Lua to reach a specific state, but saves adding lots of special cases to CC.

As you mention, the alternative would be to have a function to set the block data/state, some inverse to turtle.inspect. This would sadly also require us to special-case blocks/states, as obviously you don't want people to be set arbitrary states. Being able to place fully-grown crops (for instance) would be terribly broken!

@MileyHollenberg This comment by Squid

commented

Ah like that, didn't quite read a list in there. If Forge has a similar activate method as you mention that Fabric has where it already ignores anything with a GUI then that would indeed make things easier yeah

commented

I'm thinking of a craftable "hand" tool or something similar, and the turtle needs to equip it to do right-clicks! Also I vote for letting this tool right-click arbitrary non-inventory blocks. Maybe make it look like a hand pointing a finger at the block it's clicking, kinda like the hand tool in the Create mod. For example, when it clicks on the block above it, the hand rotates to vertical, and moves up a pixel tor two, like the way a tool animates when breaking a block.

commented

I like that idea, that would add a bit of balancing at the same time since you'd have to give up one of the two slots (or swap between them) every time you want to use it. My turtles generally all have 1 tool plus the wireless rednet modem so I'd have to be creative with such an approach which makes it a bit more fair :)