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) ]]