Resource Smart

http://www.colzdragon.net/media/image/resourcesmartbanner.png

What is it?
Basicly an addon that allows you to send files to your clients easily. You can also precache all the sounds/models being sent to your clients (Setting).
How do I use it?
Browse to lua/ResourceSmart/framework.lua and edit the table to your wanting using the other table entries as examples.
Notes
Do not put any of these before your table entries (They are automatically added depending on the extension):
sound/
models/
materials/
resource/
(If you need to add anything else through the system that doesn’t use the above directories INCLUDE the directory in the entry)
If you want to add directories you can do:
RSAddDir( Dir )
Commands
rs_toggle <1/0> (Enables/Disables Resource Smart)
rs_downloads (Displays all downloads)
rs_commandlist (Displays all commands)
rs_toggle_pc_sound <1/0> (Toggles Sound Precaching)
rs_toggle_pc_model <1/0> (Toggles Model Precaching)
Is anything planned in the future?
Yes, I plan on making a GUI for it and more settings/features.
What files does it support?
Particles
Fonts
Materials
Models
Sounds
(Anything else can be used with it but requires the name of the folder before it, etc: data/helixwashere.lua)
Media
If its bad quality click the link under the media tags and set it to 1080p

http://www.colzdragon.net/media/image/rs/snap2.png

Download
If you’re going to complain that I talked about something in this thread that isn’t in the addon and you’re using the Garrysmod.org download links get the SVN, it is always up to date.
http://www.garrysmod.org/img/?t=dll&id=89165
http://www.garrysmod.org/img/?t=dll&id=89166
http://www.garrysmod.org/img/?t=dll&id=89229
http://www.garrysmod.org/img/?t=dll&id=89578

Thats pretty useful for server owners!

Rated artistic because I like the logo/banner.

Rated useful.

SVN Added, Precaching bug fixed.

Very impressed to see you made a video Helix! Good job dude, I could of said this in steam chat, but I’d rather say it here.

Revision 3
Resource Smart now uses Metatables
Cleaned up Resource Smart code
Resource Smart now saves ingame set settings on map reload/gamemode, reload etc. (Now using ConVars)
rs_toggle <0/1>
rs_toggle_pc_sound <0/1>
rs_toggle_pc_model <0/1>

Rated useful
Brilliant.

So this increases download speeds for… what? People joining servers?

No, for the little men in the servers who have to run the files back and forth from client to server.

But anyway, nice release. It’d be nice if it wasn’t solely compatible with Evolvemod, though.

Hah, thank you. So installing this reduces download times for models and stuff when you first join. Any reason this doesn’t apply to LUA/text files as well?

It no longer is. (SVN)

No, this gives you the ability to easily send files to the client instead of having to do resource.AddFile a million times.

Thread updated because people were confused on what this is

So this could save you from long connection times and actually download the least important stuff when actually on the server? if so this is really useful!

You guys have the wrong idea as to what this is, I think.

[editline]03:42PM[/editline]

This is, basically, an alternative to resource.AddFile, which is neglected by a lot of scripts.

[editline]03:42PM[/editline]

Incredibly useful if you own a server.

Uh, no. Not at all. This precaches any resources you set and adds them to download to the client on join. It just puts it all in one location instead of having many resource.AddFiles everywhere.

I’ll be honest though, from a server admin standpoint, this doesn’t seem very practical to me unless I add comments beside every entry so I know what certain files refer to in case I want to remove something. Most of the scripts I write tend to have separate resource.AddFiles so I don’t have to make sure I’ve removed everything from one script or another if I choose to disable a part.

Of course, this is all from my perspective as a coder that likes keeping addons separate. It might be useful to new people who don’t know how to do some of these things.

If this is what I think it is, then I find it incredibly flawed. Say I am developing an addon which has custom sounds, model etc and I add these files to the ResourceSmart table, if I decide to stop development for some reason and delete the addon or decide to disable the addon, I would have to go back into ResourceSmart and delete every entry of the table that relates to my addon. If I did this the conventional way and resource.AddFile’d all the custom files in the actual addons lua, when I go to delete the addon the resource.AddFiles will also be removed, saving me the hastle of removing them myself.

Exactly my point. It’s not practical.

IS there a way of making a user download stuff when already connected and playing?

Nope.

Well, the whole point I made this project was because I was tired of placing resource.AddFile’s everywhere in my gamemode. So I decided to make a “module” that has them all in one place. Eventually I was thinking of releasing it so added some auto-precaching settings so that it was worth downloading. I insist that you write your own Resource.AddFile’s in your addon. But if you have them everywhere in a gamemode then this is for you. Hmm… I’m going to release a “module” form of this that you just have to include and AddCSLuaFile.

If you took the time to view the code, you would see in my function to show downloads, it clearly lists the first value of the table:



local function ShowDownloadList( ply )
	if not Toggled:GetBool() then
		ply:PrintMessage( HUD_PRINTCONSOLE, "Resource Smart is disabled!" )
		return;
	end
		ply:PrintMessage( HUD_PRINTCONSOLE, string.format( "**%s%s%s are being precached**", 
		(PCSToggled) and "Sounds" or "", 
		(PCSToggled and PCMToggled) and "/" or "", 
		(PCMToggled) and "Models" or "" ) )
	for k, v in pairs( DownloadList ) do
		local f = RSCreateFile( v )
		if f:IsSound() then
			ply:PrintMessage( HUD_PRINTCONSOLE, "[" .. k .. "] " .. v .. " [Sound]" )
		elseif f:IsMaterial() then
			ply:PrintMessage( HUD_PRINTCONSOLE, "[" .. k .. "] " .. v .. " [Material]" )
		elseif f:IsModel() then
			ply:PrintMessage( HUD_PRINTCONSOLE, "[" .. k .. "] " .. v .. " [Model]" )
		elseif f:IsFont() then
			ply:PrintMessage( HUD_PRINTCONSOLE, "[" .. k .. "] " .. v .. " [Font]" )
		elseif f:IsParticle() then
			ply:PrintMessage( HUD_PRINTCONSOLE, "[" .. k .. "] " .. v .. " [Particle]" )
		else
			ply:PrintMessage( HUD_PRINTCONSOLE, "[" .. k .. "] " .. v .. " [UNKNOWN]" )
		end
	end
end
concommand.Add( CommandPrefix .. CommandList.List, ShowDownloadList )


EDIT:

Added Resource Smart Module for gamemodes to the SVN and Garrysmod.org.

Sounds like a great idea, although, as i’m a new server owner… I have absolutely no idea what to do with this. Do I just put the file paths in the download list? Do I need all that “DownloadList.examplemodel” stuff, since it says example in it? Call me a noob or what ever, but for people with little lua experience, this is going to look confusing. Which it does.

Just a few simple sentences of instruction would be appreciated.

The youtube video is of no help either, just a bunch of console code that we can’t read.