Advertisement
Guest User

Untitled

a guest
Sep 16th, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.51 KB | None | 0 0
  1. local turret = piece "sstowgab"
  2. local turret2= piece "sstower"
  3. local flare = piece "sscflare"
  4. --define other pieces
  5. local sstowf = piece "sstowf"
  6. local sstowf2 = piece "sstowf2"
  7. local body = piece "csniper"
  8. local cwheel1 = piece "sswheel"
  9. local cwheel2 = piece "sswheel2"
  10. local cwheel3 = piece "sswheel3"
  11. local cwheel3 = piece "sswheel4"
  12. local SIG_UNFOLD=8
  13. local SIG_FOLD=4
  14. local SIG_AIM=2
  15. local SIG_SPAM=16
  16. local boolStillAiming=false
  17. local boolFireLock=true
  18. local spamfilterSTART=true
  19. local spamfilterSTOP=false
  20.  
  21. local boolFilterActive=false
  22.  
  23. local function spamFilter()
  24.     SetSignalMask(SIG_SPAM)
  25.  
  26.  
  27.     while (true) do
  28.            
  29.             if spamfilterSTART==true and spamfilterSTOP==false then  
  30.                     for it=0,3,1
  31.                     do
  32.                     Sleep(64)
  33.                         if spamfilterSTOP==true then
  34.                         spamfilterSTART=false
  35.                         break                  
  36.                         end
  37.                     end
  38.                     if spamfilterSTART==true then
  39.                     --if spamfilterSTART is still ==true then
  40.                     Signal(SIG_FOLD)
  41.                     Signal(SIG_UNFOLD)
  42.                     StartThread(fold)              
  43.                     end
  44.                    
  45.             end
  46.            
  47.             if spamfilterSTOP==true and spamfilterSTART==false then  
  48.                     for it=0,3,1
  49.                     do
  50.                     Sleep(64)
  51.                         if spamfilterSTART==true then
  52.                         spamfilterSTOP=false
  53.                         break                  
  54.                         end
  55.                     end
  56.                     if spamfilterSTOP==true then
  57.                     --if spamfilterSTOP is still ==true then
  58.                     Signal(SIG_FOLD)
  59.                     Signal(SIG_UNFOLD)
  60.                     StartThread(unfold)        
  61.                     end
  62.                    
  63.             end
  64.  
  65.             if spamfilterSTOP==false and spamfilterSTART==false then  
  66.                
  67.             Spring.Echo("No idea what you did, but you broke it. You gonna pay!")
  68.                
  69.             end
  70.  
  71.     end
  72. end
  73.  
  74.  
  75.  
  76.  
  77. local function fold()
  78.  
  79. Signal(SIG_UNFOLD)
  80. SetSignalMask(SIG_FOLD)
  81.     Turn(turret,x_axis,math.rad(0),1.2)
  82.     Sleep(150)
  83.     Turn(turret, x_axis,math.rad(0),1.85)
  84.     Turn(turret2, x_axis,math.rad(0),1.85)
  85.     Turn(sstowf2,y_axis,math.rad(180),4)
  86.     WaitForTurn(sstowf2,y_axis)
  87.     WaitForTurn(turret2, x_axis)
  88.     Move(sstowf,y_axis, -65,6)
  89.     WaitForMove(sstowf,y_axis)
  90.     Sleep(50)
  91.     Hide(sstowf)
  92.     Hide(sstowf)
  93.     boolFireLock=true
  94.    
  95.         while(true) do
  96.         Sleep(1024)
  97.         end
  98. end
  99.  
  100. local function unfold()
  101.  
  102. Signal(SIG_FOLD)
  103.  
  104. SetSignalMask(SIG_UNFOLD)
  105.     Show(sstowf)
  106.     Show(sstowf)
  107.     turner=math.random(-2,2)
  108.     Turn(turret,x_axis,math.rad(turner),1)
  109.     WaitForTurn(turret,x_axis)
  110.     Move(sstowf,y_axis, 0,5)
  111.     WaitForMove(sstowf,y_axis)
  112.     boolFireLock=false
  113.         while(true) do
  114.        
  115.         Sleep(1024)
  116.    
  117.         end
  118.  
  119.  
  120. end
  121.  
  122. function script.AimWeapon1(heading ,pitch) 
  123.     Signal(SIG_AIM)
  124.     SetSignalMask(SIG_AIM)
  125.  
  126.                 if boolFireLock==true then
  127.                 return false
  128.                 end
  129.        
  130.  
  131.     if boolFireLock==false then
  132.     boolStillAiming=true
  133.     --aiming animation: instantly turn the gun towards the enemy
  134.     Turn(sstowf, y_axis, heading,0.85)
  135.     Turn(turret2, x_axis, -pitch,0.55)
  136.     WaitForTurn(sstowf,y_axis)
  137.     WaitForTurn(turret2,x_axis)
  138.     return true
  139.     end
  140.    
  141. end
  142.  
  143. function script.AimFromWeapon1()
  144.     return turret2
  145. end
  146.  
  147. function script.QueryWeapon1()
  148.     return flare
  149. end
  150.  
  151. function script.FireWeapon1()  
  152.     boolStillAiming=false
  153.     return true
  154. end
  155.  
  156.  
  157. function script.Create()
  158. Hide(flare)
  159. Signal(SIG_SPAM)
  160. end
  161.  
  162. function script.Killed()
  163.     Signal(SIG_SPAM)
  164.     Signal(SIG_FOLD)
  165.     Signal(SIG_UNFOLD)
  166.      
  167.      flipFlop=math.random(0,1)
  168.      
  169.      if flipFlop==1 then
  170.     Turn(sstowf2,x_axis,math.rad(35),2)
  171.     WaitForTurn(sstowf2,x_axis)
  172.     Turn(sstowf2,x_axis,math.rad(78),6)
  173.     WaitForTurn(sstowf2,x_axis)
  174.     Turn(sstowf2,x_axis,math.rad(92),9)
  175.     WaitForTurn(sstowf2,x_axis)
  176.     Sleep(250)
  177.     Explode (cwheel1, SFX.FIRE)
  178.     Explode (cwheel2, SFX.FIRE)
  179.     Explode (cwheel3, SFX.FIRE)
  180.     Explode (cwheel3, SFX.FIRE)
  181.     Explode (turret2, SFX.SMOKE)
  182.     Explode (body, SFX.FIRE + SFX.SMOKE)
  183.     end
  184.      
  185.      if flipFlop==0 then
  186.      Turn(body,z_axis,math.rad(35),2)
  187.         WaitForTurn(body,z_axis)
  188.         Turn(body,z_axis,math.rad(78),6)
  189.         WaitForTurn(body,z_axis)
  190.         Turn(body,z_axis,math.rad(93),9)
  191.         WaitForTurn(body,z_axis)
  192.          Turn(body,z_axis,math.rad(85),6)
  193.         WaitForTurn(body,z_axis)
  194.  
  195.         Turn(body,z_axis,math.rad(93),9)
  196.         WaitForTurn(body,z_axis)
  197.         Sleep(250)     
  198.         Explode (cwheel1, SFX.FIRE)
  199.         Explode (cwheel2, SFX.FIRE)
  200.         Explode (cwheel3, SFX.FIRE)
  201.         Explode (cwheel3, SFX.FIRE)
  202.         Explode (turret2, SFX.SMOKE)
  203.         Explode (body, SFX.FIRE  + SFX.SMOKE)
  204.      
  205.      
  206.      end
  207.  
  208.  
  209.  
  210. end
  211.  
  212. function script.StartMoving()
  213. if boolFilterActive==false then
  214. Signal(SIG_SPAM)
  215. StartThread(spamFilter)
  216. boolFilterActive=true
  217. end
  218.  
  219. spamfilterSTOP=false
  220. spamfilterSTART=true
  221.    
  222. end
  223.  
  224. function script.StopMoving()
  225. --    Spring.Echo ("stopped walking!")
  226. spamfilterSTART=false      
  227. spamfilterSTOP=true    
  228. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement