share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 11986 f97b1c7fa053
parent 11985 b2783dd12f30
child 12079 8f222872d432
equal deleted inserted replaced
11985:b2783dd12f30 11986:f97b1c7fa053
   174 --> The game will be played with N rounds (default: 3)
   174 --> The game will be played with N rounds (default: 3)
   175 
   175 
   176 waypointradius=N
   176 waypointradius=N
   177 --> The waypoints have a radius of N pixels (default: 450)
   177 --> The waypoints have a radius of N pixels (default: 450)
   178 
   178 
       
   179 maxwaypoints=N
       
   180 --> The maximum number of waypoints to be placed (default: 8)
       
   181 
   179 ]]
   182 ]]
   180 
   183 
   181 function onParameters()
   184 function onParameters()
   182     parseParams()
   185     parseParams()
   183     if params["teamrope"] ~= nil then
   186     if params["teamrope"] ~= nil then
   191     end
   194     end
   192     if params["waypointradius"] ~= nil then
   195     if params["waypointradius"] ~= nil then
   193         wpRad = math.max(40, math.floor(tonumber(params["waypointradius"])))
   196         wpRad = math.max(40, math.floor(tonumber(params["waypointradius"])))
   194         if type(wpRad) ~= "number" then
   197         if type(wpRad) ~= "number" then
   195              wpRad = 450
   198              wpRad = 450
       
   199         end
       
   200     end
       
   201     if params["maxwaypoints"] ~= nil then
       
   202         wpLimit = math.max(2, math.floor(tonumber(params["maxwaypoints"])))
       
   203         if type(wpLimit) ~= "number" then
       
   204              wpLimit = 8
   196         end
   205         end
   197     end
   206     end
   198 end
   207 end
   199 
   208 
   200 function RebuildTeamInfo()
   209 function RebuildTeamInfo()
   658                         loc("A Hedgewars mini-game"),
   667                         loc("A Hedgewars mini-game"),
   659                         loc("Touch all waypoints as fast as you can!"), 2, 4000)
   668                         loc("Touch all waypoints as fast as you can!"), 2, 4000)
   660 
   669 
   661                         SetAmmoTexts(amSkip, nil, nil, nil)
   670                         SetAmmoTexts(amSkip, nil, nil, nil)
   662                 else
   671                 else
       
   672                         local infoString
       
   673                         if wpLimit > 2 then
       
   674                                 infoString = string.format(loc("Place 2-%d waypoints using the waypoint placement tool."), wpLimit)
       
   675                         else
       
   676                                 infoString = loc("Place 2 waypoints using the waypoint placement tool.")
       
   677                         end
   663                         ShowMission(loc("Racer"),
   678                         ShowMission(loc("Racer"),
   664                         loc("Waypoint placement phase"),
   679                         loc("Waypoint placement phase"), infoString, 2, 4000)
   665                         loc("Place 2-8 waypoints using the available tools."), 2, 4000)
       
   666                         AddAmmo(CurrentHedgehog, amAirAttack, 4000)
   680                         AddAmmo(CurrentHedgehog, amAirAttack, 4000)
   667                         SetWeapon(amAirAttack)
   681                         SetWeapon(amAirAttack)
   668                 end
   682                 end
   669         end
   683         end
   670 
   684