Remove engine idle sound from car?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Teralink
Inserter
Inserter
Posts: 20
Joined: Fri Sep 09, 2016 3:15 pm
Contact:

Remove engine idle sound from car?

Post by Teralink »

Hi!

I want the car to make sounds while driving only. At current state the car starts to make sounds directly on entering. It's easy to remove the 'engine start' sound. But I can't get rid of this engine idle sound.

I tried it with

Code: Select all

sound_minimum_speed = 0,
so the sound stops when the engine stops. But it doesn't do anything.

Is there some command that would let me set the engine sound volume to zero during stops? I appreciate every tip! :-)

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Remove engine idle sound from car?

Post by Nexela »

Silly hybrid electric vehicles wanting to turn their engines off when not moving!

Unfortunately I can't think of a way to do this

User avatar
Teralink
Inserter
Inserter
Posts: 20
Joined: Fri Sep 09, 2016 3:15 pm
Contact:

Re: Remove engine idle sound from car?

Post by Teralink »

Thanks for your reply! That's exactly what I had in mind. An engine idle sound doesn't really fit to an electric car..

I feared that there is no way to do that. :(

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2634
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Remove engine idle sound from car?

Post by steinio »

Maybe you can reference to an empty soumd file?
Image

Transport Belt Repair Man

View unread Posts

User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 339
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: Remove engine idle sound from car?

Post by LuziferSenpai »

steinio wrote:Maybe you can reference to an empty soumd file?
The easyst way is to detect if the Car is driving, when it is than the sound volume = 0.9 or so and if not than 0.001 or 0.0 :P
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

User avatar
Teralink
Inserter
Inserter
Posts: 20
Joined: Fri Sep 09, 2016 3:15 pm
Contact:

Re: Remove engine idle sound from car?

Post by Teralink »

steinio wrote:Maybe you can reference to an empty soumd file?
That would mute the engine all the time, I think.
LuziferSenpai wrote:The easyst way is to detect if the Car is driving, when it is than the sound volume = 0.9 or so and if not than 0.001 or 0.0 :P
Thanks for that idea! I found out how to get the car speed, but how do I access the engine volume during playtime?

I tried that code

Code: Select all

function electricSound()
		for __, player in pairs(game.players) do
			local vehicle = player.vehicle
			if player.connected and vehicle and vehicle.name == "vwtransporterelectric" then
				if vehicle.speed == 0 then
					vehicle.working_sound.sound.volume = 0
				else
					vehicle.working_sound.sound.volume = 0.5
				end
			end
		end
end
but on entering the vehicle, it tells me 'LuaEntity doesn't contain key 'working_sound'. :-(

Do you know how to do that?

User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 339
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Re: Remove engine idle sound from car?

Post by LuziferSenpai »

Teralink wrote:
steinio wrote:Maybe you can reference to an empty soumd file?
That would mute the engine all the time, I think.
LuziferSenpai wrote:The easyst way is to detect if the Car is driving, when it is than the sound volume = 0.9 or so and if not than 0.001 or 0.0 :P
Thanks for that idea! I found out how to get the car speed, but how do I access the engine volume during playtime?

I tried that code

Code: Select all

function electricSound()
		for __, player in pairs(game.players) do
			local vehicle = player.vehicle
			if player.connected and vehicle and vehicle.name == "vwtransporterelectric" then
				if vehicle.speed == 0 then
					vehicle.working_sound.sound.volume = 0
				else
					vehicle.working_sound.sound.volume = 0.5
				end
			end
		end
end
but on entering the vehicle, it tells me 'LuaEntity doesn't contain key 'working_sound'. :-(

Do you know how to do that?
Than make it: 0.001 or so ;)
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai

User avatar
Teralink
Inserter
Inserter
Posts: 20
Joined: Fri Sep 09, 2016 3:15 pm
Contact:

Re: Remove engine idle sound from car?

Post by Teralink »

That makes no difference, sadly. I think the problem isn't the value - it's the key 'working_sound' itself that doesn't exist (at this place). I know this key from the entity definition only. It seems not to be accessible during playtime..

Post Reply

Return to “Modding help”