share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 11991 f97b1c7fa053
parent 11990 b2783dd12f30
child 12084 8f222872d432
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Nov 23 02:39:08 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Nov 23 02:53:05 2016 +0100
@@ -176,6 +176,9 @@
 waypointradius=N
 --> The waypoints have a radius of N pixels (default: 450)
 
+maxwaypoints=N
+--> The maximum number of waypoints to be placed (default: 8)
+
 ]]
 
 function onParameters()
@@ -195,6 +198,12 @@
              wpRad = 450
         end
     end
+    if params["maxwaypoints"] ~= nil then
+        wpLimit = math.max(2, math.floor(tonumber(params["maxwaypoints"])))
+        if type(wpLimit) ~= "number" then
+             wpLimit = 8
+        end
+    end
 end
 
 function RebuildTeamInfo()
@@ -660,9 +669,14 @@
 
                         SetAmmoTexts(amSkip, nil, nil, nil)
                 else
+                        local infoString
+                        if wpLimit > 2 then
+                                infoString = string.format(loc("Place 2-%d waypoints using the waypoint placement tool."), wpLimit)
+                        else
+                                infoString = loc("Place 2 waypoints using the waypoint placement tool.")
+                        end
                         ShowMission(loc("Racer"),
-                        loc("Waypoint placement phase"),
-                        loc("Place 2-8 waypoints using the available tools."), 2, 4000)
+                        loc("Waypoint placement phase"), infoString, 2, 4000)
                         AddAmmo(CurrentHedgehog, amAirAttack, 4000)
                         SetWeapon(amAirAttack)
                 end