Python1320

Untitled

Feb 2nd, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.13 KB | None | 0 0
  1. --[[
  2.     bone meta concept is not written down yet
  3.    
  4.     there is a new editor being made by Declan. he can take his time and finish it up whenever. If he doesn't I'll (CapsAdmin) carefully make one myself
  5. ]]
  6.  
  7. do -- part creation concept
  8.  
  9.     do -- pac.pac.Color
  10.         --insert generic color object here
  11.     end
  12.    
  13.     PAC_RENDER_SCREEN = "RenderScreenspaceEffects" -- for screen effects
  14.     PAC_RENDER_PLAYER = "PostPlayerDraw" -- for models
  15.     PAC_RENDER_3D2D = "PostDrawOpaqueRenderables" -- for things like sprites
  16.  
  17.     do -- part
  18.         local PART = {}
  19.        
  20.         PART.Base = "base"
  21.         PART.DrawMode = PAC_RENDER_SCREEN
  22.        
  23.         function PART:Initialize()
  24.             -- ??
  25.         end
  26.        
  27.         function PART:Draw(outfit_owner, world_pos, world_angles)
  28.             local vec2 = world_pos:ToScreen()
  29.        
  30.             DrawSunbeams(
  31.                 self:GetDarken(),
  32.                 self:GetScale()
  33.                 self:GetSize(),
  34.                
  35.                 vec2.x / ScrW(),
  36.                 vec2.y / ScrH()
  37.             )      
  38.         end
  39.        
  40.         function PART:Think(outfit_owner)
  41.             -- non draw stuff here
  42.         end
  43.        
  44.         pac.AccessorFunction(PART, "darken", "Darken", function(var)
  45.             return math.Clamp(var, 0, 1)
  46.         end)
  47.        
  48.         pac.AccessorFunction(PART, "scale", "Scale", function(var)
  49.             return math.Clamp(var, -1, 1)
  50.         end)
  51.        
  52.         pac.AccessorFunction(PART, "size", "Size", function(var)
  53.             return math.Clamp(var, 0, 1)
  54.         end)
  55.        
  56.         function PART:IsVisible()
  57.             return self.darken < 1 and self.size > 0 and self.scale ~? 0
  58.         end
  59.        
  60.         pac.Register(PART, "sunbeams")
  61.     end
  62.    
  63.     do -- hooks
  64.         if SERVER then
  65.             hook.Add("PrePACOutfitApply", "", function(ply, outfit)
  66.                 if #outfit:GetParts() > 10 and not ply:IsAdmin() then
  67.                     return false, "you have too many parts in your outfit"
  68.                 end
  69.             end)
  70.         end
  71.         if CLIENT then
  72.             hook.Add("PrePACOutfitApply", "", function(ply, outfit)
  73.                 outfit:Save()
  74.             end)
  75.         end
  76.     end
  77. end
  78.  
  79. -- all Set functions should have a Get function
  80.  
  81. do -- data (pretty much a neat table)
  82.     local data = pac.NewData("animation")
  83.         data:SetLoop(true)
  84.         data:SetSequence(1 or "crouch")
  85.         data:SetRate(1)
  86.         data:SetOffset(10)
  87.         data:SetStart(0)
  88.         data:SetEnd(1)
  89.  
  90.     local data = pac.NewData("clipping")
  91.         data:SetName("my clip plane")
  92.  
  93.         data:SetBone("head")
  94.         data:SetDistance(10)
  95.         data:SetAngle(Angle(0,0))
  96.        
  97.     local data = pac.NewData("modelbone")
  98.         data:SetName("my bone")
  99.        
  100.         data:SetBone(1 or "head")
  101.         data:SetRedirectParent(false)
  102.        
  103.         data:SetScale(1)
  104.         data:SetVectorScale(Vector(1,1,1))
  105.        
  106.         data:SetLocalPos(Vector(0,0,0))
  107.         data:SetLocalAngles(Angle(0,0,0))      
  108.        
  109.     local data = pac.NewData("modelbones")
  110.         data:Add(data)
  111.         data:Remove("my bone")
  112.         data:GetBone("my bone")
  113.        
  114.         data:SetBoneMerge(false)
  115.         data:SetFixFingers(false)
  116. end
  117.  
  118. do -- part
  119.     local part = pac.NewPart("my hat", "base")
  120.         part:SetBone(1 or "head")
  121.  
  122.         part:SetLocalPos(vector_origin)
  123.         part:SetLocalAngles(angle_origin)
  124.         part:SetAngleVelocity(Vector(10,1,1))
  125.        
  126.         part:SetWeaponClass("physgun")
  127.         part:SetHideOnWeaponClass(false)
  128.  
  129.         part:SetParent(part)
  130.         part:Follow(part) -- will make the following part use the same same positions as its parent instead of calculating offsets
  131.        
  132.         part:Remove()
  133.  
  134.     local part = pac.NewPart("my hat", "model")
  135.         local entity = part:GetEntity()
  136.  
  137.         part:SetModel("blah/hmm/oh.mdl")
  138.         part:SetCustomOrigin(Vector(0,0,0))
  139.  
  140.         part:SetVectorScale(Vector(1,1,1))
  141.         part:SetScale(1)
  142.         part:SetMirror(true)
  143.  
  144.         part:SetColor(pac.Color(255,255,255) or Vector(1,1,1))
  145.         part:SetFullBright(true)
  146.  
  147.         part:SetMaterial("debug/debugwhite")
  148.         part:SetSkin(0)
  149.  
  150.         part:SetBodygroup(1, 1)
  151.  
  152.         part:SetClippingPlane(data)
  153.         part:GetClippingPlane("my clip plane")
  154.  
  155.         part:SetAnimation(data)
  156.        
  157.         part:IsVisible() -- checks if alpha is 0 or scale is 0
  158.  
  159.     local part = pac.NewPart("my hat", "sprite")
  160.         part:SetScale(1)
  161.         part:SetHeight(1)
  162.         part:SetWidth(1)
  163.  
  164.         part:SetMaterial("sprites/ball")
  165.        
  166.         part:IsVisible()
  167.  
  168.     local part = pac.NewPart("my hat", "ob_effect")
  169.         part:SetEffect("flamethrower")
  170.  
  171.         part:SetLooping(true)
  172.         part:SetRate(1)
  173.  
  174.     local part = pac.NewPart("my hat", "light")
  175.         part:SetColor(pac.Color(255,255,255))
  176.  
  177.         part:SetBrightness(1)
  178.         part:SetRadius(100)
  179.  
  180.     local part = pac.NewPart("my hat", "text") -- dunno if I should bind markup instead (resource heavy)
  181.         part:SetText("my text blah blah")
  182.         part:SetSize(1)
  183.         part:SetColor(pac.Color(255,255,255,255))
  184.         part:IsVisible()
  185.  
  186.     local part = pac.NewPart("my hat", "trail")
  187.         part:SetLength(1)
  188.        
  189.         part:SetStartSize(1)
  190.         part:SetEndSize(0)
  191.        
  192.         part:SetMaterial("trails/laser")
  193.        
  194.         part:SetColor(pac.Color(255,255,255,255))
  195.        
  196.         part:IsVisible()
  197.  
  198.     local part = pac.NewPart("my hat", "sunbeams")
  199.         part:SetDarken(0)
  200.         part:SetScale(1)
  201.         part:SetSize(1)
  202.        
  203.         part:IsVisible()
  204.  
  205. end
  206.  
  207. do -- outfit
  208.     local outfit = pac.NewOutfit(outfit_a, outfit_b, outfit_c, ...)
  209.         -- if outfit_* is a string, it will load the outfit from file.
  210.         -- if it's an outfit object it will use that instead
  211.        
  212.         -- this will mix the outfits giving outfit_a the top priority.
  213.         -- I guess the new editor can have something like "inherit from
  214.         -- parent outfit".
  215.        
  216.         local outfit = ent:GetPACOutfit()
  217.        
  218.         outfit:SetTitle("my awesome outfit")
  219.         outfit:SetDescription("the outfit i spent my asdasd")
  220.         outfit:SetEntity(ent)
  221.    
  222.         outfit:Add(part)
  223.         outfit:Remove("my hat")
  224.         outfit:GetPart("my hat")
  225.        
  226.         outfit:GetParts()
  227.         outfit:GetBones()
  228.            
  229.         local str = outfit:Save(title_override, description_override)
  230.         outfit:LoadOutfit("my outfit")
  231.        
  232.         outfit:SetRender(true)
  233.        
  234.         outfit:SetHidePlayer(false) -- alpha 0
  235.         outfit:SetHideWeapon(false)
  236.        
  237.         outfit:SetColor(pac.Color(255,255,255,255))
  238.         outfit:SetMaterial("models/shiny")
  239.            
  240.         outfit:Scale(1)
  241.        
  242.         outfit:SetHue(0)
  243.         outfit:SetSaturation(1)
  244.         outfit:SetBrightness(1)    
  245.        
  246.         outfit:SetVectorScale(Vector(1,1,1))
  247.         outfit:SetPlayerModel("female7")
  248. end
  249.  
  250. do -- meta magic
  251.    
  252.     -- __add should make the parts followed by the first part follow
  253.    
  254.     outfit:Add(part + part + part)
  255. end
  256.  
  257. do -- pac
  258.     pac.LoadOutfitFromString(str) -- alias of glon.decode?
  259.     local outfit = pac.LoadOutfit(path)
  260.    
  261.     pac.CombineOutfits(master, slave, slave, slave)
  262.     -- the outfits will inherit from the arg before it
  263. end
Advertisement
Add Comment
Please, Sign In to add comment