share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 5901 a00e567005be
parent 5900 37516a3bdb0e
child 5902 486f84a45805
equal deleted inserted replaced
5900:37516a3bdb0e 5901:a00e567005be
     1 
     1 
     2 ------------------------------------------
     2 ------------------------------------------
     3 -- RACER 0.1
     3 -- RACER 0.4
     4 -- map-independant racing script
     4 -- map-independant racing script
     5 -- by mikade
     5 -- by mikade
     6 -----------------------------------------
     6 -----------------------------------------
     7 
     7 
     8 -----------------------------------
     8 -----------------------------------
    43 -------
    43 -------
    44 
    44 
    45 -- prevent WP being placed in land
    45 -- prevent WP being placed in land
    46 -- prevent waypoints being placed outside border
    46 -- prevent waypoints being placed outside border
    47 
    47 
       
    48 -------
       
    49 -- 0.4
       
    50 -------
       
    51 
       
    52 -- update user feedback
       
    53 -- add more sounds
       
    54 
    48 -----------------------------
    55 -----------------------------
    49 -- SCRIPT BEGINS
    56 -- SCRIPT BEGINS
    50 -----------------------------
    57 -----------------------------
    51 
    58 
    52 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
    59 loadfile(GetDataPath() .. "Scripts/Locale.lua")()
   265 		if trackTime == bestTime then -- best time of the race
   272 		if trackTime == bestTime then -- best time of the race
   266 			ShowMission(loc("RACER"),
   273 			ShowMission(loc("RACER"),
   267 			loc("TRACK COMPLETED"),
   274 			loc("TRACK COMPLETED"),
   268 			loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   275 			loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   269 			loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
   276 			loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
       
   277 			PlaySound(sndHomerun)
   270 		else	-- best time for the clan
   278 		else	-- best time for the clan
   271 			ShowMission(loc("RACER"),
   279 			ShowMission(loc("RACER"),
   272 			loc("TRACK COMPLETED"),
   280 			loc("TRACK COMPLETED"),
   273 			loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   281 			loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   274 			loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
   282 			loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
   276 	else -- not any kind of new score
   284 	else -- not any kind of new score
   277 		ShowMission(loc("RACER"),
   285 		ShowMission(loc("RACER"),
   278 		loc("TRACK COMPLETED"),
   286 		loc("TRACK COMPLETED"),
   279 		loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   287 		loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
   280 		loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
   288 		loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
       
   289 		PlaySound(sndHellish)
   281 	end
   290 	end
   282 
   291 
   283 
   292 
   284 	--------
   293 	--------
   285 	--new
   294 	--new
   483 		x,y = GetGearTarget(cGear)
   492 		x,y = GetGearTarget(cGear)
   484 		
   493 		
   485 		DeleteGear(cGear)
   494 		DeleteGear(cGear)
   486 
   495 
   487 		if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
   496 		if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
   488 			AddCaption(loc("Please place the way-point in the open."))
   497 			AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
       
   498 			PlaySound(sndDenied)
   489 		else
   499 		else
   490 			PlaceWayPoint(x, y)
   500 			PlaceWayPoint(x, y)
   491 			if wpCount == wpLimit then
   501 			if wpCount == wpLimit then
   492 				AddCaption(loc("Race complexity limit reached."))
   502 				AddCaption(loc("Race complexity limit reached."))
   493 				DisableTumbler()
   503 				DisableTumbler()