Advertisement
Guest User

Untitled

a guest
Feb 12th, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.73 KB | None | 0 0
  1. base, turret, barrel1, firepoint1, dirt, t3turret, t3barrel1, t3firepoint1 = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 't3turret', 't3barrel1', 't3firepoint1')
  2. local SIG_AIM = {}
  3.  
  4. -- state variables
  5. isMoving = "isMoving"
  6. terrainType = "terrainType"
  7.  
  8. function script.Create()
  9.     StartThread(common.SmokeUnit, {base, turret, barrel1})
  10. end
  11.  
  12. common = include("headers/common_includes_lus.lua")
  13.  
  14. function script.setSFXoccupy(setSFXoccupy_argument)
  15.     common.setSFXoccupy(setSFXoccupy_argument)
  16. end
  17.  
  18. function script.StartMoving()
  19.    isMoving = true
  20.     StartThread(thrust)
  21. end
  22.  
  23. function script.StopMoving()
  24.    isMoving = false
  25. end  
  26.  
  27. function thrust()
  28.     common.DirtTrail()
  29. end
  30.  
  31.  
  32. local function RestoreAfterDelay()
  33.     Sleep(2000)
  34.     Turn(turret, y_axis, 0, 5)
  35.     Turn(barrel1, x_axis, 0, 5)
  36.     Turn(t3turret, y_axis, 0, 5)
  37.     Turn(t3barrel1, x_axis, 0, 5)
  38. end    
  39.  
  40. -------------------------------------------
  41. -------------------------------------------
  42.  
  43. function script.AimFromWeapon1(weaponID)
  44.     --Spring.Echo("AimFromWeapon: FireWeapon")
  45.     return turret
  46. end
  47.  
  48. function script.QueryWeapon1(weaponID)
  49.     --Spring.Echo("QueryWeapon: FireWeapon")
  50.     return firepoint1
  51. end
  52.  
  53. function script.AimWeapon1(weaponID, heading, pitch)
  54.     Signal(SIG_AIM)
  55.     SetSignalMask(SIG_AIM)
  56.     Turn(turret, y_axis, heading, 100)
  57.     Turn(barrel1, x_axis, -pitch, 100)
  58.     WaitForTurn(turret, y_axis)
  59.     WaitForTurn(barrel1, x_axis)
  60.     StartThread(RestoreAfterDelay)
  61.     --Spring.Echo("AimWeapon: FireWeapon")
  62.     return true
  63. end
  64.  
  65. function script.FireWeapon1(weaponID)
  66.     --Spring.Echo("FireWeapon: FireWeapon")
  67.     EmitSfx (firepoint1, 1024)
  68. end
  69.  
  70. -------------------------------------------
  71. -------------------------------------------
  72.  
  73. function script.AimFromWeapon2(weaponID)
  74.     --Spring.Echo("AimFromWeapon: FireWeapon")
  75.     return t3turret
  76. end
  77.  
  78. function script.QueryWeapon2(weaponID)
  79.     --Spring.Echo("QueryWeapon: FireWeapon")
  80.     return t3firepoint1
  81. end
  82.  
  83. function script.AimWeapon2(weaponID, heading, pitch)
  84.     Signal(SIG_AIM)
  85.     SetSignalMask(SIG_AIM)
  86.     Turn(t3turret, y_axis, heading, 100)
  87.     Turn(t3barrel1, x_axis, -pitch, 100)
  88.     WaitForTurn(t3turret, y_axis)
  89.     WaitForTurn(t3barrel1, x_axis)
  90.     StartThread(RestoreAfterDelay)
  91.     --Spring.Echo("AimWeapon: FireWeapon")
  92.     return true
  93. end
  94.  
  95. function script.FireWeapon2(weaponID)
  96.     --Spring.Echo("FireWeapon: FireWeapon")
  97.     EmitSfx (t3firepoint1, 1024)
  98. end
  99.  
  100. -------------------------------------------
  101. -------------------------------------------
  102.  
  103. function script.Killed()
  104.         Explode(barrel1, SFX.EXPLODE_ON_HIT)
  105.         Explode(turret, SFX.EXPLODE_ON_HIT)
  106.         Explode(t3barrel1, SFX.EXPLODE_ON_HIT)
  107.         Explode(t3turret, SFX.EXPLODE_ON_HIT)
  108.         return 1   -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement