Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. @name Plates_Hex by DarkE
  2. @inputs
  3. @outputs
  4. @persist Size:vector2 [SpawnedProps GameProps]:array State DestroyAmount NextDestroy:entity PropData:table DestroyQueue:array
  5. @trigger
  6. if(first()){
  7. Size = vec2(25,25)
  8. DestroyAmount = 5
  9. runOnTick(1)
  10. State=1
  11. }
  12. if(State == 1){
  13. while(Size:x()*Size:y()>SpawnedProps:count() && propCanCreate()){
  14. Prop = propSpawn("models/sprops/geometry/fhex_144.mdl",1)
  15.  
  16. #Prop:propGravity(0)
  17. Prop:setMass(50000)
  18. Prop:setMaterial("models/debug/debugwhite")
  19.  
  20.  
  21. SpawnedProps:pushEntity(Prop)
  22.  
  23. C = SpawnedProps:count()-1
  24.  
  25. Box = Prop:boxSize()
  26. Box = vec(Box:x(),Box:z(),Box:y())
  27. Box = Box+vec(-1,-1,0)
  28.  
  29. #print(Box)
  30. X = C%Size:x()
  31. Y = floor(C/Size:x())
  32.  
  33. Scale = 40
  34.  
  35. #Pos = entity():pos()+vec(X*Box:x(),Y*Box:y(),300+(sin(X*Scale)+cos(Y*Scale))*50)
  36. #Ang = ang(-cos(X*Scale)*10,0,-sin(Y*Scale)*10)
  37. if(Y%2==1){
  38. Pos = entity():pos()+vec(X*Box:x(),Y*Box:y(),300)
  39. }else{
  40. Pos = entity():pos()+vec(X*Box:x()+Box:x()/2,Y*Box:y(),300)
  41. }
  42. Ang = ang(0,30,90)
  43. Col = vec(155,155,155)+vec(100,100,100)*((X+Y)%2)
  44. Alpha = 170
  45. Prop:setPos(Pos)
  46. Prop:setAng(Ang)
  47. Prop:setColor(Col)
  48. Prop:setAlpha(Alpha)
  49.  
  50. PropData[Prop:id(),table] = table( "ang" = Ang, "pos" = Pos, "col" = Col, "alpha" = Alpha )
  51. }
  52. if(Size:x()*Size:y()==SpawnedProps:count()){
  53. GameProps = SpawnedProps:clone()
  54. State = 3
  55. timer("update", 3000)
  56. }
  57. }elseif(State == 2){
  58. while(GameProps:count()<SpawnedProps:count() && perf()){
  59. DestroyQueue = array()
  60. Prop = SpawnedProps[GameProps:count()+1,entity]
  61. Prop:propNotSolid(0)
  62. Prop:setMaterial("models/debug/debugwhite")
  63. Prop:setPos(PropData[Prop:id(),table]["pos",vector])
  64. Prop:setAng(PropData[Prop:id(),table]["ang",angle])
  65. Prop:setColor(PropData[Prop:id(),table]["col",vector])
  66. Prop:setAlpha(PropData[Prop:id(),table]["alpha",number])
  67. Prop:propFreeze(1)
  68. GameProps:pushEntity( Prop )
  69. }
  70. if(GameProps:count()==SpawnedProps:count()){
  71. State = 3
  72. timer("update", 3000)
  73. }
  74. }
  75. if(clk("reset")){
  76. GameProps = array()
  77. State = 2
  78. }
  79.  
  80. if(clk("update") && State == 3){
  81. while(DestroyQueue:count()>0){
  82. Prop = DestroyQueue:shiftEntity()
  83. Prop:setColor(vec(255,0,0))
  84.  
  85. soundStop(Prop:id())
  86. Prop:setMaterial("models/wireframe")
  87. Prop:setAlpha(0)
  88. Prop:propNotSolid(1)
  89. #Prop:propFreeze(0)
  90. Prop:applyForce(vec(0,0,10000000))
  91. Prop:soundPlay(Prop:id(),3,"Glass.Break")
  92. }
  93.  
  94. if(GameProps:count()>1){
  95. while(DestroyQueue:count() < DestroyAmount && GameProps:count() > 1 ){
  96. Prop = GameProps:removeEntity(random(1,GameProps:count()))
  97. Prop:soundPlay(Prop:id(),1,"k_lab.teleport_alarm")
  98. Prop:setAlpha(200)
  99. Prop:setColor(vec(255,0,0))
  100. DestroyQueue:pushEntity(Prop)
  101. }
  102. timer("update", 1000)
  103. }else{
  104. Prop = GameProps:removeEntity(1)
  105. Prop:soundPlay(Prop:id(),1,"ui/scored.wav")
  106. Prop:setAlpha(255)
  107. Prop:setColor(vec(0,255,0))
  108. timer("reset", 5000)
  109. State = 0
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement