Skip to content
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

Button to remove / disable all traffic lights #320

Closed
Sqoops opened this issue May 18, 2019 · 5 comments · Fixed by #535
Closed

Button to remove / disable all traffic lights #320

Sqoops opened this issue May 18, 2019 · 5 comments · Fixed by #535
Labels
discussion Contains debate on certain topics feature A new distinct feature Settings Road config, mod options, config xml TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc

Comments

@Sqoops
Copy link

Sqoops commented May 18, 2019

Is it possible to implement a button that removes all traffic lights in your entire city?

I tried implementing it myself but I can't figure out how to iterate the "ref NetNode node" from 0 to max and have it in a nested loop with
for (ushort nodeId = 0; nodeId < NetManager.MAX_NODE_COUNT; ++nodeId)

@FireController1847
Copy link
Collaborator

I mean, it's certainly possible, but is it worth adding such a mundane feature to take up more screen space? I'm not sure what the use case for this would be...

@originalfoo
Copy link
Member

@FireController1847 I assume this is due to the fact that Toggle Traffic Lights mod is incompatible with TM:PE (it breaks some of our traffic light stuff for an as-yet unknown reason).

@Sqoops Is it removal of traffic lights that's the most important thing, or an option to disable new traffic lights being automatically added at junctions that would normally get them?

@originalfoo originalfoo added discussion Contains debate on certain topics feature A new distinct feature labels May 18, 2019
@Sqoops
Copy link
Author

Sqoops commented May 19, 2019

@FireController1847 I've implemented a button already like this picture which doesn't seem to waste that much space.

Edit by aubergine10: Inlined the image for posterity
2qUYmcR

@aubergine10 an option to disable new traffic lights being automatically added to new junctions would be good enough for me.


I just figured out how to remove all traffic lights with just the for loop that I've posted before.

for (ushort nodeId = 0; nodeId < NetManager.MAX_NODE_COUNT; ++nodeId)
{
    if (!Flags.mayHaveTrafficLight(nodeId))
        continue;

    bool? hasTrafficLight = Flags.isNodeTrafficLight(nodeId);
    if (hasTrafficLight == null)
        continue;

    if ((bool)hasTrafficLight)
        Flags.setNodeTrafficLight(nodeId, false);
}

@webfischi
Copy link

webfischi commented May 21, 2019

I have TTL still installed with game version 1.11 and TM:PE 10.18, if you just use the checkbox "Disable Traffic Lights" it works fine. So there shouldn't be an issue adding the feature, it could even use the original code from the mod, because it doesn't touch existing traffic lights.

@originalfoo originalfoo changed the title Button to remove all traffic lights Button to remove / disable all traffic lights May 23, 2019
@originalfoo originalfoo added TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc Settings Road config, mod options, config xml labels Aug 11, 2019
@originalfoo
Copy link
Member

Implemented in v11.0-alpha9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Contains debate on certain topics feature A new distinct feature Settings Road config, mod options, config xml TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc
Projects
None yet
4 participants