Advertisement
Guest User

Untitled

a guest
Sep 16th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 KB | None | 0 0
  1. base, turret, nanos, nanopoint1, nanopoint2, dirt = piece('base', 'turret', 'nanos', 'nanopoint1', 'nanopoint2', 'dirt')
  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.     StartThread(doYouEvenLift)
  11.     StartThread(BuildFX)
  12.     building = false
  13. end
  14.  
  15. common = include("headers/common_includes_lus.lua")
  16.  
  17. function script.StartMoving()
  18.    isMoving = true
  19.     StartThread(thrust)
  20. end
  21.  
  22. function script.StopMoving()
  23.    isMoving = false
  24. end  
  25.  
  26. function doYouEvenLift()
  27.     common.HbotLift()
  28. end
  29.  
  30. function thrust()
  31.     common.DirtTrail()
  32. end
  33.  
  34. function BuildFX()
  35.     while(building == true) do
  36.         EmitSfx (nanopoint1, 1024)
  37.         EmitSfx (nanopoint2, 1024)
  38.         Sleep(550)
  39.     end
  40. end
  41.  
  42. function RestoreAfterDelay()
  43.     if building == false then
  44.         Sleep(2000)
  45.         Turn(turret, y_axis, 0, 5)
  46.     end
  47. end    
  48.  
  49. local nanoPoints = {}
  50. -- FIXME: this example has 2 nano pieces to alternate between
  51. for i = 1, 2 do
  52.      -- FIXME: the pieces are named nanoPiece1 and nanoPiece2 in the model
  53.     nanoPoints[i] = piece("nanopoint" .. i)
  54. end
  55. Spring.SetUnitNanoPieces(unitID, nanoPoints)
  56.  
  57. function script.StartBuilding(heading, pitch)
  58.     -- TODO: This is where you would add your unpack / point towards animation
  59.     Turn(turret, y_axis, heading, 100)
  60.     SetUnitValue(COB.INBUILDSTANCE, true)
  61.     building = true
  62.     StartThread(BuildFX)
  63. end
  64. function script.StopBuilding()
  65.     -- TODO: This is where you would add your pack-up animation
  66.     SetUnitValue(COB.INBUILDSTANCE, false)
  67.     building = false
  68.     StartThread(RestoreAfterDelay)
  69. end
  70.  
  71. function script.Killed()
  72.         Explode(nanos, SFX.EXPLODE_ON_HIT)
  73.         Explode(turret, SFX.EXPLODE_ON_HIT)
  74.         Explode(base, SFX.EXPLODE_ON_HIT)
  75.         return 1   -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement