Honk

by GotLag

Trains honk when stopping. And starting. And on command.

Tweaks
a month ago
0.13 - 2.0
95.8K
Trains

g Different sounds?

5 years ago

I installed your mod during my current game, and today got my first honking trains -- more exactly: "trains" -- running. What do you think, would it be possible to play different sounds based on what kind of track the "trains" are running on?
Reasoning: Trains are not always trains! The mod Cargo Ships makes clever use of the train network for driving boats and ships over water, on so-called "Water ways" that are essentially rails. Now, it sounds rather stupid if a ship honks like a train when it enters the port (which is a train station in disguise). A ship's siren would be much more fitting.

Also, there is another mod I use, Bio Industries, which provides primitive wooden rails. As the rails are low-tech, the trains running on them should be, too (I believe they don't yet, but I'm going to suggest that to the mod's author). A different sound for those trains would be nice as well!

I guess, it all boils down to whether the game can distinguish between normal rails, wooden rails and water ways. It would be great if you could look into that matter. :-)

5 years ago

It currently checks for locomotive-type entities, which includes vanilla locomotives and also locomotives added by other mods, such as Nuclear Locomotives or any of the mods that add electric trains.

A quick glance at the API suggests that it doesn't provide a way to find out what type of track the locomotive is running on, unfortunately.

5 years ago

Oh, that is too bad! And does the game make a difference between different locomotive-types, or are they also just the same, internally?

5 years ago

I think to get the rails you can use this:

https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.get_rails

Then just check the name of the first rail in the list.

New response