Cheesecaked

Telekinesis but mine

Nov 12th, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. @name TeleCheese
  2. @persist Props:array Target:entity Focus:vector X
  3.  
  4. if(first()|dupefinished()){
  5. runOnTick(1)
  6.  
  7. X = 0
  8.  
  9. findIncludePlayerProps(owner())
  10. }
  11. elseif(changed(first())|changed(dupefinished())){
  12. entity():setMaterial("models/wireframe")
  13. entity():setColor(vec4(25,25,255,255))
  14. }
  15. else{
  16. findByClass("prop_physics")
  17.  
  18. Props = array()
  19.  
  20. foreach(EI,Ent:entity = findToArray()){
  21. if(!Ent:isFrozen()){
  22. Ent:setMass(5)
  23. Props:pushEntity(Ent)
  24. }
  25. else{
  26. Ent:setColor(vec(255))
  27. Ent:setMaterial("")
  28. }
  29. }
  30.  
  31. X += 1
  32. if(X%20 == 1){
  33. foreach(EI,Ent:entity = Props){
  34. Ent:setColor(vec(180,25,25))
  35. Ent:setMaterial("models/debug/debugwhite")
  36. Ent:setAlpha(255)
  37. }
  38. }
  39.  
  40. if(changed(owner():isFlashlightOn())){
  41. if(owner():isFlashlightOn()){
  42. Focus = owner():aimPos()
  43. Dist = array()
  44. foreach(PI,Ply:entity = players()){
  45. if(Ply != owner() & Ply:isAlive()){
  46. Dist[PI,number] = Ply:shootPos():distance(Focus)
  47. }
  48. else{
  49. Dist[PI,number] = 200000
  50. }
  51. }
  52.  
  53. if(Dist:min() <= 1000){
  54. Target = players()[Dist:minIndex(),entity]
  55. }
  56. else{
  57. Target = noentity()
  58. }
  59. }
  60. }
  61. else{
  62. foreach(EI,Ent:entity = Props){
  63. if(owner():isFlashlightOn()){
  64. if(Target:isValid()){
  65. if(Target:isAlive()){
  66. Dir = Target:shootPos() - Ent:pos()
  67. }
  68. else{
  69. Target = noentity()
  70. }
  71. }
  72. else{
  73. Dir = Focus - Ent:pos()
  74. }
  75. Ent:setMass(200000000)
  76. Ent:applyForce((Dir * 500)*Ent:mass())
  77. }
  78. else{
  79. Ent:setMass(4)
  80. Dir = (owner():pos() + vec(sin(curtime()*50+360*(EI/Props:count()))*(30*Props:count()),cos(curtime()*50+360*(EI/Props:count()))*(30*Props:count()),150))-Ent:pos()
  81. Ent:applyForce((Dir*2 - Ent:vel()*0.1)*Ent:mass())
  82. }
  83. Ent:applyTorque((-Ent:angVelVector())*Ent:inertia())
  84. }
  85. }
  86. }
  87.  
Advertisement
Add Comment
Please, Sign In to add comment