spacebuild/spacebuild

View on GitHub
lua/caf/core/client/cl_tab.lua

Summary

Maintainability
Test Coverage
--
--    Custom Addon Framework Tab Module and Tool Helper
--

include("caf/core/shared/caf_tools.lua")

local usetab = CreateClientConVar("CAF_UseTab", "1", true, false)

local function CAFTab()
    if usetab:GetBool() then
        spawnmenu.AddToolTab("Custom Addon Framework", "CAF")
    end
end

hook.Add("AddToolMenuTabs", "CAFTab", CAFTab)

function CAF_BuildCPanel(cp, toolname, listname, custom)
    cp:AddControl("CheckBox", { Label = "Don't Weld", Command = toolname .. "_DontWeld" })
    cp:AddControl("CheckBox", { Label = "Allow welding to world", Command = toolname .. "_AllowWorldWeld" })
    cp:AddControl("CheckBox", { Label = "Make Frozen", Command = toolname .. "_Frozen" })
    local ListControl = vgui.Create("CAFControl")
    cp:AddPanel(ListControl)
    ListControl:SetList(toolname, listname)
end