Transport Fever 2

Transport Fever 2

Create your own game world!
Give your game a personal touch and change it to your liking. Create, share and install mods. Customize the game with new landscapes, vehicles, stations, assets and more.
RadiKyle 6 17 May, 2024 @ 7:41pm
Icons for modular station track modules
Hey all, looking for help on how to make track mods that don't have blank purple icons in the *modular station configure menu*.

Some track mods I've checked only show blank purple squares in the station configure menu. I found some mods that don't have this problem, and I noticed they have copies of the regular icon .tga files with "_module" added to the filenames. So I tried this with my mod, but now I get 2 icons for every track: one with the correct icon, and one still with the purple box!

What are we supposed to do to make these icons work? Thanks
< >
Showing 1-1 of 1 comments
RadiKyle 6 18 May, 2024 @ 2:56pm 
...Okay so marathon learning sesh and I figured out how this works (or seems to).

The game's base_mod.lua file has a postRunFn at the end that creates a modular station track module for every loaded track type. It makes references to icon .tga filenames that are simply the track filename with "_module" and "_module_catenary" inserted at the end, regardless whether or not these files actually exist. It's up to the modder to ensure the .tga files are put in place (in textures/ui/tracks).

In my case above I did not have the catenary .tga files, so I still had a purple box for the catenary version of each track type. Added those and all is fixed.


Alternatively if I don't want my track types to appear as station track modules at all, I can use the postRunFn in the mod.lua file to hide the ones that the base_mod.lua file automatically creates. A method I saw in other mods it to simply set the availability year for those unwanted track modules so they'll not show up:

postRunFn = function(settings, params) local allModules = api.res.moduleRep.getAll() for _, moduleName in pairs( allModules ) do local moduleID = api.res.moduleRep.find( moduleName ) local module = api.res.moduleRep.get( moduleID ) if string.match( module.fileName, "trainstation_%%%%%%_" ) ~= nil then module.availability.yearFrom = 1 module.availability.yearTo = 1 end end end,

In this case replace the %%%%% with a string that's the name of the track type in the mod. So if the mod has a track type "billy_8rail_50.lua", then put "trainstation_billy_8rail_50_" in the string match code.

Anyhow hope that helps other mod newbs like me. Cheers!
< >
Showing 1-1 of 1 comments
Per page: 1530 50