waypoints

This commit is contained in:
Your Name 2020-08-28 15:14:06 -06:00
parent bf86fb99f2
commit 398cb1fea5
4 changed files with 1321 additions and 41 deletions

View File

@ -613,6 +613,149 @@ load_waypoints()
level.waypointsJav[level.waypointsJav.size] = level.waypoints[i];
}
getMapName(mapname)
{
switch(mapname)
{
case "mp_abandon":
return "Carnival";
case "mp_rundown":
return "Rundown";
case "mp_afghan":
return "Afghan";
case "mp_boneyard":
return "Scrapyard";
case "mp_brecourt":
return "Wasteland";
case "mp_cargoship":
return "Wetwork";
case "mp_checkpoint":
return "Karachi";
case "mp_compact":
return "Salvage";
case "mp_complex":
return "Bailout";
case "mp_crash":
return "Crash";
case "mp_cross_fire":
return "Crossfire";
case "mp_derail":
return "Derail";
case "mp_estate":
return "Estate";
case "mp_favela":
return "Favela";
case "mp_fuel2":
return "Fuel";
case "mp_highrise":
return "Highrise";
case "mp_invasion":
return "Invasion";
case "mp_killhouse":
return "Killhouse";
case "mp_nightshift":
return "Skidrow";
case "mp_nuked":
return "Nuketown";
case "oilrig":
return "Oilrig";
case "mp_quarry":
return "Quarry";
case "mp_rust":
return "Rust";
case "mp_storm":
return "Storm";
case "mp_strike":
return "Strike";
case "mp_subbase":
return "Subbase";
case "mp_terminal":
return "Terminal";
case "mp_trailerpark":
return "Trailer Park";
case "mp_overgrown":
return "Overgrown";
case "mp_underpass":
return "Underpass";
case "mp_vacant":
return "Vacant";
case "iw4_credits":
return "IW4 Test Map";
case "airport":
return "Airport";
case "co_hunted":
return "Hunted";
case "invasion":
return "Burgertown";
case "mp_bloc":
return "Bloc";
case "mp_bog_sh":
return "Bog";
case "contingency":
return "Contingency";
case "gulag":
return "Gulag";
case "so_ghillies":
return "Pripyat";
case "ending":
return "Museum";
case "af_chase":
return "Afghan Chase";
case "af_caves":
return "Afghan Caves";
case "arcadia":
return "Arcadia";
case "boneyard":
return "Boneyard";
case "cliffhanger":
return "Cliffhanger";
case "dcburning":
return "DCBurning";
case "dcemp":
return "DCEMP";
case "downtown":
return "Downtown";
case "estate":
return "EstateSP";
case "favela":
return "FavelaSP";
case "favela_escape":
return "Favela Escape";
case "roadkill":
return "Roadkill";
case "trainer":
return "TH3 PIT";
case "so_bridge":
return "Bridge";
case "dc_whitehouse":
return "Whitehouse";
case "mp_shipment_long":
return "ShipmentLong";
case "mp_shipment":
return "Shipment";
case "mp_firingrange":
return "Firing Range";
case "mp_rust_long":
return "RustLong";
case "mp_cargoship_sh":
return "Freighter";
case "mp_storm_spring":
return "Chemical Plant";
case "mp_crash_trop":
case "mp_crash_tropical":
return "Crash Tropical";
case "mp_fav_tropical":
return "Favela Tropical";
case "mp_estate_trop":
case "mp_estate_tropical":
return "Estate Tropical";
case "mp_bloc_sh":
return "Forgotten City";
default:
return mapname;
}
}
/*
Returns a good amount of players.
*/

View File

@ -23,13 +23,21 @@ init()
setdvar("bots_manage_add", 0);
setdvar("bots_manage_fill_kick", 1);
setDvarIfUninitialized("bots_main_debug_distance", 500.0);
setDvarIfUninitialized("bots_main_debug_cone", 0.65);
setDvarIfUninitialized("bots_main_debug_minDist", 30.0);
setDvarIfUninitialized("bots_main_debug_drawThrough", false);
if (getDvar("bots_main_debug_distance") == "")
setDvar("bots_main_debug_distance", 500.0);
if (getDvar("bots_main_debug_cone") == "")
setDvar("bots_main_debug_cone", 0.65);
if (getDvar("bots_main_debug_minDist") == "")
setDvar("bots_main_debug_minDist", 500.0);
if (getDvar("bots_main_debug_drawThrough") == "")
setDvar("bots_main_debug_drawThrough", false);
level waittill( "connected", player);
DeleteAllWaypoints();
player thread onPlayerSpawned();
}
@ -108,24 +116,29 @@ updateWaypointsStats()
self initHudElem3();
self initHudElem4();
for(;;)
for(time=0;;time+=0.05)
{
wait 0.05;
totalWpsHud setText(level.waypointCount);
closest = -1;
myEye = self getEye();
myAngles = self GetPlayerAngles();
for(i = 0; i < level.waypointCount; i++)
{
if(closest == -1 || closer(self.origin, level.waypoints[i].origin, level.waypoints[closest].origin))
closest = i;
wpOrg = level.waypoints[i].origin + (0, 0, 25);
if(distance(level.waypoints[i].origin, self.origin) < getDvarFloat("bots_main_debug_distance") && (bulletTracePassed(myEye, level.waypoints[i].origin + (0, 0, 25), false, self) || getDVarint("bots_main_debug_drawThrough")))
if(distance(level.waypoints[i].origin, self.origin) < getDvarFloat("bots_main_debug_distance") && (bulletTracePassed(myEye, wpOrg, false, self) || getDVarint("bots_main_debug_drawThrough")))
{
for(h = 0; h < level.waypoints[i].childCount; h++)
line(level.waypoints[i].origin + (0, 0, 25), level.waypoints[level.waypoints[i].children[h]].origin + (0, 0, 25), (1,0,1));
line(wpOrg, level.waypoints[level.waypoints[i].children[h]].origin + (0, 0, 25), (1,0,1));
if(self bots_IsFacingAtTarget(level.waypoints[i], getDvarFloat("bots_main_debug_cone")))
print3d(level.waypoints[i].origin + (0, 0, 25), i, (1,0,0), 2);
if(getConeDot(wpOrg, myEye, myAngles) > getDvarFloat("bots_main_debug_cone"))
print3d(wpOrg, i, (1,0,0), 2);
}
}
@ -133,7 +146,7 @@ updateWaypointsStats()
nearestWP setText(self.nearest);
children setText(buildChildString(self.nearest));
children setText(buildChildCountString(self.nearest));
type setText(buildTypeString(self.nearest));
@ -142,8 +155,12 @@ updateWaypointsStats()
infotext.x = infotext.x - 2;
if(infotext.x <= -800)
infotext.x = 800;
wait 0.05;
if (self UseButtonPressed() && time > 2)
{
time = 0;
self iPrintLnBold(self.nearest + " children: " + buildChildString(self.nearest));
}
}
}
@ -178,19 +195,21 @@ watchAutoLinkCommand()
self endon("disconnect");
self endon("death");
self notifyOnPlayerCommand("[{weapnext}]", "weapnext");
self notifyOnPlayerCommand("[{+frag}]", "+frag");
for( ;; )
{
self waittill("[{weapnext}]");
self waittill("[{+frag}]");
if(level.autoLink)
{
self iPrintlnBold("Auto link disabled");
level.autoLink = false;
level.wpToLink = -1;
}
else
{
self iPrintlnBold("Auto link enabled");
level.autoLink = true;
level.wpToLink = self.nearest;
}
}
}
@ -259,7 +278,7 @@ watchSaveWaypointsCommand()
self checkForWarnings();
logprint("***********ABiliTy's WPDump**************\n\n");
logprint("\n\n\n\n");
mpnm=bots_getMapName(getdvar("mapname"));
mpnm=getMapName(getdvar("mapname"));
logprint("\n\n"+mpnm+"()\n{\n/*");
logprint("*/waypoints = [];\n/*");
for(i = 0; i < level.waypointCount; i++)
@ -284,7 +303,7 @@ LoadWaypoints()
{
self DeleteAllWaypoints();
self iPrintlnBold("Loading WPS...");
bots_loadWaypoints();
load_waypoints();
self checkForWarnings();
}
@ -492,35 +511,24 @@ AddWaypoint()
}
}
roundUp( floatVal )
{
if ( int( floatVal ) != floatVal )
return int( floatVal+1 );
else
return int( floatVal );
}
DeleteAllWaypoints()
{
foreach(wp in level.waypoints)
{
wp = undefined;
}
level.waypoints = [];
level.waypointCount = 0;
foreach(wp in game["bots"]["waypoints"])
{
wp = undefined;
}
game["bots"]["waypoints"] = [];
game["bots"]["waypoints"] = undefined;
self iprintln("DelAllWps");
}
buildChildCountString ( wp )
{
if ( wp == -1 )
return "";
wpstr = level.waypoints[wp].childCount + "";
return wpstr;
}
buildChildString( wp )
{
if ( wp == -1 )
@ -551,9 +559,9 @@ destroyOnDeath(hud)
{
hud endon("death");
self waittill_either("death","disconnect");
hud notify("death");
hud destroy();
hud = undefined;
hud notify("death");
}
initHudElem(txt, xl, yl)

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
start iw4x.exe -nosteam -console +set r_fullscreen "0" +set r_mode "1024x768" +set drawlagometer "0" +set cg_drawfps "0" +set fs_game "mods/bots" +set bots_manage_fill "4" +set ui_mapname "mp_rust" +set scr_game_spectatetype "2" +set scr_war_scorelimit "0" +map mp_rust
start iw4x.exe -nosteam -console +set r_fullscreen "0" +set r_mode "1024x768" +set drawlagometer "0" +set cg_drawfps "0" +set fs_game "mods/dev" +set bots_manage_fill "4" +set ui_mapname "mp_rust" +set scr_game_spectatetype "2" +set scr_war_scorelimit "0" +map mp_rust