ForbodingAngel

Untitled

May 1st, 2014
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. local base, turret, barrel1, firepoint1, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt')
  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. StartThread(thrust)
  33. end
  34.  
  35. function script.StopMoving()
  36. isMoving = false
  37. end
  38.  
  39. function thrust()
  40. while isMoving do
  41. EmitSfx (dirt, 1025)
  42. Sleep(400)
  43. end
  44. end
  45.  
  46. --local RESTORE_DELAY = 2 * 1000 * Spring.GetUnitWeaponState(unitID, 0, 'reloadTime')
  47.  
  48. local function RestoreAfterDelay()
  49. Sleep(2000)
  50. Turn(turret, y_axis, 0, 0.5)
  51. Turn(barrel1, x_axis, 0, 0.25)
  52. end
  53.  
  54. function script.AimWeapon1(heading, pitch)
  55. Signal(SIG_AIM)
  56. SetSignalMask(SIG_AIM)
  57. Turn(turret, y_axis, heading, 25)
  58. Turn(barrel1, x_axis, pitch, 25)
  59. WaitForTurn(turret, y_axis)
  60. WaitForTurn(barrel1, x_axis)
  61. StartThread(RestoreAfterDelay)
  62. return true
  63. end
  64.  
  65. function script.AimFromWeapon1()
  66. return turret
  67. end
  68.  
  69. function script.QueryWeapon1()
  70. return firepoint1
  71. end
  72.  
  73. function script.FireWeapon1()
  74. EmitSfx (firepoint1, 1024)
  75. end
  76.  
  77.  
  78. local random = math.random
  79.  
  80. function SmokeUnit(smokePieces)
  81. local n = #smokePieces
  82. while (GetUnitValue(COB.BUILD_PERCENT_LEFT) ~= 0) do
  83. Sleep(1000)
  84. end
  85. while true do
  86. local health = GetUnitValue(COB.HEALTH)
  87. if (health <= 66) then -- only smoke if less then 2/3rd health left
  88. EmitSfx(smokePieces[random(1,n)], 1026)
  89. end
  90. Sleep(20*health + 200)
  91. end
  92. end
  93.  
  94. function script.Killed()
  95. Explode(barrel1, SFX.EXPLODE_ON_HIT)
  96. Explode(turret, SFX.EXPLODE_ON_HIT)
  97. return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos
  98. end
Advertisement
Add Comment
Please, Sign In to add comment