derfl007's Road Mod

derfl007's Road Mod

154k Downloads

Redstone-controlled traffic lights

E-Mans-Application opened this issue ยท 9 comments

commented

Is your feature request related to a problem? Please describe.
The current traffic lights' cycles are automatic. All traffic lights with the same orientation are the same color. Two traffic lights facing the same direction do not necessarily have to show the same color.

Describe the solution you'd like
It could be convenient to choose when to turn specific traffic lights red or green, for example with a redstone signal. A redstone signal would be sent to the traffic light when it has to turn orange then red, and another signal would be sent when the light has to become green again.
Or maybe you could set up a system where it will be possible, thanks to a built-in interface, to connect some traffic lights with each other, then to choose the order in which the traffic lights must turn green, and the duration of the green light of each of those traffic lights. It would be easier to the player (building redstone systems gives me a headache) but this seemed harder to implement for you.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

commented

I would love to make a system similar to the one used by RailCraft, I don't know how difficult this is tho, I'll check it out

commented

Hello,

I started programming such traffic lights. Lights will switch every time they receive redstone power:
if they are green, they will become yellow then red (with only one signal) - yellow will lasts 5 seconds for now but duration is easy to change
if it is already yellow, it will do nothing
if it is red, it will turn green back.
etc.

Lights could be toggled to blinking yellow with wrench.

This way, we have to create quite complex redstone systems (I never liked redstone ๐Ÿ˜„) but it was the easiest to implement.

Currently, my manual lights have replaced your automated lights. Should I try to leave them next to mine? EDIT: automated lights restored

commented

I have completed a first implementation of those lights:
See pull request #35 and let me know!

Lights work well as far as I can have tested. I didn't try recipes yet.

commented

Again, thank you very much, the only problem i see with redstone controlled traffic lights is, how do you connect them to redstone? They're almost always on top of sign posts. Only thing i can think of is either a wireless system, or using the sign posts to transmit the signal somehow. But as i said in the PR, i will see as soon as the 1.14 port is working.

commented

You're right, that's not convenient with redstone, I am working on "command-controlled" traffic lights instead.

Even though you do not plan to merge for now, it will be useful to me anyway.

commented

I'm finished creating command-controlled traffic lights, i has been added to pull request.

I added a traffic remote item. I designed a temporary texture for it. The advantage is it's copyright free, the disadvantage is it's definitely ugly.
This remote must be hold to perform /trafficlights commands, and it also allows to select traffic lights which should be remotely controlled.

Traffic lights can now have three modes: deactivated (blinking yellow or off), redstone_controlled (same as before), and command_controlled. Modes are still switched with wrench. Only the latter allows trafic light to be controlled by the command, other modes will be ignored.

As I don't talk German at all, I have been unable to add translations to de_de.lang file. I hope English translations are correct.

Hopefully there will be no more bugs. (I selected files to pull manually, I can have forgotten some...)

commented

Wow I really can't thank you enough, I have yet to try it, but it already looks really good looking at the code!

My idea for the most convenient option would be to add a controller block that does the same as the remote, but controlled by redstone, so a mixture between command controlled and redstone controlled. The remote could still be used to connect the controller to the traffic lights, but automation would be a lot easier. When I have time I could try to implement this myself, but if you want to try I won't stop you lol.

Also don't worry about the translations, I'll make them myself, and I'll test the whole thing soon, hopefully by tomorrow.

One more thing:
If you want I can make the 1.14 repository public so you can help with the update, if you want. It is a bit messy right now, as I'm basically remaking the whole thing more or less (My stupid ass thought it would be a good idea to use kotlin, but I think it's not fully supported in 1.14, so I went back to java and now everything is a mess lol)

commented

A controller block is an interesting idea, especially because it gives a concretes and a more intuitive form to traffic lights' remote control system, but it would need a custom gui for managing groups of traffic lights (it may be required that several lights are green at the same time, such as traffic lights for both ways of the same road, or for multiple traffic lights on the same sign post like it's often the case).

That interface will also be used to set green light's duration for each group. Indeed, if commands are still needed to configure controller, it loses interest.

Even though implementation of remote control is already complete and therefore it should be easy to adapt it to suit the controller block, that's again quite a significant workload and I'm not sure I will have time to do it.

About 1.14 repository, I could maybe try to help you a bit, but I won't be able to spend a lot of time on it, sorry (moreover, neither do I know how different is 1.14 modding in comparison to 1.12, I mostly use 1.12).

commented

I added you as a collaborator on the new version, so you can help if you want (and have time for it of course)
But even if you don't have time, don't worry about it. Thanks again, your work is very appreciated!