diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-02-18 21:55:55 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-02-18 21:55:55 -0500 |
| commit | a22cbeddc5f8fb61e87a30aa14ba354de5cf4431 (patch) | |
| tree | 297c1dbfb23185c5246e1dd7bdec52253a24ba60 /gamemode/shared/sh_pac.lua | |
| parent | f4ee62bb0725a3ae94477b2818071f506e4dfd9f (diff) | |
| download | artery-a22cbeddc5f8fb61e87a30aa14ba354de5cf4431.tar.gz artery-a22cbeddc5f8fb61e87a30aa14ba354de5cf4431.tar.bz2 artery-a22cbeddc5f8fb61e87a30aa14ba354de5cf4431.zip | |
Updates
Diffstat (limited to 'gamemode/shared/sh_pac.lua')
| -rw-r--r-- | gamemode/shared/sh_pac.lua | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/gamemode/shared/sh_pac.lua b/gamemode/shared/sh_pac.lua deleted file mode 100644 index 1d4da41..0000000 --- a/gamemode/shared/sh_pac.lua +++ /dev/null @@ -1,137 +0,0 @@ ---[[ - All the functions related to networking pac's -]] -if CLIENT then - local what - local function applypac(who,pacname) - local pactxt = file.Read("artery/pacs/"..pacname..".txt","DATA") - print("got pac txt",pactxt) - if pactxt == nil then - print("requesting pac") - net.Start("requestpac") - net.WriteString(pacname) - net.SendToServer() - timer.Simple(5,function() --5 seconds is probably enough time to load a pac, right? - print("trying to re-apply pac") - applypac(who,pacname) - end) - else - if who.AttachPACPart == nil then - print("setting up ent for pac") - pac.SetupENT(who) - end - print("pactxt was",pactxt) - local pactbl = CompileString("return {"..pactxt.."}",pacname)() - print("pactbl is") - PrintTable(pactbl) - print("who is",who) - who:AttachPACPart(pactbl) - print("Pac Equiped!") - - what = who:FindPACPart(pactbl, "ball") - print("what was", what) - if what ~= nil then - print("What's position:") - for k,v in pairs(what) do - print(k,":",v) - end - print(what:GetDrawPosition(),type(what:GetDrawPosition())) - end - end - end - - local RecordTrace = false - local swingtime - hook.Add("Tick","weapon_trace",function() - if what ~= nil and ART.TraceWeapon and RecordTrace then - local pos = what:GetDrawPosition() - local ppos = LocalPlayer():GetPos() - for k = 1,3 do pos[k] = pos[k] - ppos[k] end -- Now is a local vector, player is the origin - print(string.format("{%1.3f,Vector(%d,%d,%d)},",swingtime/1000,pos[1],pos[2],pos[3]-64)) - swingtime = swingtime + util.TimerCycle() - else - swingtime = util.TimerCycle() - end - end) - - concommand.Add("artery_dev_traceweapons",function(ply,cmd,args) - RecordTrace = args[1] == "1" - end) - - local function removepac(who,pacname) - local pactxt = file.Read("artery/pacs/"..pacname..".txt","DATA") - assert(pactxt ~= nil, "Attempted to remove a pac that dosn't exist") - assert(who.RemovePACPart ~= nil,"That entity isn't set up to have pacs!") - local pactbl = CompileString("return {" .. pactxt .. "}", pacname)() - who:RemovePACPart(pactbl) - end - - net.Receive("loadpac",function() - local pacname = net.ReadString() - local pacdata = util.Decompress(net.ReadString()) - file.Write("artery/pacs/"..pacname..".txt",pacdata) - end) - - net.Receive("applypac",function() - print("apply ing pac") - local towho = net.ReadEntity() - local pacname = net.ReadString() - applypac(towho,pacname) - end) - - net.Receive("removepac",function() - local towho = net.ReadEntity() - local pacname = net.ReadString() - removepac(towho,pacname) - end) -else - for _,v in pairs({ - "applypac", - "removepac", - "requestpac", - "loadpac", - })do util.AddNetworkString(v) end - - net.Receive("requestpac",function(ln,ply) - local pacname = net.ReadString() - local pacdata = file.Read("artery/pacs/"..pacname..".txt","DATA") - assert(pacdata ~= nil,string.format("Client %q requested pac that dosn't exist %q",ply:Nick(),pacname)) - net.Start("loadpac") - net.WriteString(pacname) - net.WriteString(util.Compress(pacdata)) - net.Send(ply) - end) - - local playerpacs = {} - ART.ApplyPAC = function(to,pacname) - print("Applying pac") - net.Start("applypac") - net.WriteEntity(to) - net.WriteString(pacname) - net.Broadcast() - playerpacs[to] = playerpacs[to] or {} - table.insert(playerpacs[to],pacname) - end - - hook.Add( "PlayerInitialSpawn", "loadpacs", function(ply) - timer.Simple(5,function() --Wait 5 seconds, hopefully they're ok to go by then - for k,v in pairs(playerpacs) do - for i,j in pairs(v) do - net.Start("applypac") - net.WriteEntity(k) - net.WriteString(j) - net.Send(ply) - end - end - end) - end) - - ART.RemovePAC = function(to,pacname) - net.Start("removepac") - net.WriteEntity(to) - net.WriteString(pacname) - net.Broadcast() - table.RemoveByValue(playerpacs[to], pacname) - end -end -local paclist |
