place-sounds/data-final-fixes.lua

Wed, 02 Jul 2025 23:53:32 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Wed, 02 Jul 2025 23:53:32 +0300
changeset 12
2e09a72b2dfa
permissions
-rw-r--r--

Added a mod that plays placement sounds

---@class entity EntityPrototype
---@class item ItemPrototype
local function copy_item_sounds_to_entity(item, entity)
    entity.open_sound = table.deepcopy(item.pick_sound)
    entity.close_sound = table.deepcopy(item.drop_sound)
end

-- prevent metallic machine sounds when placing power poles
local sounds = require("__base__.prototypes.entity.sounds")
for _, electric_pole in pairs(data.raw["electric-pole"])
do
    electric_pole.open_sound = sounds.electric_large_open
    electric_pole.close_sound = sounds.electric_large_close
end

-- prevent metallic machine sounds when placing stuff made of bricks
copy_item_sounds_to_entity(data.raw.item["stone-furnace"], data.raw.furnace["stone-furnace"])
copy_item_sounds_to_entity(data.raw.item["stone-wall"], data.raw.wall["stone-wall"])

mercurial