diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-11-06 21:15:18 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-11-06 21:15:18 -0500 |
| commit | 0fe57f5eb755d618f3d35adf6ab2e19a5c16792a (patch) | |
| tree | 1d1f4f05da82c9796232c13c987844f86f3da748 /lua | |
| parent | 89c8cbd6f482415a82a1d7c841f1a5c1b185c9fa (diff) | |
| download | artery_editor-0fe57f5eb755d618f3d35adf6ab2e19a5c16792a.tar.gz artery_editor-0fe57f5eb755d618f3d35adf6ab2e19a5c16792a.tar.bz2 artery_editor-0fe57f5eb755d618f3d35adf6ab2e19a5c16792a.zip | |
allows for saved props
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/autorun/saveprops.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lua/autorun/saveprops.lua b/lua/autorun/saveprops.lua new file mode 100644 index 0000000..ec3455d --- /dev/null +++ b/lua/autorun/saveprops.lua @@ -0,0 +1,39 @@ +if CLIENT then return end +local function saveparts() + local spawndata = {"local e"} + for k,v in pairs(ents.GetAll()) do + if v:GetPersistent() then + local c = v:GetColor() + local a = v:GetAngles() + local p = v:GetPos() + spawndata[#spawndata + 1] = string.format([[ +e = ents.Create(%q) +e:SetModel(%q) +e:SetMaterial(%q) +e:SetColor(Color(%d,%d,%d,%d)) +e:SetAngles(Angle(%d,%d,%d)) +e:SetPos(Vector(%d,%d,%d)) +e:Spawn() +e:GetPhysicsObject():EnableMotion(false) + ]], + v:GetClass(), + v:GetModel(), + v:GetMaterial(), + c.r,c.g,c.b,c.a, + a.p,a.y,a.r, + p.x,p.y,p.z) + end + end + local fstr = table.concat(spawndata,"\n") + local path = "artery/maps/" .. game.GetMap() .. "/ents.txt" + print("Writing file", fstr," to",path) + file.Write(path,fstr) +end + +concommand.Add("artery_save_persistent_props",saveparts) + +--[[ +hook.Add("ShutDown","artery_save_persistent_props",function() + +end) +]] |
