From 6aab8690d44195d2a364dcf1f3c9b12458ab7ad1 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Mon, 14 Dec 2020 17:15:50 -0600 Subject: [PATCH] fix bad waypoint loading --- main_shared/maps/mp/bots/_bot_utility.gsc | 9 ++++++ main_shared/maps/mp/bots/_wp_editor.gsc | 35 ++++++++++++++++------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/main_shared/maps/mp/bots/_bot_utility.gsc b/main_shared/maps/mp/bots/_bot_utility.gsc index e3db5e9..6aaf18a 100644 --- a/main_shared/maps/mp/bots/_bot_utility.gsc +++ b/main_shared/maps/mp/bots/_bot_utility.gsc @@ -984,6 +984,15 @@ load_waypoints() level.waypoints[i].bots["allies"] = 1; level.waypoints[i].bots["axis"] = 1; + if (!isDefined(level.waypoints[i].children) || !isDefined(level.waypoints[i].children.size)) + level.waypoints[i].children = []; + + if (!isDefined(level.waypoints[i].origin)) + level.waypoints[i].origin = (0, 0, 0); + + if (!isDefined(level.waypoints[i].type)) + level.waypoints[i].type = "crouch"; + level.waypoints[i].childCount = level.waypoints[i].children.size; } diff --git a/main_shared/maps/mp/bots/_wp_editor.gsc b/main_shared/maps/mp/bots/_wp_editor.gsc index 4afbb73..e333510 100644 --- a/main_shared/maps/mp/bots/_wp_editor.gsc +++ b/main_shared/maps/mp/bots/_wp_editor.gsc @@ -265,6 +265,8 @@ watchSaveWaypointsCommand() if(!self adsButtonPressed()) { self checkForWarnings(); + wait 1; + logprint("***********ABiliTy's WPDump**************\n\n"); logprint("\n\n\n\n"); mpnm=getMapName(getdvar("mapname")); @@ -344,6 +346,8 @@ LoadWaypoints() self DeleteAllWaypoints(); self iPrintlnBold("Loading WPS..."); load_waypoints(); + + wait 1; self checkForWarnings(); } @@ -366,18 +370,27 @@ checkForWarnings() if(level.waypoints[i].childCount <= 0) self iprintln("WARNING: waypoint "+i+" childCount is "+level.waypoints[i].childCount); - - if(level.waypoints[i].childCount != level.waypoints[i].children.size) - self iprintln("WARNING: waypoint "+i+" childCount is not "+level.waypoints[i].children.size); - - for(h = 0; h < level.waypoints[i].children.size; h++) + else { - child = level.waypoints[i].children[h]; - - if(!isDefined(level.waypoints[child])) - self iprintln("WARNING: waypoint "+i+" child "+child+" is undefined"); - else if(child == i) - self iprintln("WARNING: waypoint "+i+" child "+child+" is itself"); + if (!isDefined(level.waypoints[i].children) || !isDefined(level.waypoints[i].children.size)) + { + self iprintln("WARNING: waypoint "+i+" children is not defined"); + } + else + { + if(level.waypoints[i].childCount != level.waypoints[i].children.size) + self iprintln("WARNING: waypoint "+i+" childCount is not "+level.waypoints[i].children.size); + + for (h = 0; h < level.waypoints[i].childCount; h++) + { + child = level.waypoints[i].children[h]; + + if(!isDefined(level.waypoints[child])) + self iprintln("WARNING: waypoint "+i+" child "+child+" is undefined"); + else if(child == i) + self iprintln("WARNING: waypoint "+i+" child "+child+" is itself"); + } + } } if(!isDefined(level.waypoints[i].type))