ForbodingAngel

Untitled

May 1st, 2014
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. local base, turret, barrel1, firepoint1, dirt = piece('base', 'turret', 'barrel1', 'firepoint1')
  2. local SIG_AIM = {}
  3.  
  4. -- state variables
  5. isMoving = "isMoving"
  6.  
  7. function script.Create()
  8.  
  9. end
  10.  
  11. function setSFXoccupy(setSFXoccupy_argument)
  12. local terrainType = setSFXocupy_argument
  13. if terrainType == 2 then
  14. Move(base, y_axis, -0.85, 50)
  15. local upright = true
  16. else
  17. Move(base, y_axis, 0, 50)
  18. local upright = false
  19. end
  20.  
  21. if terrainType == 4 then
  22. Move(base, y_axis, 0, 50)
  23. local upright = false
  24. else
  25. Move(base, y_axis, -0.85, 50)
  26. local upright = true
  27. end
  28. end
  29.  
  30. function script.StartMoving()
  31. isMoving = true
  32. end
  33.  
  34. function script.StopMoving()
  35. isMoving = false
  36. end
  37.  
  38. function thrust()
  39. while isMoving do
  40. EmitSfx (dirt, 1025)
  41. Sleep(400)
  42. end
  43. end
  44.  
  45.  
  46. function script.AimWeapon1(heading, pitch)
  47. Signal(SIG_AIM)
  48. SetSignalMask(SIG_AIM)
  49. Turn(turret, y_axis, heading, 25)
  50. Turn(barrel, x_axis, pitch, 25)
  51. WaitForTurn(turret, y_axis)
  52. WaitForTurn(barrel, x_axis)
  53. StartThread(RestoreAfterDelay)
  54. return true
  55. end
  56.  
  57. function script.AimFromWeapon1()
  58. return turret
  59. end
  60.  
  61. function script.QueryWeapon1()
  62. return firepoint1
  63. end
  64.  
  65. function script.FireWeapon1()
  66.  
  67. end
  68.  
  69. local RESTORE_DELAY = 2 * 1000 * Spring.GetUnitWeaponState(unitID, 0, 'reloadTime')
  70.  
  71. local function RestoreAfterDelay()
  72. Sleep(RESTORE_DELAY)
  73. Turn(turret, y_axis, 0, 0.5)
  74. Turn(barrel, x_axis, 0, 0.25)
  75. end
  76.  
  77. local random = math.random
  78.  
  79. function SmokeUnit(smokePieces)
  80. local n = #smokePieces
  81. while (GetUnitValue(COB.BUILD_PERCENT_LEFT) ~= 0) do
  82. Sleep(1000)
  83. end
  84. while true do
  85. local health = GetUnitValue(COB.HEALTH)
  86. if (health <= 66) then -- only smoke if less then 2/3rd health left
  87. EmitSfx(smokePieces[random(1,n)], 1026)
  88. end
  89. Sleep(20*health + 200)
  90. end
  91. end
  92.  
  93. function script.Killed()
  94. Explode(barrel, SFX.EXPLODE_ON_HIT)
  95. Explode(turret, SFX.EXPLODE_ON_HIT)
  96. return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos
  97. end
Advertisement
Add Comment
Please, Sign In to add comment