Advertisement
Guest User

Untitled

a guest
Sep 7th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.47 KB | None | 0 0
  1. File conbigfoot.lua
  2.  
  3. Parsed--------
  4.  
  5. --unitPieces
  6. local nanopiece = piece "nanopiece"
  7. local center= piece "center"
  8. local conBigFoot= piece "ConBigFoot"
  9. local conbigfee1= piece "conbigfee1"
  10. local conbigfee0= piece "conbigfee0"
  11. local boolbuilding=false
  12. local SIG_BUILD=2
  13. local boolMoving=false
  14.  
  15. function moveStateCheck()
  16.     while(true) do
  17.         while(boolMoving==true) do
  18.             Sleep(250)
  19.             Show(conbigfee0)
  20.             Hide(conbigfee1)
  21.             Sleep(250)
  22.             Show(conbigfee1)
  23.             Hide(conbigfee0)
  24.         end
  25.         Sleep(150)
  26.     end
  27. end
  28.  
  29. function script.StartMoving()
  30.     boolMoving=true
  31. end
  32.  
  33. function script.StopMoving()
  34.     boolMoving=false
  35. end
  36.  
  37. function script.Create()
  38.     Hide(conbigfee0)
  39.     StartThread(moveStateCheck)
  40. end
  41.  
  42. function script.Killed()
  43.     Sleep(700)
  44.     return 1
  45. end
  46.  
  47. function building()
  48.     SetSignalMask(SIG_BUILD)
  49.     while(boolbuilding==true) do
  50.         Sleep(125)
  51.         actualHealth=Spring.GetUnitHealth (unitID )
  52.         if actualHealth == 1 then
  53.             actualHealth=actualHealth-1
  54.             Spring.SetUnitNoSelect (unitID, true)
  55.             --makes the Unit go home, to the place it was born- west Virginia
  56.             Spring.SetUnitHealth(unitID,actualHealth)
  57.         end
  58.         actualHealth=actualHealth-1
  59.         Spring.SetUnitHealth(unitID,actualHealth)
  60.         Sleep(125)
  61.     end
  62. end
  63.  
  64. function script.StopBuilding()
  65.     boolbuilding=false
  66.     Signal(SIG_BUILD)
  67.     SetUnitValue(COB.INBUILDSTANCE, 0)
  68.     Turn(center,y_axis,0,6)
  69.     WaitForTurn(center,y_axis)
  70. end
  71.  
  72. function script.StartBuilding(heading, pitch)
  73.     Turn(center,y_axis,heading,3)
  74.     WaitForTurn(center,y_axis)
  75.     boolbuilding=true
  76.     Signal(SIG_BUILD)
  77.     StartThread(building)
  78.     SetUnitValue(COB.INBUILDSTANCE, 1)
  79. end
  80.  
  81. function script.QueryNanoPiece()
  82.     return nanopiece
  83. end
  84.  
  85. Original------------------------
  86.  
  87. --unitPieces
  88. local nanopiece = piece "nanopiece"
  89. local center= piece "center"
  90. local conBigFoot= piece "ConBigFoot"
  91. local conbigfee1= piece "conbigfee1"
  92. local conbigfee0= piece "conbigfee0"
  93. local boolbuilding=false
  94. local SIG_BUILD=2
  95. local boolMoving=false
  96.  
  97.  
  98. function moveStateCheck()
  99. while(true) do
  100.  
  101. while(boolMoving==true) do
  102. Sleep(250)
  103. Show(conbigfee0)
  104. Hide(conbigfee1)
  105. Sleep(250)
  106. Show(conbigfee1)
  107. Hide(conbigfee0)
  108.  
  109. end
  110.  
  111.  
  112. Sleep(150)
  113. end
  114.  
  115.  
  116. end
  117.  
  118.  
  119.  
  120. function script.StartMoving()
  121. boolMoving=true
  122.  
  123. end
  124.  
  125. function script.StopMoving()
  126.  
  127.  boolMoving=false
  128.  
  129. end
  130.  
  131.  
  132.  
  133.  
  134. function script.Create()
  135. Hide(conbigfee0)
  136. StartThread(moveStateCheck)
  137. end
  138.  
  139. function script.Killed()
  140.  
  141. Sleep(700)
  142. return 1
  143. end
  144.  
  145. function building()
  146. SetSignalMask(SIG_BUILD)
  147.             while(boolbuilding==true) do
  148.             Sleep(125)
  149.             actualHealth=Spring.GetUnitHealth (unitID )
  150.                                                             if actualHealth == 1 then
  151.                                                             actualHealth=actualHealth-1
  152.                                                              Spring.SetUnitNoSelect (unitID, true)
  153.                                                             --makes the Unit go home, to the place it was born- west Virginia
  154.                                                             Spring.SetUnitHealth(unitID,actualHealth)
  155.                                                             end
  156.                 actualHealth=actualHealth-1
  157.                 Spring.SetUnitHealth(unitID,actualHealth)
  158.  
  159.  
  160.  
  161.  
  162.  
  163.             Sleep(125)
  164.             end
  165.  
  166. end
  167.  
  168. function script.StopBuilding()
  169.     boolbuilding=false
  170.     Signal(SIG_BUILD)
  171.     SetUnitValue(COB.INBUILDSTANCE, 0)
  172.     Turn(center,y_axis,0,6)
  173.     WaitForTurn(center,y_axis)
  174. end
  175.  
  176. function script.StartBuilding(heading, pitch)
  177.     Turn(center,y_axis,heading,3)
  178.     WaitForTurn(center,y_axis)
  179.     boolbuilding=true
  180.     Signal(SIG_BUILD)
  181.     StartThread(building)
  182.                            
  183.     SetUnitValue(COB.INBUILDSTANCE, 1)
  184. end
  185.  
  186.  
  187. function script.QueryNanoPiece()
  188.      return nanopiece
  189. end
  190.  
  191.  
  192. --------BUILDING---------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement