Guest User

Untitled

a guest
Oct 23rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. @name Force Circle
  2. @outputs Count Run Radius
  3. @persist Props:array
  4. runOnTick(1)
  5. if (Run) {
  6. Owner=owner()
  7. if (findCanQuery()) {
  8. findIncludePlayerProps(Owner) #The functions only work on the owner's props, so we only use them on the owner's props
  9. findByModel("models/props_junk/PopCan01a.mdl") #Pick a model
  10. Props=findToArray() #Save what we found
  11. Count=Props:count() #How many entities we found
  12. }
  13.  
  14. if (tickClk()) { #Set stuff up first to use less ops
  15. Cur=curtime() #Just an easy way of getting an incrementing value
  16. Radius=max(Count*50/pi()/2,100) #Creates a radius with atleast 50 units between each prop
  17. #Pos=mix(Owner:pos(),Owner:shootPos(),(sin(Cur*45)+1)/2) #Moves the center position from the feet of the owner to the head and back
  18. Pos=entity():pos() #A sun
  19. Orbit1=vec(Radius/3,0,10):rotate(0,Cur*90,0) #A planet orbitting the sun
  20. Index=0
  21. while (Index<Count) {
  22. Index++,TE=Props[Index,entity] #TE=Target Entity, yay less ops
  23. Orbit2=vec(Radius,0,10):rotate(0,-(360/Count*Index + Cur*45),0) #Moons orbitting the planet
  24. TE:applyForce(((Pos+Orbit1+Orbit2-TE:massCenter())*10-TE:vel())*TE:mass()) #Standard formula
  25. TE:setColor(randint(128,255),randint(128,255),randint(128,255)) #Pretty colors
  26. }
  27. }
  28.  
  29. if ($Count>0) {timer("trail",2000)} #If the amount of props has increased then set new trails
  30. if (clk("trail")) {
  31. Color=vec(255,255,255) #
  32. foreach (Index,Prop:entity=Props) {
  33. Prop:setTrails(100,0,1,"trails/physbeam",Color,255)
  34. }
  35. }
  36. }
  37. Run=(minquota()>100) #If there aren't more than 100 ops left, then the above code block will be skipped the next execution to prevent a shutdown
Add Comment
Please, Sign In to add comment