--[[
--Name: Resource Smart
--Author: Helix Nebula
--Version: 2.0
--]]
--DO NOT INCLUDE THE MAIN FOLDER, THAT WILL BE AUTOMATICALLY ADDED etc:
--NOT RIGHT: models/cake.mdl
--RIGHT: cake.mdl
--NOT RIGHT: sound/lol.wav
--RIGHT: lol.wav
--FOR MODELS ONLY WRITE models/cake.mdl NOT THE .phys OR ANYTHING ELSE
--PLEASE REMEMBER TO SET THE SETTINGS BEFORE USE
--**Including**--
include("parts.lua") --Metatables
--**TABLES**--
ResourceSmart = {}
ResourceSmart.DownloadList = {}
ResourceSmart.Commandlist = {}
ResourceSmart.VersionURL = "http://www.colzdragon.net/resourcesmart_ver.txt"
ResourceSmart.Version = 2
ResourceSmart.Prefix = "rs_"
ResourceSmart.ToggleDownloadList = CreateConVar( ResourceSmart.Prefix .. "commands", 1, FCVAR_NOTIFY )
ResourceSmart.Toggled = CreateConVar( ResourceSmart.Prefix .. "toggle", 1, FCVAR_NOTIFY )
ResourceSmart.PCSToggled = CreateConVar( ResourceSmart.Prefix .. "toggle_pc_sound", 1, FCVAR_NOTIFY )
ResourceSmart.PCMToggled = CreateConVar( ResourceSmart.Prefix .. "toggle_pc_model", 1, FCVAR_NOTIFY )
RSAddFile( "FistsModelV", "weapons/v_pvp_ire.mdl" )
RSAddFile( "FistsModelW", "weapons/w_pvp_ire.mdl" )
RSAddDir( "materials/shane/hud/" )
RSAddDir( "sound/colzdragon/" )
RSAddDir( "sound/colzdragon/dice/" )
RSAddDir( "sound/colzdragon/Rage/" )
RSAddDir( "sound/sharpeye/" )
RSAddDir( "materials/depthhud/" )
RSAddDir( "materials/colzdragon/chatbox/" )
RSNMapAddDir( "sound/colzdragon/weather/", "rp_downtown_v2" )
if ResourceSmart.Toggled:GetBool() then
for k, v in pairs( DownloadList ) do
local f = RSCreateFile( v )
f:AddFile()
f:Precache( PreCacheModels, PreCacheSounds )
end
end
local function ShowDownloadList( ply )
if not ResourceSmart.Toggled:GetBool() then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>> ResourceSmart[ Core ] >> is disabled" )
return;
end
ply:ChatPrint( HUD_PRINTCONSOLE, string.format( "**%s%s%s are being precached**" ) )
(ResourceSmart.PCSToggled) and "Sounds" or "",
(ResourceSmart.PCSToggled and ResourceSmart.PCMToggled) and "/" or "",
(ResourceSmart.PCMToggled) and "Models" or "" ) )
for k, v in pairs( DownloadList ) do
local f = RSCreateFile( v )
if f:IsSound() then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Sound<<" )
elseif f:IsMaterial() then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Material<<" )
elseif f:IsModel() then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Model<<" )
elseif f:IsFont() then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Font<<" )
elseif f:IsParticle() then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Particle<<" )
else
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>UNKNOWN<<" )
end
end
end
concommand.Add( ResourceSmart.Prefix .. "downloads", ShowDownloadList )
local function DownloadSystemCommandList( ply )
if ResourceSmart.ToggleDownloadList:GetBool() then
ply:PrintMessage( HUD_PRINTCONSOLE, ">>> ResourceSmart[ Core ] >> List of Commands" )
for k, v in pairs( CommandList ) do
ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. ResourceSmart.Prefix .. v )
end
return;
else
ply:ChatPrint( HUD_PRINTCONSOLE, ">>> ResourceSmart[ Core ] >> Command Listing is Disabled!" )
end
end
concommand.Add( ResourceSmart.Prefix .. "commands", DownloadSystemCommandList )