Transport Fever 2

Transport Fever 2

88 个评价
Auto Line Namer 0.2.0
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
3.060 MB
2024 年 11 月 4 日 下午 2:07
10 月 21 日 下午 4:57
6 项改动说明 ( 查看 )

订阅以下载
Auto Line Namer 0.2.0

描述
Please save your city before enabling the mod

Caution

Please save your game before enabling this mod. There are no known issues at the time of writing, but keeping a recent save is a good precaution.

Automatic Line Naming (ALN) for Transport Fever 2

Short description

ALN automatically generates informative, human-readable names for your lines using a configurable naming convention. It inspects route stops, vehicles and cargo to produce names such as "Bus - Passengers: Spr - She IC #1" so you can quickly understand what each line does.

GitHub

Project on GitHub[github.com]

Key features

Automated naming convention

Each generated name is built from tokens you can customise in the settings (see the in-game GUI). The typical structure is shown below:

{transportType} {cargoTypes}-{townNames}-{lineType}-{lineNumber}
Naming components

  • Transport Type — Short label for the vehicle type (e.g. Bus, TP, RC)
  • Cargo Types — Cargo carried on the line (if any), shown in a compact form
  • Town Initials — Up to three-letter initials of the first and last towns (e.g. Spr for Springfield)
  • Line Type — LO (Local), IC (Intercity), or RE (Regional) based on number of stops/towns
  • Line Number — Numeric suffix to disambiguate duplicate names

Transport type detection

The mod detects passenger vs cargo usage across all transport modes (road, tram, train, water, air) and uses the configured short labels when building names.

Rename options

  • Manual refresh — Set a line's name to "r" or "reload" to trigger an immediate rename.
  • Default name handling — Lines with default names (for example "Line 1" or names starting with "UNK") are considered updatable and will be renamed automatically.
  • Tag exclusion — Prepend your line name with a tag to exclude it from auto-renaming (default tag is "Cst"; configurable in settings). For example: Cst My private line

Examples (copy & paste)
Below are a few ready-to-use convention patterns and sample outputs using the mod defaults.

1) Default-style convention
{transportType} {cargoTypes}-{townNames}-{lineType}-{lineNumber}
Example output: Bus Passengers-Spr-She-IC-1

2) Cargo trains, human readable
{transportType} - {cargoTypes} - {townNames} {lineType}
Example output: TC - Log,Gra - Nor-Cam IC

3) Short local shuttle
{transportType}: {townNames} ({lineNumber}) {lineType}
Example output: WP: Portville (1) LO

How to use

Installation

Steam Workshop

Subscribe on the Workshop and enable the mod in the game's mod list.

Local deploy (developer / testing)

Use the included deploy helper to copy the repository into your local TF2 mods folder. The script overwrites an existing mod folder with the same name — make a backup if you rely on a different install.

./scripts/deploy_mod.sh # or provide a custom mods base path ./scripts/deploy_mod.sh "/path/to/Steam/userdata/XXXX/1066780/local/mods"

Troubleshooting & tips

Line not renamed?

• The line may have a custom name or the exclusion tag. Use "r" or "reload" to force a rename, or remove the tag.
• Some cargo types are detected after vehicles are loaded — enable Auto Update in the settings to let the mod re-evaluate lines periodically.

Preview not updating?

• Make sure the settings window is open and you're changing a setting that affects the preview. If the preview still doesn't update, redeploy the mod and restart the game.

Developer notes

Key files

  • `res/scripts/abajuradam/auto_line_namer_helper.lua` — name generation logic
  • `res/scripts/abajuradam/state.lua` — persistent settings getters/setters
  • `res/scripts/abajuradam/auto_line_namer_gui.lua` — GUI window and event passthrough
  • `res/config/game_script/auto_line_namer.lua` — game-script lifecycle and event handler
  • `scripts/deploy_mod.sh` — local copy / deploy helper

Safety / coding guidelines

• Guard `api.engine.getComponent` results before accessing fields.
• Use `State` getters/setters for configuration access.
• Escape user-provided strings used with Lua patterns.

Credits & License

This mod was created by erkanercan.


License: MIT — see `LICENSE` in the repository for details.
39 条留言
Ur Jesus !  [作者] 10 月 23 日 上午 2:08 
@finnr you're absolutely right, the lineNumber variable actually the variable the game assigns as the line id into the line itself, the count does not exist, I'll be correcting the documentation according to that.
finnr 10 月 22 日 下午 6:05 
I'm a bit confused about new "lineNumber" vs the old "Count".
Above it says:
[Transport Type] - [(Cargo Types)]: [First Town Initials] - [Last Town Initials] [Line Type] #[Count]
Then later:
{transportType} {cargoTypes}-{townNames}-{lineType}-{lineNumber}
Sp, is lineNumber and count 2 different input types? Because lineNumber does not behave as before the update.
Ingame "lineNumber" is a 6 number suffix, not the same as "count" which used to disambiguate duplicate names.
An example:
{transportType} (#{lineNumber}) {cargoTypes}-{townNames} outputs "Bus (#389321) Pas-Cop".
It should output: "Bus (#1) Pas-Cop
Does it make sense?
Se screen shot here: https://prnt.sc/LojxinaAyy1h
Ur Jesus !  [作者] 10 月 22 日 下午 1:01 
@finnr, hmm I see the issue, I never tried it out with adv. stats, there can be a future update about that, or the settings button position can be changed. Thanks for the feedback!
Ur Jesus !  [作者] 10 月 22 日 下午 1:00 
@CptAmerica, there is a settings GUI now, and you can enable - disable mod or auto renaming function. Please try it out and LMK :)
finnr 10 月 22 日 上午 11:28 
Update! The [ALN] wasn't showing because I have the Adv. stats mod installed, spamming the entire gamebar. Name formatting is now easier to change. Thanks
finnr 10 月 22 日 上午 9:39 
Have been using this mod for a while now, but yesterday it suddenly "broke". It renames, but add dashes and numbers, and the general style convention is gone.
CptAmerica 10 月 22 日 上午 2:56 
is it possible to disable the mod? it's kind of ruined the game. all my lines are now renamed. the mod didnt work until today. that's why i never noticed. but now all lines have ridiculous names and when i change them they switch back to auto name
Ur Jesus !  [作者] 10 月 21 日 下午 5:29 
Updated the mod for good! Check out the new GUI from the bottom ALN button.
Baedeker 9 月 21 日 上午 6:04 
Causes too many game crashes, even after you disable it.
华南小无 9 月 10 日 上午 8:29 
hello, It seems like you haven't updated your Githup code for a long time. I have added a default name judgment for Simplified Chinese characters. Can I add it to the Githup code repository?