2014-10-02 08:49:54 +08:00
|
|
|
concommand.Add("printdxinfo", function()
|
|
|
|
print("DX Level: "..tostring(render.GetDXLevel()))
|
|
|
|
print("Supports HDR: "..tostring(render.SupportsHDR()))
|
|
|
|
print("Supports Pixel Shaders 1.4: "..tostring(render.SupportsPixelShaders_1_4()))
|
|
|
|
print("Supports Pixel Shaders 2.0: "..tostring(render.SupportsPixelShaders_2_0()))
|
|
|
|
print("Supports Vertex Shaders 2.0: "..tostring(render.SupportsVertexShaders_2_0()))
|
|
|
|
end)
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local ammonames = {
|
|
|
|
["pistol"] = "pistolammo",
|
|
|
|
["buckshot"] = "shotgunammo",
|
|
|
|
["smg1"] = "smgammo",
|
|
|
|
["ar2"] = "assaultrifleammo",
|
|
|
|
["357"] = "rifleammo",
|
|
|
|
["pulse"] = "pulseammo",
|
|
|
|
["battery"] = "50mkit",
|
|
|
|
["xbowbolt"] = "crossbowammo",
|
|
|
|
["impactmine"] = "impactmine",
|
|
|
|
["chemical"] = "chemical",
|
|
|
|
["gaussenergy"] = "nail"
|
|
|
|
}
|
|
|
|
|
|
|
|
concommand.Add("zs_quickbuyammo", function()
|
|
|
|
if ammonames[GAMEMODE.CachedResupplyAmmoType] then
|
|
|
|
RunConsoleCommand("zs_pointsshopbuy", "ps_"..ammonames[GAMEMODE.CachedResupplyAmmoType])
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local function GetViewModelPosition(self, pos, ang)
|
|
|
|
return pos + ang:Forward() * -256, ang
|
|
|
|
end
|
|
|
|
|
|
|
|
function DontDrawViewModel()
|
|
|
|
if SWEP then
|
|
|
|
SWEP.GetViewModelPosition = GetViewModelPosition
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Scales the screen based around 1080p but doesn't make things TOO tiny on low resolutions.
|
|
|
|
function BetterScreenScale()
|
2018-05-02 06:32:59 +08:00
|
|
|
return math.max(ScrH() / 1080, 0.851) * GAMEMODE.InterfaceSize
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function render.GetLightRGB(pos)
|
|
|
|
local vec = render.GetLightColor(pos)
|
|
|
|
return vec.r, vec.g, vec.b
|
|
|
|
end
|
|
|
|
|
|
|
|
function EasyLabel(parent, text, font, textcolor)
|
|
|
|
local dpanel = vgui.Create("DLabel", parent)
|
|
|
|
if font then
|
|
|
|
dpanel:SetFont(font or "DefaultFont")
|
|
|
|
end
|
|
|
|
dpanel:SetText(text)
|
|
|
|
dpanel:SizeToContents()
|
|
|
|
if textcolor then
|
|
|
|
dpanel:SetTextColor(textcolor)
|
|
|
|
end
|
|
|
|
dpanel:SetKeyboardInputEnabled(false)
|
|
|
|
dpanel:SetMouseInputEnabled(false)
|
|
|
|
|
|
|
|
return dpanel
|
|
|
|
end
|
|
|
|
|
|
|
|
function EasyButton(parent, text, xpadding, ypadding)
|
|
|
|
local dpanel = vgui.Create("DButton", parent)
|
|
|
|
if textcolor then
|
|
|
|
dpanel:SetFGColor(textcolor or color_white)
|
|
|
|
end
|
|
|
|
if text then
|
|
|
|
dpanel:SetText(text)
|
|
|
|
end
|
|
|
|
dpanel:SizeToContents()
|
|
|
|
|
|
|
|
if xpadding then
|
|
|
|
dpanel:SetWide(dpanel:GetWide() + xpadding * 2)
|
|
|
|
end
|
|
|
|
|
|
|
|
if ypadding then
|
|
|
|
dpanel:SetTall(dpanel:GetTall() + ypadding * 2)
|
|
|
|
end
|
|
|
|
|
|
|
|
return dpanel
|
|
|
|
end
|