share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
changeset 12287 faf1b93422ba
parent 12079 8f222872d432
child 12333 6bdabf67a012
equal deleted inserted replaced
12286:b4dde7035fe2 12287:faf1b93422ba
   557                 onNewRound()
   557                 onNewRound()
   558         end
   558         end
   559 
   559 
   560 end
   560 end
   561 
   561 
   562 function DisableTumbler()
   562 function DisableTumbler(endTurn)
   563         currCount = 0
   563         if endTurn == nil then endTurn = true end
   564         fastIndex = 0
   564         if racerActive then
   565         TurnTimeLeft = 0
   565                 currCount = 0
   566         racerActive = false -- newadd
   566                 fastIndex = 0
       
   567                 racerActive = false -- newadd
       
   568                 if endTurn then
       
   569                          EndTurn(true)
       
   570                 end
       
   571         end
   567 end
   572 end
   568 
   573 
   569 function HandleGhost()
   574 function HandleGhost()
   570 
   575 
   571         -- get the current xy of the racer at this point
   576         -- get the current xy of the racer at this point
  1149                                         DisableTumbler()
  1154                                         DisableTumbler()
  1150                                 end
  1155                                 end
  1151 
  1156 
  1152                         end
  1157                         end
  1153 
  1158 
  1154                 end
  1159                         -- If hedgehog is not controlled anymore, stop racing mode
  1155 
  1160                         if band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
  1156                 -- if the player has expended his tunbling time, stop him tumbling
  1161                                 DisableTumbler(false)
  1157                 if TurnTimeLeft <= 20 then
  1162                         end
  1158                         DisableTumbler()
  1163 
  1159                 end
  1164                 end
  1160 
  1165 
  1161         end
  1166         end
  1162 
  1167 
  1163 end
  1168 end
  1220 function onGearResurrect(gear)
  1225 function onGearResurrect(gear)
  1221 
  1226 
  1222         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  1227         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
  1223 
  1228 
  1224         if gear == CurrentHedgehog then
  1229         if gear == CurrentHedgehog then
  1225                 DisableTumbler()
  1230                DisableTumbler(false)
  1226         end
  1231         end
  1227 
  1232 
  1228 end
  1233 end
  1229 
  1234 
  1230 function isATrackedGear(gear)
  1235 function isATrackedGear(gear)