--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/place-sounds/control.lua Wed Jul 02 23:53:32 2025 +0300 @@ -0,0 +1,43 @@ +script.on_event(defines.events.on_built_entity, function(event) + local sound_path = "entity-close/"..event.entity.name + if helpers.is_valid_sound_path(sound_path) + then + event.entity.surface.play_sound{ + path=sound_path, + position=game.players[event.player_index].position, + } + end +end) + +script.on_event(defines.events.on_robot_built_entity, function(event) + local sound_path = "entity-close/"..event.entity.name + if helpers.is_valid_sound_path(sound_path) + then + event.entity.surface.play_sound{ + path=sound_path, + position=event.entity.position, + } + end +end) + +script.on_event(defines.events.on_player_mined_entity, function(event) + local sound_path = "entity-open/"..event.entity.name + if helpers.is_valid_sound_path(sound_path) + then + event.entity.surface.play_sound{ + path=sound_path, + position=game.players[event.player_index].position, + } + end +end) + +script.on_event(defines.events.on_robot_mined_entity, function(event) + local sound_path = "entity-open/"..event.entity.name + if helpers.is_valid_sound_path(sound_path) + then + event.entity.surface.play_sound{ + path=sound_path, + position=event.entity.position, + } + end +end)