Skip to content

Commit

Permalink
Add sound replacer localization file
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed Aug 6, 2024
1 parent a5d4c1a commit 0401d4c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
35 changes: 13 additions & 22 deletions lua/weapons/gmod_tool/stools/acfsound.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local cat = ((ACF.CustomToolCategory and ACF.CustomToolCategory:GetBool()) and "ACF" or "Construction")
TOOL.Category = cat
TOOL.Name = "#Tool.acfsound.name"
TOOL.Name = "#tool.acfsound.name"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar["pitch"] = "1"
Expand All @@ -12,16 +12,6 @@ TOOL.Information = {
{ name = "info" }
}

if CLIENT then
language.Add("Tool.acfsound.name", "ACF Sound Replacer")
language.Add("Tool.acfsound.desc", "Change sounds of ACF entities")

language.Add("Tool.acfsound.left", "Apply sound")
language.Add("Tool.acfsound.right", "Copy sound")
language.Add("Tool.acfsound.reload", "Set default sound")
language.Add("Tool.acfsound.0", "Use an empty sound path to disable sound")
end

ACF.SoundToolSupport = ACF.SoundToolSupport or {}

local Sounds = ACF.SoundToolSupport
Expand Down Expand Up @@ -147,9 +137,9 @@ local function IsReallyValid(trace, ply)

if not ACF.SoundToolSupport[class] then
if string.StartWith(class, "acf_") then
ACF.SendNotify(ply, false, class .. " is not supported by the sound tool!")
ACF.SendNotify(ply, false, "#tool.acfsound.unsupported_class")
else
ACF.SendNotify(ply, false, "Only ACF entities are supported by the ACF sound tool!")
ACF.SendNotify(ply, false, "#tool.acfsound.unsupported_ent")
end

return false
Expand Down Expand Up @@ -212,7 +202,7 @@ if CLIENT then
function TOOL.BuildCPanel(panel)
local wide = panel:GetWide()

local Desc = panel:Help("Replace default sounds of certain ACF entities with this tool.\n")
local Desc = panel:Help("#tool.acfsound.help")
Desc:SetFont("ACF_Control")

local SoundNameText = vgui.Create("DTextEntry", ValuePanel)
Expand All @@ -226,7 +216,7 @@ if CLIENT then
panel:AddItem(SoundNameText)

local SoundBrowserButton = vgui.Create("DButton")
SoundBrowserButton:SetText("Open Sound Browser")
SoundBrowserButton:SetText("#tool.acfsound.open_browser")
SoundBrowserButton:SetFont("ACF_Control")
SoundBrowserButton:SetWide(wide)
SoundBrowserButton:SetTall(20)
Expand All @@ -243,7 +233,7 @@ if CLIENT then
SoundPre:SetVisible(true)

local SoundPrePlay = vgui.Create("DButton", SoundPre)
SoundPrePlay:SetText("Play")
SoundPrePlay:SetText("#tool.acfsound.play")
SoundPrePlay:SetFont("ACF_Control")
SoundPrePlay:SetVisible(true)
SoundPrePlay:SetIcon("icon16/sound.png")
Expand All @@ -252,7 +242,7 @@ if CLIENT then
end

local SoundPreStop = vgui.Create("DButton", SoundPre)
SoundPreStop:SetText("Stop")
SoundPreStop:SetText("#tool.acfsound.stop")
SoundPreStop:SetFont("ACF_Control")
SoundPreStop:SetVisible(true)
SoundPreStop:SetIcon("icon16/sound_mute.png")
Expand All @@ -272,7 +262,7 @@ if CLIENT then
end

local CopyButton = vgui.Create("DButton")
CopyButton:SetText("Copy to Clipboard")
CopyButton:SetText("#tool.acfsound.copy")
CopyButton:SetFont("ACF_Control")
CopyButton:SetWide(wide)
CopyButton:SetTall(20)
Expand All @@ -284,7 +274,7 @@ if CLIENT then
panel:AddItem(CopyButton)

local ClearButton = vgui.Create("DButton")
ClearButton:SetText("Clear Sound")
ClearButton:SetText("#tool.acfsound.clear")
ClearButton:SetFont("ACF_Control")
ClearButton:SetWide(wide)
ClearButton:SetTall(20)
Expand All @@ -296,10 +286,11 @@ if CLIENT then
end
panel:AddItem(ClearButton)

panel:NumSlider("Volume", "acfsound_volume", 0.1, 2, 2)
panel:NumSlider("Pitch", "acfsound_pitch", 0.1, 2, 2)
panel:NumSlider("#tool.acfsound.volume", "acfsound_volume", 0.1, 2, 2)
panel:NumSlider("#tool.acfsound.pitch", "acfsound_pitch", 0.1, 2, 2)

panel:ControlHelp("Adjust the volume and pitch of the sound. Support available for guns and engines only.")
local SettingsHelp = panel:ControlHelp("#tool.acfsound.settings_help")
SettingsHelp:SetFont("ACF_Control")
end

--[[
Expand Down
22 changes: 22 additions & 0 deletions resource/localization/en/acf_tool_sound.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Strings for the ACF Sound Replacer tool
tool.acfsound.name=ACF Sound Replacer
tool.acfsound.desc=Change sounds of ACF entities

tool.acfsound.left=Apply sound
tool.acfsound.right=Copy sound
tool.acfsound.reload=Set default sound
tool.acfsound.0=Use an empty sound path to disable sound

tool.acfsound.unsupported_class=This ACF entity class is not supported by the sound tool!
tool.acfsound.unsupported_ent=Only ACF entities are supported by the ACF sound tool!

tool.acfsound.help=Replace default sounds of certain ACF entities with this tool.\n
tool.acfsound.open_browser=Open Sound Browser
tool.acfsound.play=Play
tool.acfsound.stop=Stop
tool.acfsound.copy=Copy to Clipboard
tool.acfsound.clear=Clear Sound

tool.acfsound.volume=Volume
tool.acfsound.pitch=Pitch
tool.acfsound.settings_help=Adjust the volume and pitch of the sound. Support available for guns and engines only.

0 comments on commit 0401d4c

Please sign in to comment.