Set the Analog Controller Box to accept individual signal strengths
wooky opened this issue ยท 10 comments
One issue I've encountered when using the Analog Controller Box in my play world is that if I want to use non-continuous redstone levels to control my boxes, it becomes very annoying. For instance, if I want my signal to switch red on strengths of 0-4 and 7, I have to come up with some external way to control it at strength 7, since it's outside the range of 0-4.
My solution is to make the box very flexible by letting the player set different strengths for each color. The GUI that I have in mind looks like this:
So now if I want to implement the above, all I need to do is to press 0, 1, 2, 3, 4, and 7 for the red aspect, and my box will work as I want it to without further headache.
While this interface does make the box more flexible, one issue I can see is that it's too cluttered. Not everyday you see a simple GUI with 64 buttons on it.
What do you think?
While the idea of using multiple analog boxes sounds good, the entire purpose of it is to save up on space so you avoid having a bunch of boxes.
As for the "off" aspect, remember that if you don't have any aspects selected for a signal strength, it's considered off.
Okay, so I have come up with a couple other ideas that don't take up nearly as much horizontal space.
Option 1: type in the ranges
You don't have to constantly click on buttons, and all you have to do is to type in a range or ranges that you want it to work. This requires text parsing, but I don't think that will be a big issue. The only problem I have with this is that it looks... unusual, because instead of selecting a value, you have to type it in.
Option 2: put the redstone strengths in a grid
This one you have to select the desired aspect rather than the redstone strengths. Lots and lots of clicking will be needed to set up all the necessary aspects. Also, a bit of math will be needed.
Personally, I like option 1 more. Which one do you like? Both? Neither? Any other suggestions?
Its fairly trivial to change the GUI width. You just need to change the width value in the GUI class and provide an appropriately wide image.
As for the other options, I also prefer Option 1. Option 2 is just confusing to me.
Okay, so I implemented option 1 as such:
What happens here is that when the user types in the desired frequencies, the text is parsed client-sided using regex and then sent to the server as a series of booleans; similarly in reverse.
You may notice a strange thing about this dialog: the textboxes do not have borders around them. I cannot, for the life of me, figure out how to get those to be drawn, since setting GuiTextField.setEnableBackgroundDrawing(true) draws a gray box and you can't see the text. If someone can give me a hint on how to fix that, I'll quickly fix the issue and submit a pull request.
Well...there is always the standard fall back of just editing the background image.
Which it appears you need to do anyway, since the borders are all screwed up.
Alright, so as soon as I added textboxes to the picture itself, I found out how to get the actual textfields to behave. It turns out that you have to disable GL_LIGHTING before drawing the boxes themselves. That's a rather odd requirement.
Nevertheless, here is the (hopefully) final result:
It looks a tad bit crammed since I decided to use gui_basic.png rather than making another GUI just for this box, which is a tad bit short. But I think it looks fine.
If people are OK with this, I'll make a pull request shortly.