share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 12287 faf1b93422ba
parent 12079 8f222872d432
child 12333 6bdabf67a012
equal deleted inserted replaced
12286:b4dde7035fe2 12287:faf1b93422ba
   485                 onNewRound()
   485                 onNewRound()
   486         end
   486         end
   487 
   487 
   488 end
   488 end
   489 
   489 
   490 function DisableTumbler()
   490 function DisableTumbler(endTurn)
   491         currCount = 0
   491         if endTurn == nil then endTurn = true end
   492         fastIndex = 0
   492         if racerActive then
   493         TurnTimeLeft = 0
   493                 currCount = 0
   494         racerActive = false -- newadd
   494                 fastIndex = 0
       
   495                 if endTurn then
       
   496                         EndTurn(true)
       
   497                 end
       
   498                 racerActive = false -- newadd
       
   499         end
   495 end
   500 end
   496 
   501 
   497 function HandleGhost()
   502 function HandleGhost()
   498 
   503 
   499         -- get the current xy of the racer at this point
   504         -- get the current xy of the racer at this point
   713                                 PlaySound(sndDenied)
   718                                 PlaySound(sndDenied)
   714                         else
   719                         else
   715                                 PlaceWayPoint(x, y)
   720                                 PlaceWayPoint(x, y)
   716                                 if wpCount == wpLimit then
   721                                 if wpCount == wpLimit then
   717                                         AddCaption(loc("Race complexity limit reached"))
   722                                         AddCaption(loc("Race complexity limit reached"))
   718                                         DisableTumbler()
   723                                         EndTurn(true)
   719                                 end
   724                                 end
   720                         end
   725                         end
   721                 else
   726                 else
   722                         DeleteGear(cGear)
   727                         DeleteGear(cGear)
   723                 end
   728                 end
   795 function onGearResurrect(gear)
   800 function onGearResurrect(gear)
   796 
   801 
   797         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   802         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   798 
   803 
   799         if gear == CurrentHedgehog then
   804         if gear == CurrentHedgehog then
   800                 DisableTumbler()
   805                 DisableTumbler(false)
   801         end
   806         end
   802 
   807 
   803 end
   808 end
   804 
   809 
   805 function onGearAdd(gear)
   810 function onGearAdd(gear)