• GMod - What are you working on? November 2017 (#75)
    191 replies, posted
Made a thing that lets you add clientside props to entities easily since I was doing it by hand and wanted to kill myself idk if it's useful for anyone but cool to have Just build ent in sandbox and constraint all extra props and then you have cool decorated ent Code is pretty self explanitory if anyone wants to use it local function cmd(s) concommand.Add(s,function(ply,cmd,args,ss) RunConsoleCommand("cmd", s, ss) end) end if CLIENT then function printLocalPropsLua() print([[ local function initClEnts(ent) ent.draw_ents_a = {} for k,v in pairs(draw_ents) do local mdl = ClientsideModel(v[1]) table.insert(ent.draw_ents_a,{mdl,v[2],v[3]}) mdl:SetModelScale(v[4],0) end end local function endClEnts(ent) for k,v in pairs(ent.draw_ents_a) do v[1]:Remove() end end local function drawClEnts(ent) for k,v in pairs(ent.draw_ents_a) do v[1]:SetPos(ent:LocalToWorld(v[2])) v[1]:SetAngles(ent:LocalToWorldAngles(v[3])) v[1]:DrawModel() end end ]]) end net.Receive("localpropsent",function() local ent = net.ReadEntity() print("--Model = '" .. ent:GetModel() .. "'") local s = "local draw_ents = {" for k,v in pairs(net.ReadTable()) do if v == ent then continue end local pos = ent:WorldToLocal(v:GetPos()) local ang = ent:WorldToLocalAngles(v:GetAngles()) s = s .. ("\n\t{ [[%s]], Vector(%s,%s,%s), Angle(%s,%s,%s), %s },"):format(v:GetModel(),pos.x,pos.y,pos.z,ang.x,ang.y,ang.z,v:GetModelScale()) end s = s .. "\n}" print(s) printLocalPropsLua() end) cmd("v_printlocalprops") cmd("v_modelscale") else util.AddNetworkString("localpropsent") concommand.Add("v_modelscale",function(ply,cmd,args) if not ply:IsSuperAdmin() then return end local ent = ply:GetEyeTrace().Entity ent:SetModelScale(tonumber(args[1]),0) end) concommand.Add("v_printLocalProps",function(ply) if not ply:IsSuperAdmin() then return end net.Start("localpropsent") net.WriteEntity(ply:GetEyeTrace().Entity) net.WriteTable(constraint.GetAllConstrainedEntities(ply:GetEyeTrace().Entity)) net.Send(ply) end) end Eg: Gives you this output: --Model = 'models/props/cs_militia/table_shed.mdl' local draw_ents = {     { [[models/props/cs_office/radio.mdl]], Vector(10.024369239807,-27.766258239746,10.125), Angle(-0.263671875,-36.386707305908,-0.087890632450581), 1 }, --[[ this post is already long enough ...... ]] } local function initClEnts(ent) ent.draw_ents_a = {} for k,v in pairs(draw_ents) do local mdl = ClientsideModel(v[1]) table.insert(ent.draw_ents_a,{mdl,v[2],v[3]}) mdl:SetModelScale(v[4],0) end end local function endClEnts(ent) for k,v in pairs(ent.draw_ents_a) do v[1]:Remove() end end local function drawClEnts(ent) for k,v in pairs(ent.draw_ents_a) do v[1]:SetPos(ent:LocalToWorld(v[2])) v[1]:SetAngles(ent:LocalToWorldAngles(v[3])) v[1]:DrawModel() end end Which can be turned into this:
Remove the boot animation and it's very nice.
i dunno about you, but I really like how the info in Destiny 2 is presented in confirmation dialogs i wish i knew how to make that smaller, sorry
New thread is here!
Sorry, you need to Log In to post a reply to this thread.