diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-02 19:57:25 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-02 19:57:25 -0400 |
| commit | 26591b445527611af0cb5e35fa505aa870c96f3c (patch) | |
| tree | 0b42ff131f78eb38f019f07136668881d03fbace /gamemode | |
| parent | d37298c12ebc3d001c55d66b2319aeeda09dafd2 (diff) | |
| download | gmstranded-26591b445527611af0cb5e35fa505aa870c96f3c.tar.gz gmstranded-26591b445527611af0cb5e35fa505aa870c96f3c.tar.bz2 gmstranded-26591b445527611af0cb5e35fa505aa870c96f3c.zip | |
Started work on a lazy file transfer module
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/shared/lazyfiletransfer.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gamemode/shared/lazyfiletransfer.lua b/gamemode/shared/lazyfiletransfer.lua new file mode 100644 index 0000000..4169911 --- /dev/null +++ b/gamemode/shared/lazyfiletransfer.lua @@ -0,0 +1,44 @@ +--Lazy file transfer, loads files after the client has connected! +--[[ +Uses: + GM.DebugLazyFileTransfer + Can be: true, false + GM.LazyFileTransferType + Can be: lua, http + GM.GAMEMODE_FOLDER_NAME + Should be the folder name for the gamemode +]] + +if(CLIENT) then + GAMEMODE.LazyFileTransferTable = {} +end +if(SERVER) then + GM.LazyFileTransferTable = {} + util.AddNetworkString("RequestLazyFile")--Called on the client + util.AddNetworkString("SendLazyFile")--Called on the server +end + +function requestLazyFile(name) + +end + +function addLazyFile(name) + if(CLIENT) then return end + if(GM.DebugLazyFileTransfer) then + print("Adding file to be lazily transfered:") + print(name) + end + table.insert(GM.LazyFileTransferTable,name) +end + +if(SERVER) then + net.Receive( "RequestLazyFile", function(len, ply) + local partialpath = net.ReadString() + local filepath = "gamemodes/" .. GM.GAMEMODE_FOLDER_NAME .. partialpath + if(GM.DebugLazyFileTransfer) then + print("Request for lazy file recived:") + print(filepath) + end + local filedata = file.Open( filepath, 'r', "MOD" ) + end) +end |
