How can I replace vanilla sounds with custom ones?

Place to get help with not working mods / modding interface.
Rioma
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Jan 08, 2025 4:29 am
Contact:

How can I replace vanilla sounds with custom ones?

Post by Rioma »

I'm trying to replace the electric beam sound by a custom one but I can't make it work.

This is the code I used

Code: Select all

data.raw.beam["laser-beam"] = {
	{
		filename = "__BetterSounds__/sounds/beam.ogg",
		volume = 1
	}
}
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 841
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: How can I replace vanilla sounds with custom ones?

Post by IsaacOscar »

Rioma wrote: Wed Jan 08, 2025 4:33 am I'm trying to replace the electric beam sound by a custom one but I can't make it work.

This is the code I used

Code: Select all

data.raw.beam["laser-beam"] = {
	{
		filename = "__BetterSounds__/sounds/beam.ogg",
		volume = 1
	}
}
Well according to https://github.com/wube/factorio-data/b ... s.lua#L175,

the sound is actually in "working_sound.sound", moreover there are other fields there, so instead of discarding them I suggest merging them:

Code: Select all

require("util")
table.merge(data.raw.beam["laser-beam"].working_sound.sound, {
		filename = "__BetterSounds__/sounds/beam.ogg",
		volume = 1 })
Post Reply

Return to “Modding help”