Skip to content

Commit

Permalink
Remove debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
saibotk committed Oct 7, 2019
1 parent fbda34a commit 06f73e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
2 changes: 0 additions & 2 deletions gamemodes/terrortown/gamemode/client/cl_hud_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ local function UpdateHUD(name)
return
end

MsgN("[TTT2][DEBUG] Received HUD Update with HUD: " .. tostring(name))

HUDEditor.StopEditHUD()

-- save the old HUDs values
Expand Down
4 changes: 0 additions & 4 deletions gamemodes/terrortown/gamemode/server/sv_hud_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ net.Receive("TTT2RequestHUD", function(_, ply)
local oldHUD = net.ReadString() -- current HUD as fallback
local forced = HUDManager.GetModelValue("forcedHUD")

MsgN("[TTT2][DEBUG] User " .. ply:Nick() .. " requested to change the HUD to " .. tostring(hudname) .. ", alternative: " .. tostring(oldHUD))

if not forced then
local restrictions = HUDManager.GetModelValue("restrictedHUDs") or {}
local restricted = false
Expand Down Expand Up @@ -222,8 +220,6 @@ net.Receive("TTT2RequestHUD", function(_, ply)
hudToSend = HUDManager.GetModelValue("defaultHUD") or "pure_skin"
end

MsgN("[TTT2][DEBUG] The user will receive the HUD: " .. hudToSend)

net.Start("TTT2ReceiveHUD")
net.WriteString(hudToSend)
net.Send(ply)
Expand Down
22 changes: 5 additions & 17 deletions lua/bind/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,26 @@ end
local function SaveBinding(name, button)
if DBCreateTable() then
local result = sql.Query("INSERT INTO " .. tablename .. " VALUES('" .. LocalPlayer():SteamID64() .. "', " .. sql.SQLStr(name) .. ", " .. sql.SQLStr(button) .. ")")
if result ~= false then
print("[TTT2][BIND] Saved binding...")
else
print("[TTT2][BIND][ERROR] Wasn't able to save binding...")
if result == false then
print("[TTT2][BIND][ERROR] Wasn't able to save binding to database...")
end
end
end

---
-- @internal
local function DBRemoveBinding(name, button)
print("[TTT2][BIND] Deleting key from DB")

if DBCreateTable() then
local result = sql.Query("DELETE FROM " .. tablename .. " WHERE guid = '" .. LocalPlayer():SteamID64() .. "' AND name = " .. sql.SQLStr(name) .. " AND button = " .. sql.SQLStr(button) )
if result ~= false then
print("[TTT2][BIND] Removed binding...")
else
print("[TTT2][BIND][ERROR] Wasn't able to remove binding...")
if result == false then
print("[TTT2][BIND][ERROR] Wasn't able to remove binding from database...")
end
end
end

---
-- @internal
local function TTT2LoadBindings()
print("[TTT2][BIND] Loading button bindings...")

if DBCreateTable() then
local result = sql.Query("SELECT * FROM " .. tablename .. " WHERE guid = '" .. LocalPlayer():SteamID64() .. "'")
if istable(result) then
Expand Down Expand Up @@ -177,16 +169,12 @@ end
-- @param string name
-- @param boolean persistent
function bind.Remove(btn, name, persistent)
print("[TTT2][BIND] Attempt to remove binding " .. name .. " on button id " .. tonumber(btn))

if persistent then
DBRemoveBinding(name, btn) -- Still try to delete from DB
end

if not Bindings[btn] then return end

print("[TTT2][BIND] removing binding")

for i, v in pairs(Bindings[btn]) do
if v == name then
Bindings[btn][i] = nil
Expand Down Expand Up @@ -273,7 +261,7 @@ end


---
-- Add a binding to run a command when the button is pressed. This function is not used to register a new binding shown in
-- Add a binding to run a command when the button is pressed. This function is not used to register a new binding shown in
-- the UI, but to bind a specific key to a command
-- @param number btn The button ID, see: <a href="BUTTON_CODE_Enums">https://wiki.garrysmod.com/page/Enums/BUTTON_CODE</a>
-- @param string name The command that should be executed
Expand Down

0 comments on commit 06f73e1

Please sign in to comment.