diff --git a/userraw/maps/mp/bots/_bot_http.gsc b/userraw/maps/mp/bots/_bot_http.gsc index cbd012d..54ac8cc 100644 --- a/userraw/maps/mp/bots/_bot_http.gsc +++ b/userraw/maps/mp/bots/_bot_http.gsc @@ -1,7 +1,93 @@ getRemoteWaypoints(mapname) { - printLn( "Getting waypoints from csv: " ); - //"https://raw.githubusercontent.com/ineedbots/iw4x_waypoints/master/mp_rust_wp.csv" + url = "https://raw.githubusercontent.com/ineedbots/iw4x_waypoints/master/" + mapname + "_wp.csv"; + + println("Attempting to get remote waypoints from " + url); + res = getLinesFromUrl(url); + + if (!res.lines.size) + return; + + println("Loading remote waypoints..."); + + wps = linesToWaypoints(res); + + if (wps.size) + { + level.waypoints = wps; + println("Loaded " + wps.size + " waypoints from remote."); + } +} + +linesToWaypoints(res) +{ + waypoints = []; + waypointCount = int(res.lines[0]); + + if (waypointCount <= 0) + return waypoints; + + for (i = 1; i <= waypointCount; i++) + { + tokens = tokenizeLine(res.lines[i], ","); + + waypoint = spawnStruct(); + + orgStr = tokens[0]; + orgToks = strtok(orgStr, " "); + waypoint.origin = (int(orgToks[0]), int(orgToks[1]), int(orgToks[2])); + + childStr = tokens[1]; + childToks = strtok(childStr, " "); + waypoint.childCount = childToks.size; + waypoint.children = []; + for( j=0; j