Skip to content

Commit

Permalink
don't depend on chatsounds.tree
Browse files Browse the repository at this point in the history
  • Loading branch information
CapsAdmin committed May 16, 2020
1 parent 069300f commit 6607ddd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 1 addition & 5 deletions engine/lua/libraries/autocomplete.lua
Expand Up @@ -118,6 +118,7 @@ function autocomplete.DrawFound(id, x, y, found, max, offset)
end
if str then
local _, h = gfx.GetTextSize(str)
render2d.SetAlphaMultiplier(0.75)
gfx.DrawText(str, 5, (i - offset) * h + height_offset)
height_offset = height_offset + h
width_offset = 5
Expand All @@ -129,11 +130,6 @@ function autocomplete.DrawFound(id, x, y, found, max, offset)
local alpha = (-(i / max) + 1) ^ 5

render2d.SetAlphaMultiplier(alpha)
if v.id ~= "chatsounds" then
render2d.SetColor(0,1,0,1)
else
render2d.SetColor(1,1,1,1)
end

local _, h = gfx.GetTextSize(v.val)
gfx.DrawText(((env[id].scroll + i - 1)%#found + 1) .. ". " .. v.val, 5 + width_offset, (i - offset) * h + height_offset)
Expand Down
6 changes: 3 additions & 3 deletions game/lua/libraries/audio/chatsounds/chatsounds.lua
Expand Up @@ -611,7 +611,9 @@ do
end
end

table.insert(trees, chatsounds.tree)
if chatsounds.tree then
table.insert(trees, chatsounds.tree)
end

local root = table.virtualmerge({}, trees)

Expand Down Expand Up @@ -911,8 +913,6 @@ function chatsounds.Update()
end

function chatsounds.Say(str, seed, custom_id)
if not chatsounds.tree then return end

str = str:lower()

if str == "sh" or (str:find("sh%s") and not str:find("%Ssh")) or (str:find("%ssh") and not str:find("sh%S")) then
Expand Down
4 changes: 3 additions & 1 deletion game/lua/libraries/audio/chatsounds/list_parsing.lua
Expand Up @@ -64,7 +64,9 @@ function chatsounds.GenerateAutocomplete()
autocomplete.AddList(id, list)
end

build(chatsounds.list, "chatsounds")
if chatsounds.list then
build(chatsounds.list, "chatsounds")
end

if chatsounds.custom then
for id, data in pairs(chatsounds.custom) do
Expand Down

0 comments on commit 6607ddd

Please sign in to comment.