# HG changeset patch # User Wuzzy # Date 1479865985 -3600 # Node ID f97b1c7fa053df417d03ed181f23a298e30d1599 # Parent b2783dd12f30214e9992a02159fde81bdcf7b3e4 Allow to set Racer waypoint limit with script parameter “maxwaypoints” diff -r b2783dd12f30 -r f97b1c7fa053 share/hedgewars/Data/Scripts/Multiplayer/Racer.lua --- 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