Add new Racer script parameter: waypointradius
authorWuzzy <almikes@aol.com>
Wed, 13 Apr 2016 14:02:53 +0200
changeset 11929 167de692f2d7
parent 11928 42e90b244e11
child 11930 4ed643879c0f
Add new Racer script parameter: waypointradius
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Sat Nov 19 20:22:55 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Apr 13 14:02:53 2016 +0200
@@ -146,7 +146,7 @@
 local wpY = {}
 local wpCol = {}
 local wpActive = {}
-local wpRad = 450 --75
+local wpRad = 450
 local wpCount = 0
 local wpLimit = 8
 
@@ -164,6 +164,20 @@
 -- general methods
 -------------------
 
+--[[
+Parameters syntax:
+
+teamrope=true
+--> The team will be colored in the color of the team.
+
+rounds=N
+--> The game will be played with N rounds (default: 3)
+
+waypointradius=N
+--> The waypoints have a radius of N pixels (default: 450)
+
+]]
+
 function onParameters()
     parseParams()
     if params["teamrope"] ~= nil then
@@ -175,6 +189,12 @@
              roundLimit = 3
         end
     end
+    if params["waypointradius"] ~= nil then
+        wpRad = math.max(40, math.floor(tonumber(params["waypointradius"])))
+        if type(roundLimit) ~= "number" then
+             wpRad = 450
+        end
+    end
 end
 
 function RebuildTeamInfo()