Shuttle Train Lite

by folk
A remake of the classic Shuttle Train by Simwir.
1 year, 4 months ago
0.15 - 0.16
8945
Owner: folk
Source: folknor/factorio-shuttle
Homepage: https://forums.factorio.com/viewtopic...
License: MIT
Created: 2 years ago
Latest Version: 0.1.13 (1 year, 4 months ago)
Factorio version: 0.15 - 0.16
Downloaded: 8945 times

Shuttle Train Lite

Multiplayer desync has reportedly been fixed since mod version 0.1.10. I am unable to test it myself until factorio 0.15.10.

Complete from-the-ground remake of simwirs excellent Shuttle Train, because it wasn't really working with 0.15. He has approved of me publishing a remake (I asked him, even though the MIT license would not actually require me to do so).

This mod changes it in a few ways, because it was tough to use with upgraded locomotives from other addons. So now it's an equipment piece you put in the locomotive equipment grid.

If there is no equipment grid present on locomotives, the mod will NOT add one unless you toggle the option for it (enabled by default) in the mod settings from the main menu. The grid added by this mod is 2-by-2. It's tiny, and can fit one of the shuttle items only. If you have some other mod that adds bigger grids, please make sure you disable this option.

If you want a bigger grid, you should get a mod that adds one.
If you have this + FARL loaded, the mod expands FARLs grid from 2x2 to 4x2, so that both modules should fit.

Personally, I use the mod along with Just GO! and Automated Fuel & Ammo, and have one train with this module in my quickbar, and slam it on the rails when I need to.

How it works

The mod adds a new button to the left side of the UI with a green train icon on it. This button has several functions:
1. Control+Click it to call the nearest free shuttle-enabled train to the closest station, or the station you have opened.
2. Click to open the station selection interface
3. Opens automatically when you enter a shuttle-enabled train.

A train is considered a shuttle-enabled train if the front stock has a shuttle equipment module in it.

Sidenote: I have never tested how the mod handles trains with more than one front mover. It might work - especially if the module is in the very first carriage - but probably not. I have not tested it because I only use L-CC trains. If you want to fix that, please do.

A train is considered free for shuttle rides if it:
1. Has no passenger already
2. Has the shuttle equipment module in its grid
3. Either (1) has no schedule, (2) is set to manual control, or (3) is waiting at a station

The station interface

The interface has 4 elements;
1. 2x next/previous buttons
2. A filter textfield
3. A list of 10 buttons
The next/previous buttons page the station list by 10.

The filter textfield works quite different from the old Shuttle Train; it filters per word. Examples
- "acid main" matches "Main Sulfuric Acid #1"
- "sulf main" matches "Main Sulfuric Acid #1"
- "oil 1" matches "Oil-Load-#1"
- "old coal" matches "Old Base Coal Unload"
- "cop 1" matches "Copper #1"
and so forth.
Also, typing a dot (.) in the box is a special case; it will trigger the top-most station button.
So, once you've typed enough that the top button matches, just input a . as the next character, like "copper 1.", and the topmost button will be triggered.

The station buttons behave differently dependin on context;
1. If you are in a shuttle-enabled train, it instantly changes the destination to the clicked station.
2. If you are not in a shuttle-enabled train, it locates the closest free shuttle-enabled train and sends it to the clicked station.

Settings

The most confusing setting is probably the Hidden Names one. It refers to Lua patterns and string.find.
It's quite simple, really. in 95% of cases, this is what you want:
- ^Test: matches any station name that starts with "Test"
- %d$: matches any station name that ends with a number
- %s: matches any station name that has a space in it
- %S: matches any station name that does not have a space in it
- Test: matches anything that has "Test" in it
- [Tt]est: matches "test" and "Test"

So if you set the Hidden Names option to (without the quotes): "^Test,%d$", it will hide any stations that start with "Test" or end in a number.

Keybinding

The mod adds a new keybinding; "Call nearest shuttle" that defaults to Ctrl+J.

Pressing this keybind will call the nearest shuttle-enabled train to the nearest station; or the station you have selected (hover your mouse over), or the station you have open (window with color selection.)

This also works from the map view when you click a station there.

/reset command

If you're having problems with the station interface, please do let me know. But after you have told me what happened, you can reset the interface by opening the console and typing "/reset shuttle" without the quotes.

"Lite"?

Yes, I don't know what that means either. I had to call it something, and my brain didn't work.

Item requirements/"balancing"

The shuttle train module and tech might be a bit cheap as it is now. I welcome feedback on that or anything else about the mod. If anyone has thoughts on adding a version of the recipes for the "expensive" game mode, please comment.

Contact

Please contact me on the forum or in the Discussion section of the mod if you have any questions.

Changelog

0.1.13: 0.16 bump.
0.1.12:
- Fixed the filter box error when a search starts with ( or [
- When a shuttle-enabled train that only has 1 record arrives at a station in automatic mode,
it will be put into manual mode by the mod.
0.1.11:
- Removed the "Store color" keybinding I added by mistake in 0.1.10. Use my other mod instead, Color Equipment
0.1.10:
- If your shuttle cant path to the target, it's put into manual mode immediately.
- Filter string is restored properly on load.
- Added Hidden Names per-user runtime setting.
- Update for 0.15.10.
- Fixed desync in multiplayer.
0.1.9:
- Jeez, I hope we're doing with my station list being stupid soon.
- Apparently on_entity_renamed doesn't trigger when a name is copy+pasted to another entity
0.1.8:
- Added per-player mod option to disable dot-to-go filter functionality.
- Added per-player mod option whether or not the mod should auto-clear the filter box.
- Fixed some UI elements not being created when needed.
- Clicking a train station on the map and pressing Ctrl+J will send you there if you are in a shuttle-enabled train.
0.1.7:
- Hopefully fixed renaming stations.
- Added /reset command to reset station list.
0.1.6:
- Lowered tech requirements and equipment cost to old Shuttle Train levels
- Fixed stations not being added when you build a new one, doh!
0.1.5:
- Added keybinding to call nearest train to nearest - or selected/opened - station, default Ctrl+J.
- If we detect FARL, increase its grid size from 2x2 to 4x2 to fit modules from both addons.
- Thanks to Nexela for both the above.
0.1.4:
- Added optional dependency for Opteras VehicleGrid
- Changed item order string so that the Shuttle Module is not between Personal Roboport mk1 and 2.
- Fixed my fubar logic with equipment grids.
- No longer sets the train color to green.
0.1.3: Try to prevent errors in the data stage when we're loaded with mods that behave very badly.
0.1.2:
- Fix using the filter box dot-action while in a shuttle.
- Fix paging logic in the station list
- Fix not showing list of stations on game load
0.1.1: Initial release