Skip to content

Commit

Permalink
Merge branch 'MassTransit'
Browse files Browse the repository at this point in the history
  • Loading branch information
Craxy committed Jul 23, 2017
2 parents 24a733a + d4f5abb commit 4c3845b
Show file tree
Hide file tree
Showing 104 changed files with 4,135 additions and 7,140 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*.suo
*.user
*.sln.docstates
.idea/
libs/

# Build results
[Dd]ebug/
Expand Down
Binary file removed .paket/paket.bootstrapper.exe
Binary file not shown.
38 changes: 0 additions & 38 deletions .paket/paket.targets

This file was deleted.

97 changes: 43 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,67 @@ Toggle Traffic Lights
Mod for Cities:Skylines
-> [on Steam Workshop](http://steamcommunity.com/sharedfiles/filedetails/?id=411833858)

Tool to **remove or add traffic lights at junctions**. With Cities:Skylines patch [*1.7.0* (*Mass Transit*)](https://forum.paradoxplaza.com/forum/index.php?threads/mass-transit-1-7-0-patch-notes.1022869/) that functionality was directly included into the game. But *Toggle Traffic Lights* provides functions beyond of C:S:
* Access the Junction Tool directly from the Roads Menu.
* Activate and Deactivate the Junction Tool everywhere. Disabling the Intersection Tool restores the previous used tool.
* Instead of just the white info mode you can use the Junction Tool in the default (colored) view.
* Remove (or add or reset) all traffic lights at once.

Tool to **remove or add traffic lights at intersection**. Traffic lights can be added and removed at any kind of road intersection including highways and their off- and on-ramps.
![Same intersection with and without traffic lights](./docs/files/img/TrafficLightsVsNoTrafficLights.png)
# Description
TTL provides access to two slightly different tools: The C:S built-in *Traffic Routes - Junctions Info View*, and the Junction Tool.
Bot activate the same tool to toggle traffic lights and stop signs. The difference between these two are:
* *Traffic Routes - Junctions Info View*: Opens the C:S built-in *Traffic Routes - Junctions* tool. Enables the Info View (everything's painted in white). Opens the Traffic Routes Window with the Junctions tab selected. Contains batch commands to add, remove or reset all Traffic Lights.
![Traffic Routes - Junctions](./docs/files/img/TrafficRoutesJunctionsView.png)
* *Junction Tool*: Provides different views: The same Info View used by *Traffic Routes - Junctions*, the default (colored) overground View, and the default View with tunnels (see image below).
![Junction Tool Views: Overground, Overground with tunnels, and Info View](./docs/files/img/JunctionToolViews.png)

 
## Batch Commands
![Traffic Routes - Junctions](./docs/files/img/TrafficRoutesJunctionsWindow.png)
TTL adds three buttons to the *Traffic Routes - Junctions* window:
* *Add all*: Add Traffic Lights to all junctions.
* *Remove all*: Remove Traffic Lights from all junctions.
* *Reset all*: Reset all junctions to their default Traffic Lights states (see [this table](https://www.reddit.com/r/CitiesSkylines/comments/2zp61z/i_made_a_table_chart_of_which_intersections/) for the default statuses).

There are multiple ways to active this tool:
* You can click the **button in the roads menu** below the roads tool
![Deactivated button in the roads menu](./docs/files/img/Button_Deactivated.png)![Activated button in the roads menu](./docs/files/img/Button_Activated.png)
* Alternatively you can use the keyboard shortcut **Ctrl+T**. This acts exactly like clicking on the button. If the roads menu is not open when pressing the shortcut the menu will open. Pressing *Ctrl+T* again will deselect the Toggle Traffic Lights tool and closes the roads menu.
* The keyboard shortcut **Ctrl+Shift+T** will enable the tool too, but does not open the roads menu. That means there is no visual sign like a highlighted button, but the tool is fully active. Pressing *Ctrl+Shift+T* again (or *Ctrl+T*) disables the Traffic Light tool and reenables the last used tool. This shortcut is therefore useful for fast changes. Pressing the shortcut while the roads menu is active will act like clicking on the button or pressing *Ctrl+T* -- with one exception: Pressing *Ctrl+Shift+T* while the tool is active in the roads menu will not close the menu (like *Ctrl+T* does) but selects the road building tool.
Therefore this shortcut behaves similar to the Toggle Traffic Lights mod [before a button was added](https://github.com/Craxy/ToggleTrafficLights/releases/tag/0.2.0).
Besides the buttons you can also click on the icons while holding *Ctrl*. The colored traffic light adds lights to all intersection, the grayed out light removed lights from all intersections, and clicking on the text "Toggle Traffic Lights" resets all junctions to their default states.

When the tool is active you can hover over an intersection. This intersection is then highlighted. The highlighting indicates the current status of the traffic light: light blue means there are traffic lights while dark blue shows that there is no traffic light. The same info is shown in the tooltip. Additional it displays the original state of the traffic lights on this intersection.
To toggle the traffic lights **left click** on an intersection. Alternatively you can reset the traffic lights to its original state via a **right click**.
**Note**: All of these commands are executed immediately after you clicked the corresponding button. There's neither an additional confirmation nor a revert.

### Tunnels
With Cities:Skylines patch 1.10 tunnels were added to the game. **This mod supports tunnels since [version 0.7.0](https://github.com/Craxy/ToggleTrafficLights/releases/tag/0.7.0)**. To toggle lights underground the underground-mode must be activated via **PageDown**<sup>1</sup>. This enables the Traffic Info View and allows toggling of intersections in tunnels -- ONYL intersections in tunnels, NOT intersections overground. To go back to intersection above the ground use **PageUp**<sup>1</sup>. If you press **PageUp+PageDown**<sup>1</sup> together you can change intersections above and below the ground at the same time.
Although [Toggle Traffic Lights v. 0.7.0](https://github.com/Craxy/ToggleTrafficLights/releases/tag/0.7.0) supports tunnels, the functionality is still very basic. There are still some quirks in combination with tunnels:
* There is currently no real indicator which mode is used (underground, overground, both). Overground is easy distinguishable from the other modes since it doesn't use the Traffic Info View -- but the two other modes look the same. So you have to check by mouse hovering over an intersection above the ground. It's not true there's no sign: Using the UI (right click on button) displays the current mode under the headline in a very tiny font -- but that's something I don't want to keep. In a future version I might most likely add some real indicator.
* Hovering over an underground intersection highlights it -- but the highlighting is projected on the ground. Based on your camera the intersection might be quite distant from its highlighting. In future version I might use a similar approach the road-building tool does: It projects the highlight-circle on the ground, but on the same time it draws another circle to the correct position underground.
* The existence of traffic lights in tunnels are not visible. Therefore have to move your mouse over an underground intersection to see its current state. In future versions it'll be possible to highlight all intersections with their existence of lights.
* Pressing *PageUp+PageDown* can be a bit odd: If one of the two buttons gets released a bit earlier than the other the mode of the last button gets activated. Maybe I'm going to adjust that in later versions of the game -- but it's of no high priority. Maybe I will asign that tool to a separate key. Additional: with an indication of the current mode I'm planning on introduce a button to change the mode so it can be used without a shortcut.
**Note** These commands apply to all placed road junctions at the time you clicked on a command. Future created or changed junctions aren't affected by this. You have to execute the command again.

## Activation
![Deactivated button in the Roads Menu](./docs/files/img/Button_Deactivated.png)
TTL adds an additional button to the Roads Menu. A left click opens the Junction Tool, a right click opens the (C:S) *Traffic Routes - Junctions Info View* with the batch commands.

### Batch Commands
With [version 0.4.0](https://github.com/Craxy/ToggleTrafficLights/releases/tag/0.4.0) batch commands were introduced. With these all traffic lights can be removed, reset to their game-default or added to all intersections. These commands can be accessed via a right click in the Toggle Traffic Lights tool button. A menu with the commands opens on the left side of the screen.
![Same intersection with and without traffic lights](./docs/files/img/BatchCommandsMenu_v0-4-0.png)
Please note: A batch command gets executed immediately after you clicked the corresponding button. There is no revert. There are some [additional remarks](https://github.com/Craxy/ToggleTrafficLights/releases/tag/0.4.0) witch can be found in the [release notes](https://github.com/Craxy/ToggleTrafficLights/releases/tag/0.4.0).
**Note**: There's a slight visual issue: The Road Form Tab button doesn't get deselected when the Junction Tool is active. Neither will changing the Road Form reselect the Road Building Tool. Instead click again on the TTL button to disable the tool.

Additional the tools can be activated (and disabled) via shortcuts:
- **Ctrl+T**: Activates the Junction Tool. Opens the Roads Menu. If the junction tool is active this shortcut selects the Road Building Tool.
- **Ctrl+Shift+T**: Activates the Junction Tool. Doesn't open the Roads Menu instead it keeps the current location. Pressing the shortcut again reselects the previous tool.
- **Ctrl+Alt+T**: Opens the Traffic Routes Junctions Info View. Like the shortcut above it keeps the current location and using the shortcut again reselects the previous tool too.

The shortcuts can be changed in the settings.

**Note**: The existence of traffic lights will be added to new savegames (the savegame size increases by a couple of kB (~33kB) -- I think that's negligible). The savegame can be loaded without the mod enabled but in this case the traffic lights will be reset to it's original statuses (see [this table](https://www.reddit.com/r/CitiesSkylines/comments/2zp61z/i_made_a_table_chart_of_which_intersections/) for the default statuses).
**Note**: The Elevation shortcuts are displayed under the Toggle Traffic Lights settings, but cannot be modify. To change these go to the C:S Keymapping settings (category: shared).

Note: If you append or remove a road to/from an intersection the traffic lights will be recalculated by the game and placed according to the used road types. You must then retoggle the traffic lights via this tool.
## Usage
Toggling Traffic Lights and stop signs works everywhere exactly like it already does with the built-in tool in C:S.

Note: The tool is disabled in the editors.
If the Junction Tool is enabled, you can change the view via the Elevation Keys (default: *PageUp* and *PageDown*).
The order is: Overground, Overground with tunnels visible, Underground (Info Mode, white).
By default activating the Junction Tool keeps the current view: If an Info Mode was active, the tools uses the Underground view, otherwise the Overground view (with tunnels visible). This behavior can be changed in the settings. Then the Junction Tool always uses the view of when it was active the last time. Whatever the setting the views can still be changed via the Elevation keys.

&nbsp;
&nbsp;
#### Shortcut reference:
* **Ctrl+T**: Activate/Deactivate TTL by selection the TTL button in the roads menu
* **Ctrl+Shift+T**: Activate/Deactivate TTL without using the button
* **Left Click**: Toggle traffic light
* **Right Click**: Reset traffic light to its default state
* **PageDown**: Activate mode to toggle lights in tunnels
* **PageUp**: Activate mode to toggle lights above the ground
* **PageUp+PageDown**: Activate mode to toggle lights above and below the ground

&nbsp;
&nbsp;
### Issues with other mods
* [Extended Road Upgrade](https://steamcommunity.com/sharedfiles/filedetails/?id=408209297): **Both mods work side by side**. There is just one issue: When one of the Extended Road Upgrade tool is activated you cannot enable directly the Traffic Lights tool -- even if you click the button one of the road tools gets enabled. Just active the Traffic Lights tool again and it'll work.
* [Lane Changer](https://steamcommunity.com/sharedfiles/filedetails/?id=412101021): This mod is not compatible with Toggle Traffic Lights. I have not inspected the problem -- but it seems both mods modify the same data and thwart each other. Recently there were comments of the two mods working together -- I have not tested both together yet.

&nbsp;
&nbsp;
&nbsp;
&nbsp;

## Release Notes
# Release Notes
For release notes see: [GitHub release page](https://github.com/Craxy/ToggleTrafficLights/releases) or [Change Notes on Steam](https://steamcommunity.com/sharedfiles/filedetails/changelog/411833858)

&nbsp;
&nbsp;
&nbsp;

### Additional Infos
# Additional Infos
* The states of the traffic lights from previous savegames with TTL get discarded. Between the release of the 1.7 patch (which remembers traffic lights) and the update of TTL for that patch quite some time passed. So -- if you have continued to play -- you quite likely already changed traffic lights with the C:S built-in function. Additional it's easier for me to just ignore separately by TTL stored lights instead of testing if these are present and handle them correctly.
&nbsp;
* Some code is inspired by the mod "Extended Road Upgrade" by viakmaky: https://github.com/viakmaky/Skylines-ExtendedRoadUpgrade (MIT licence)
* Some code is taken from or inspired by the mod "ModTools" by nlight: https://steamcommunity.com/sharedfiles/filedetails/?id=409520576 (MIT licence)


&nbsp;
&nbsp;
&nbsp;
&nbsp;

<sup>1</sup> Although I wrote *PageUp* and *PageDown* this mod actual utilizes the game's "Build Elevation Up" and "Build Elevation Down" keys (used to change elevation of roads while building). Their default states are *PageUp* and *PageDown*, but can be rebind in the Options menu under "Gameplay" -> "Key Mapping".
68 changes: 32 additions & 36 deletions ToggleTrafficLights.sln
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DBCE62E6-905B-47DD-814C-453CC4F28187}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C7773097-D1BB-4231-BBF7-13C1821F3744}"
ProjectSection(SolutionItems) = preProject
build.fsx = build.fsx
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleTrafficLights", "src\ToggleTrafficLights\ToggleTrafficLights.csproj", "{E1DEBC88-68E3-4525-9044-3F102A300D2B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
DebugWithoutSerialization|Any CPU = DebugWithoutSerialization|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.DebugWithoutSerialization|Any CPU.ActiveCfg = Debug without Serialize|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.DebugWithoutSerialization|Any CPU.Build.0 = Debug without Serialize|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E1DEBC88-68E3-4525-9044-3F102A300D2B} = {DBCE62E6-905B-47DD-814C-453CC4F28187}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DBCE62E6-905B-47DD-814C-453CC4F28187}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C7773097-D1BB-4231-BBF7-13C1821F3744}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleTrafficLights", "src\ToggleTrafficLights\ToggleTrafficLights.csproj", "{E1DEBC88-68E3-4525-9044-3F102A300D2B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1DEBC88-68E3-4525-9044-3F102A300D2B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E1DEBC88-68E3-4525-9044-3F102A300D2B} = {DBCE62E6-905B-47DD-814C-453CC4F28187}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 4c3845b

Please sign in to comment.