[Mod 0.13.0+] Rename Trains 0.2.0

Topics and discussion about specific mods
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

[Mod 0.13.0+] Rename Trains 0.2.0

Post by Dr. Walrus »

Image
Type: Mod
Name: Rename Trains
Description: Adds a simple GUI that lets you easily rename trains.
License: MIT
Version: 0.2.0
Release: 6/28/2016
Tested with Factorio version: 0.13.0
Category: Helper
Tags: trains, locomotive, backer name, multiplayer, rail network
Dependencies: Base [13.0]
Download:
Rename Trains_0.2.0.zip
(2.39 KiB) Downloaded 254 times
I've been playing Factorio since way back when train stops couldn't be given custom names. Being able to rename your train stops with custom names was a big help for train users to organize their rail networks. One thing that was missing though was custom names for the trains themselves. I use different trains for different purposes like Iron, Oil, Copper and PAX, and being able to rename your trains according to their purpose is another step for organization. I've been using the command line to rename locomotives for a while, but I decided to make this mod to make renaming trains more accessible for everyone else. This is a feature that I hope will be implemented into vanilla in the 0.13.0 train update. Looks like I still have a job.

The Rename Trains mod adds a simple GUI in the top left corner with a textbox and a SET button. To use the mod, type in the new name you want for your train, click on any locomotive or cargo wagon in the train you want to rename (which opens that locomotive's or cargo wagon's inventory or schedule), and click the SET button. This will rename every locomotive in that train's rolling stock to the custom name you chose.

You can now also use the text box to rename the assembling machine, furnace, rocket silo, lab, train stop or roboport. The radar does not have an openable GUI so it can't be renamed and you'll have to settle for a name like Kim Jong il.

The Rename Trains text box can be expanded or minimized by clicking on the RT button in the top left.
Pictures
This is a very simple and lightweight mod, and has no associated recipes or sprites. If you want to remove the mod, the renamed locomotives will keep their new names. Leave a comment if you like the mod, found a bug, or want to suggest any new features.

The version on the forums is depreciated. Please go to mods.factorio to download the most up to date version.
I want to rename my trains but I dont want to download an entire mod
Changelog
Previous versions
Last edited by Dr. Walrus on Thu Jan 25, 2018 6:25 pm, edited 14 times in total.
zytukin
Fast Inserter
Fast Inserter
Posts: 215
Joined: Sat Mar 12, 2016 12:14 am
Contact:

Re: [Mod 12.29+] Rename Trains 0.1.0

Post by zytukin »

Awesome mod!
Never knew one could rename trains via command. Something I've wished for since first making trains.

Is there any way to add a listing of all trains owned to allow renaming them without clicking them?
Would make it easier for people with large networks to get started with the mod or to change train names later on without having to chase down all their trains or use the FAT controller to shift the camera around to every train.
neoc
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Sun Apr 24, 2016 4:31 pm
Contact:

Re: [Mod 12.29+] Rename Trains 0.1.0

Post by neoc »

I guess renaming is only possible for entities that support "backer_name"? Because I would like to be able to rename my cars as well so I can easily tell for what kind of storage I want to use them.
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Rename Trains 0.1.0

Post by Dr. Walrus »

zytukin wrote:Is there any way to add a listing of all trains owned to allow renaming them without clicking them?
Would make it easier for people with large networks to get started with the mod or to change train names later on without having to chase down all their trains or use the FAT controller to shift the camera around to every train.
That is definitely possible, I would just set up a list of all trains similar to how the FAT controller is set up. My goal from the start for this mod though is to eventually make this mod have an optional dependency on the FAT controller that will allow it to show your trains' names, and to let you change train names without going into the follow mode.
neoc wrote:I guess renaming is only possible for entities that support "backer_name"? Because I would like to be able to rename my cars as well so I can easily tell for what kind of storage I want to use them.
Yes that is mostly correct. I am planning the next release for this mod to also allow renaming of any train stop, roboport, lab, furnace, or assembling machine which are all of the entities that support backer names and have a gui that opens when you click on them.

Technically I could make the mod assigning a name to any entity, even the ones that don't have backer names, by making a internal table in the mod that uses the entity id as a key and a string name as the value. The problem then becomes how to display that name in a way that feels unobtrusive. I can't really think of a way that would work well without wasting cpu power by checking every game tick to see if an entity's gui is open.
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Rename Trains 0.1.0

Post by Dr. Walrus »

Updated to version 0.1.1. Now you can rename assembling machines, furnaces, rocket silos, labs, train stops or roboports by using the mod. These entities and the radar are all the buildings that support backer names. You can't rename the radar however because the radar does not have a GUI you can open, which is how the mod knows what building or train you want to rename. I don't think it's that important so I won't add a bunch of complexity for an unnecessary feature.
Last edited by Dr. Walrus on Tue Apr 26, 2016 4:16 am, edited 1 time in total.
zytukin
Fast Inserter
Fast Inserter
Posts: 215
Joined: Sat Mar 12, 2016 12:14 am
Contact:

Re: [Mod 12.29+] Rename Trains 0.1.0

Post by zytukin »

Dr. Walrus wrote:Updated to version 0.1.1. Now you can rename assembling machines, furnaces, rocket silos, labs, train stops or roboports by using the mod. These entities and the radar are all the buildings that support backer names. You can't rename the radar however because the radar does not have a GUI you can open, which is how the game knows what building or train you want to rename. I don't think it's that important so I won't add a bunch of complexity for an unnecessary feature.
:o

Very nice.
But damn you, now I might end up spending a few days renaming everything. lol
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Rename Trains 0.1.0

Post by Dr. Walrus »

zytukin wrote:But damn you, now I might end up spending a few days renaming everything. lol
I saw your megabase on reddit. You've got your work cut out for you :lol:
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: [Mod 12.29+] Rename Trains 0.2.0

Post by Dr. Walrus »

I've updated the Rename Trains to be compatible with 0.13. Nothing else has changed. I am having trouble accessing the mod portal website so for now this is the only place you can get this mod. In factorio v0.13.0 there is a bug that prevents you from changing the name of your train stops. Right now the only way to change the name of your train stops is by using console commands or by using the Rename Trains mod. The bug was fixed in factorio version 0.13.1

*EDIT* Rename Trains is now also found on mods.factorio.com and can be downloaded in game.
Last edited by Dr. Walrus on Wed Jul 13, 2016 4:59 am, edited 3 times in total.
GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [Mod 0.13.0+] Rename Trains 0.2.0

Post by GotLag »

Using hotkeys renaming radars is doable:

control.lua:
http://pastebin.com/W3XBpv0K

data.lua:

Code: Select all

require("prototypes.style")

data:extend({
  {
    type = "custom-input",
    name = "train-rename",
    key_sequence = "CONTROL + R",
    consuming = "all"
  }
})
locale:

Code: Select all

[controls]
train-rename=Rename building/train
It doesn't have much error checking as it's a quick proof-of-concept adaptation, but open the GUI button, type a name, click out of the text field to reset focus, mouse over a train/station/radar/whatever, and press CONTROL + R
Post Reply

Return to “Mods”