diff --git a/plugins/l4d2_guesswho.smx b/plugins/l4d2_guesswho.smx index ced0e99..10a9f2e 100644 Binary files a/plugins/l4d2_guesswho.smx and b/plugins/l4d2_guesswho.smx differ diff --git a/scripting/include/guesswho/gwcmds.inc b/scripting/include/guesswho/gwcmds.inc index 9d8d257..1daa926 100644 --- a/scripting/include/guesswho/gwcmds.inc +++ b/scripting/include/guesswho/gwcmds.inc @@ -4,7 +4,7 @@ public Action Command_GuessWho(int client, int args) { - if(!isEnabled) ReplyToCommand(client, "Warn: Guess Who is not active"); + if(!isEnabled) ReplyToCommand(client, "Warn: %s is not active", GAMEMODE_NAME); if(args > 0) { char subcmd[32]; GetCmdArg(1, subcmd, sizeof(subcmd)); @@ -17,18 +17,18 @@ public Action Command_GuessWho(int client, int args) { if(args == 3) { GetCmdArg(2, subcmd, sizeof(subcmd)); } else { - subcmd = currentSet; + subcmd = g_currentSet; } - if(movePoints.SaveMap(currentMap, subcmd)) { - ReplyToCommand(client, "Saved movement data for %s/%s", currentMap, subcmd); + if(movePoints.SaveMap(g_currentMap, subcmd)) { + ReplyToCommand(client, "Saved movement data for %s/%s", g_currentMap, subcmd); } else { ReplyToCommand(client, "Failed to save map data"); } } else if(StrEqual(subcmd, "load")) { - MovePoints points = MovePoints.LoadMap(currentMap, currentSet); + MovePoints points = MovePoints.LoadMap(g_currentMap, g_currentSet); if(points != null) { Game.SetPoints(points); - ReplyToCommand(client, "Loaded movement data for %s/%s", currentMap, currentSet); + ReplyToCommand(client, "Loaded movement data for %s/%s", g_currentMap, g_currentSet); } else { ReplyToCommand(client, "Failed to load map data"); } @@ -55,11 +55,11 @@ public Action Command_GuessWho(int client, int args) { ReplyToCommand(client, "Unknown option. Valid options: 'clear', 'save', 'load'"); } } else if(StrEqual(subcmd, "r") || StrEqual(subcmd, "reload", false)) { - GetCurrentMap(currentMap, sizeof(currentMap)); + GetCurrentMap(g_currentMap, sizeof(g_currentMap)); char arg[4]; GetCmdArg(2, arg, sizeof(arg)); if(ReloadMapDB()) { - if(!LoadConfigForMap(currentMap)) { + if(!LoadConfigForMap(g_currentMap)) { ReplyToCommand(client, "Warn: Map has no config file"); } Game.Cleanup(true); @@ -74,7 +74,7 @@ public Action Command_GuessWho(int client, int args) { } else if(StrEqual(subcmd, "set", false)) { char set[16]; if(args == 1) { - ReplyToCommand(client, "Current Map Set: \"%s\" (Specify with /gw set )", currentSet); + ReplyToCommand(client, "Current Map Set: \"%s\" (Specify with /gw set )", g_currentSet); if(validSets.Length == 0) ReplyToCommand(client, "Available Sets: (no map config found)"); else { ReplyToCommand(client, "Available Sets: "); @@ -84,25 +84,25 @@ public Action Command_GuessWho(int client, int args) { } } } else { - GetCmdArg(2, currentSet, sizeof(currentSet)); + GetCmdArg(2, g_currentSet, sizeof(g_currentSet)); for(int i = 0; i < validSets.Length; i++) { validSets.GetString(i, set, sizeof(set)); - if(StrEqual(set, currentSet)) { - if(!LoadConfigForMap(currentMap)) { - ReplyToCommand(client, "Warn: No config entry for %s", currentMap); + if(StrEqual(set, g_currentSet)) { + if(!LoadConfigForMap(g_currentMap)) { + ReplyToCommand(client, "Warn: No config entry for %s", g_currentMap); } - MovePoints points = MovePoints.LoadMap(currentMap, currentSet); + MovePoints points = MovePoints.LoadMap(g_currentMap, g_currentSet); if(points != null) { if(movePoints.Length == 0) { - ReplyToCommand(client, "Warn: No map data found for %s/%s", currentMap, currentSet); + ReplyToCommand(client, "Warn: No map data found for %s/%s", g_currentMap, g_currentSet); } Game.SetPoints(points); } else { - ReplyToCommand(client, "Warn: %s/%s has 0 saved movement locations", currentMap, currentSet); + ReplyToCommand(client, "Warn: %s/%s has 0 saved movement locations", g_currentMap, g_currentSet); } Game.Cleanup(); SetupEntities(isNavBlockersEnabled, isPropsEnabled, isPortalsEnabled); - PrintToChatAll("[GuessWho] Map set has been changed to \"%s\"", currentSet); + PrintToChatAll("[GuessWho] Map set has been changed to \"%s\"", g_currentSet); return Plugin_Handled; } } @@ -182,11 +182,11 @@ public Action Command_GuessWho(int client, int args) { do { int mapIndex = GetURandomInt() % validMaps.Length; validMaps.GetString(mapIndex, map, sizeof(map)); - if(!StrEqual(currentMap, map, false)) { + if(!StrEqual(g_currentMap, map, false)) { foundMap = true; } } while(!foundMap); - PrintToChatAll("[GuessWho] Switching map to %s", map); + PrintToChatAll("%s Switching map to %s", GAMEMODE_PREFIX, map); ChangeMap(map); } else if(StrEqual(arg, "next", false)) { if(args == 1) { @@ -196,7 +196,7 @@ public Action Command_GuessWho(int client, int args) { GetCmdArg(3, arg2, sizeof(arg2)); if(IsMapValid(arg2)) { strcopy(nextRoundMap, sizeof(nextRoundMap), arg2); - PrintToChatAll("[H&S] Switching map next round to %s", arg2); + PrintToChatAll("%s Switching map next round to %s", GAMEMODE_PREFIX, arg2); ForceChangeLevel(arg, "SetMapSelect"); } else { ReplyToCommand(client, "Map is not valid"); @@ -286,7 +286,7 @@ public Action Command_GuessWho(int client, int args) { ReplyToCommand(client, "State: %d | Tick: %d", view_as(Game.State), Game.Tick); ReplyToCommand(client, "- Map Info -"); - ReplyToCommand(client, "Map: %s (set %s)", currentMap, currentSet); + ReplyToCommand(client, "Map: %s (set %s)", g_currentMap, g_currentSet); if(mapConfig.hasSpawnpoint) ReplyToCommand(client, "Has Spawnpoint: yes (%f %f %f)", mapConfig.spawnpoint[0], mapConfig.spawnpoint[1], mapConfig.spawnpoint[2]); else @@ -298,7 +298,7 @@ public Action Command_GuessWho(int client, int args) { } return Plugin_Handled; } - ReplyToCommand(client, " === [ Guess Who Commands ] ==="); + ReplyToCommand(client, " === [ %s Commands ] ===", GAMEMODE_NAME); if(GetUserAdmin(client) != INVALID_ADMIN_ID) { ReplyToCommand(client, "- Dev Commands -"); ReplyToCommand(client, "points:"); diff --git a/scripting/include/guesswho/gwcore.inc b/scripting/include/guesswho/gwcore.inc index 41bd21f..2b68953 100644 --- a/scripting/include/guesswho/gwcore.inc +++ b/scripting/include/guesswho/gwcore.inc @@ -50,10 +50,10 @@ bool LoadConfigForMap(const char[] map) { static char buffer[64]; buffer[0] = '\0'; - if(StrEqual(currentSet, "default") && kv.GetString("defaultset", buffer, sizeof(buffer)) && buffer[0] != '\0') { - strcopy(currentSet, sizeof(currentSet), buffer); + if(StrEqual(g_currentSet, "default") && kv.GetString("defaultset", buffer, sizeof(buffer)) && buffer[0] != '\0') { + strcopy(g_currentSet, sizeof(g_currentSet), buffer); } - PrintToServer("[GuessWho] Loading config data for set %s on %s", currentSet, map); + PrintToServer("[GuessWho] Loading config data for set %s on %s", g_currentSet, map); if(kv.JumpToKey("ents")) { kv.GotoFirstSubKey(); @@ -71,7 +71,7 @@ bool LoadConfigForMap(const char[] map) { if(validSets.FindString(buffer) == -1) { validSets.PushString(buffer); } - if(StrEqual(buffer, "default") || StrEqual(currentSet, buffer, false)) { + if(StrEqual(buffer, "default") || StrEqual(g_currentSet, buffer, false)) { config.entities.PushArray(entCfg); } else { @@ -100,7 +100,7 @@ bool LoadConfigForMap(const char[] map) { config.hasSpawnpoint = false; config.canClimb = true; config.pressButtons = true; - if(!StrEqual(currentSet, "default") && kv.JumpToKey("sets")) { + if(!StrEqual(g_currentSet, "default") && kv.JumpToKey("sets")) { char set[16]; kv.GotoFirstSubKey(true); do { @@ -108,10 +108,10 @@ bool LoadConfigForMap(const char[] map) { if(validSets.FindString(set) == -1) { validSets.PushString(set); } - if(StrEqual(currentSet, set, false)) { + if(StrEqual(g_currentSet, set, false)) { kv.GetVector("spawnpoint", config.spawnpoint); if(config.spawnpoint[0] != 0.0 && config.spawnpoint[1] != 0.0 && config.spawnpoint[2] != 0.0) { - PrintToServer("[GuessWho] Using provided custom spawnpoint for set %s at %0.1f, %0.1f, %0.1f", currentSet, config.spawnpoint[0], config.spawnpoint[1], config.spawnpoint[2]); + PrintToServer("[GuessWho] Using provided custom spawnpoint for set %s at %0.1f, %0.1f, %0.1f", g_currentSet, config.spawnpoint[0], config.spawnpoint[1], config.spawnpoint[2]); config.hasSpawnpoint = true; } mapTime = kv.GetNum("maptime", 0); diff --git a/scripting/include/guesswho/gwents.inc b/scripting/include/guesswho/gwents.inc index 2c145b4..22ddf8c 100644 --- a/scripting/include/guesswho/gwents.inc +++ b/scripting/include/guesswho/gwents.inc @@ -231,7 +231,7 @@ void SetupEntities(bool blockers = true, bool props = true, bool portals = true) } #endif if(mapConfig.entities != null) { - PrintToServer("[GuessWho] Deploying %d custom entities (Set: %s) (blockers:%b props:%b portals:%b)", mapConfig.entities.Length, currentSet, blockers, props, portals); + PrintToServer("[GuessWho] Deploying %d custom entities (Set: %s) (blockers:%b props:%b portals:%b)", mapConfig.entities.Length, g_currentSet, blockers, props, portals); for(int i = 0; i < mapConfig.entities.Length; i++) { EntityConfig config; mapConfig.entities.GetArray(i, config); diff --git a/scripting/include/guesswho/gwgame.inc b/scripting/include/guesswho/gwgame.inc index 8ba35d2..b666f97 100644 --- a/scripting/include/guesswho/gwgame.inc +++ b/scripting/include/guesswho/gwgame.inc @@ -42,7 +42,7 @@ bool FindSpawnPosition(float pos[3], bool includePlayers = true) { static char buffer[128]; -methodmap GuessWhoGame { +methodmap GuessWhoGame < BaseGame { property int Seeker { public get() { diff --git a/scripting/l4d2_guesswho.sp b/scripting/l4d2_guesswho.sp index bbf55e4..a2b6a75 100644 --- a/scripting/l4d2_guesswho.sp +++ b/scripting/l4d2_guesswho.sp @@ -56,9 +56,7 @@ int PLAYER_GLOW_COLOR[3] = { 0, 255, 0 }; #include #include #include -#include #include -#include char SURVIVOR_MODELS[8][] = { "models/survivors/survivor_namvet.mdl", @@ -125,6 +123,8 @@ float vecLastLocation[MAXPLAYERS+1][3]; MovePoints movePoints; GuessWhoGame Game; + +#include #include @@ -147,6 +147,8 @@ public void OnPluginStart() { SetFailState("This plugin is for L4D2 only."); } + Game.Init("GuessWho"); + g_iTeamNum = FindSendPropInfo("CTerrorPlayerResource", "m_iTeam"); if (g_iTeamNum == -1) SetFailState("CTerrorPlayerResource \"m_iTeam\" offset is invalid"); @@ -186,7 +188,7 @@ public void Event_GamemodeChange(ConVar cvar, const char[] oldValue, const char[ if(shouldEnable) { cvarStorage = new GameConVarStorage(); SetCvars(cvarStorage); - PrintToChatAll("[GuessWho] Gamemode is starting"); + Game.Broadcast("Gamemode is starting"); HookEvent("round_start", Event_RoundStart); HookEvent("player_death", Event_PlayerDeath); HookEvent("player_bot_replace", Event_PlayerToBot); @@ -200,7 +202,6 @@ public void Event_GamemodeChange(ConVar cvar, const char[] oldValue, const char[ UnhookEvent("player_bot_replace", Event_PlayerToBot); UnhookEvent("player_ledge_grab", Event_LedgeGrab); Game.Cleanup(); - PrintToChatAll("[GuessWho] Gamemode unloaded but cvars have not been reset."); RemoveCommandListener(OnGoAwayFromKeyboard, "go_away_from_keyboard"); } isEnabled = shouldEnable; @@ -223,7 +224,7 @@ void Event_PlayerToBot(Event event, const char[] name, bool dontBroadcast) { // Do not kick bots being spawned in if(spawningTimer == null) { - PrintToServer("[GuessWho/debug] possible idle bot: %d (player: %d)", bot, player); + Game.Debug("possible idle bot: %d (player: %d)", bot, player); // ChangeClientTeam(player, 0); // L4D_SetHumanSpec(bot, player); L4D_TakeOverBot(player); @@ -237,24 +238,23 @@ void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) { int attacker = GetClientOfUserId(event.GetInt("attacker")); if(client > 0 && Game.State == State_Active) { if(client == currentSeeker) { - PrintToChatAll("The seeker, %N, has died. Hiders win!", currentSeeker); - Game.State = State_HidersWin; + Game.Broadcast("The seeker, %N, has died. Hiders win!", currentSeeker); Game.End(State_HidersWin); } else if(!IsFakeClient(client)) { if(attacker == currentSeeker) { - PrintToChatAll("%N was killed", client); + Game.Broadcast("%N was killed", client); } else { - PrintToChatAll("%N died", client); + Game.Broadcast("%N died", client); } } else { KickClient(client); - PrintToServer("[GuessWho] Bot(%d) was killed", client); + Game.Debug("Bot(%d) was killed", client); } } if(Game.AlivePlayers == 0) { if(Game.State == State_Active) { - PrintToChatAll("Everyone has died. %N wins!", currentSeeker); + Game.Broadcast("Everyone has died. %N wins!", currentSeeker); Game.End(State_SeekerWon); } } @@ -272,16 +272,16 @@ public void OnMapStart() { char map[128]; GetCurrentMap(map, sizeof(map)); - if(!StrEqual(currentMap, map)) { - strcopy(currentSet, sizeof(currentSet), "default"); - if(!StrEqual(currentMap, "")) { - if(!movePoints.SaveMap(currentMap, currentSet)) { + if(!StrEqual(g_currentMap, map)) { + strcopy(g_currentSet, sizeof(g_currentSet), "default"); + if(!StrEqual(g_currentMap, "")) { + if(!movePoints.SaveMap(g_currentMap, g_currentSet)) { LogError("Could not save map data to disk"); } } ReloadMapDB(); - strcopy(currentMap, sizeof(currentMap), map); - Game.SetPoints(MovePoints.LoadMap(map, currentSet)); + strcopy(g_currentMap, sizeof(g_currentMap), map); + Game.SetPoints(MovePoints.LoadMap(map, g_currentSet)); } g_iLaserIndex = PrecacheModel("materials/sprites/laserbeam.vmt"); @@ -297,7 +297,7 @@ public void OnMapStart() { int seeker = Game.Seeker; if(seeker > -1) { currentSeeker = seeker; - PrintToServer("[GuessWho] Late load, found seeker %N", currentSeeker); + Game.Debug("-Late load- Seeker: %N",currentSeeker); } for(int i = 1; i <= MaxClients; i++) { if(IsClientConnected(i) && IsClientInGame(i)) { @@ -341,7 +341,7 @@ public void OnClientPutInServer(int client) { if(isEnabled && !IsFakeClient(client)) { ChangeClientTeam(client, 1); isPendingPlay[client] = true; - PrintToChatAll("%N will play next round", client); + Game.Broadcast("%N will play next round", client); Game.TeleportToSpawn(client); } } @@ -350,12 +350,12 @@ public void OnClientPutInServer(int client) { public void OnClientDisconnect(int client) { if(!isEnabled) return; if(client == currentSeeker) { - PrintToChatAll("The seeker has disconnected"); + Game.Broadcast("The seeker has disconnected"); Game.End(State_HidersWin); } else if(!IsFakeClient(client) && Game.State == State_Active) { - PrintToChatAll("A hider has left (%N)", client); + Game.Broadcast("A hider has left (%N)", client); if(Game.AlivePlayers == 0 && Game.State == State_Active) { - PrintToChatAll("Game Over. %N wins!", currentSeeker); + Game.Broadcast("Game Over. %N wins!", currentSeeker); Game.End(State_SeekerWon); } } @@ -363,7 +363,7 @@ public void OnClientDisconnect(int client) { void SetCvars(GameConVarStorage storage) { - PrintToServer("[GuessWho] Setting convars"); + Game.Debug("Setting convars"); if(cvar_survivorLimit != null) { cvar_survivorLimit.SetBounds(ConVarBound_Upper, true, 64.0); cvar_survivorLimit.RecordInt(MaxClients, storage); @@ -380,11 +380,11 @@ void SetCvars(GameConVarStorage storage) { void InitGamemode() { if(isStarting && Game.State != State_Unknown) { - PrintToServer("[GuessWho] Warn: InitGamemode() called in an incorrect state (%d)", Game.State); + Game.Warn("InitGamemode() called in an incorrect state (%d)", Game.State); return; } SetupEntities(); - PrintToChatAll("InitGamemode(): activating"); + Game.DebugConsole("InitGamemode(): activating"); ArrayList validPlayerIds = new ArrayList(); for(int i = 1; i <= MaxClients; i++) { if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2) { @@ -406,7 +406,7 @@ void InitGamemode() { } } if(validPlayerIds.Length == 0) { - PrintToServer("[GuessWho] Warn: Ignoring InitGamemode() with no valid survivors"); + Game.Warn("Ignoring InitGamemode() with no valid survivors"); return; } ignoreSeekerBalance = false; @@ -414,7 +414,7 @@ void InitGamemode() { delete validPlayerIds; if(newSeeker > 0) { hasBeenSeeker[newSeeker] = true; - PrintToChatAll("%N is the seeker", newSeeker); + Game.Broadcast("%N is the seeker", newSeeker); Game.Seeker = newSeeker; SetPlayerBlind(newSeeker, 255); SetEntPropFloat(newSeeker, Prop_Send, "m_flLaggedMovementValue", 0.0); @@ -446,7 +446,7 @@ Action Timer_SpawnBots(Handle h, int max) { Action Timer_SpawnPost(Handle h) { spawningTimer = null; - PrintToChatAll("Timer_SpawnPost(): activating"); + Game.DebugConsole("Timer_SpawnPost(): activating"); bool isL4D1 = L4D2_GetSurvivorSetMap() == 1; int remainingSeekers; int survivorMaxIndex = isL4D1 ? 3 : 7; @@ -482,13 +482,13 @@ Action Timer_SpawnPost(Handle h) { } if(remainingSeekers == 0) { - PrintToChatAll("All players have been seekers once"); + Game.Broadcast("All players have been seekers once"); for(int i = 0; i <= MaxClients; i++) { hasBeenSeeker[i] = false; } } - PrintToChatAll("[debug] waiting for safe area leave"); + Game.Debug("waiting for safe area leave", BaseDebug_Server | BaseDebug_ChatAll); CreateTimer(1.0, Timer_WaitForStart, _, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT); return Plugin_Handled; @@ -515,7 +515,7 @@ Action Timer_WaitForStart(Handle h) { } } - PrintToChatAll("[GuessWho] Seeker will start in %.0f seconds", SEED_TIME); + Game.Broadcast("Seeker will start in %.0f seconds", SEED_TIME); Game.State = State_Starting; Game.Tick = 0; Game.MapTime = RoundFloat(SEED_TIME); @@ -541,7 +541,7 @@ Action Timer_StartSeeker(Handle h) { } Action Timer_TimesUp(Handle h) { - PrintToChatAll("The seeker ran out of time. Hiders win!"); + Game.Broadcast("The seeker ran out of time. Hiders win!"); Game.End(State_HidersWin); return Plugin_Handled; } @@ -592,7 +592,7 @@ Action Timer_AcquireLocations(Handle h) { if(meta.pos[0] != vecLastLocation[i][0] || meta.pos[1] != vecLastLocation[i][1] || meta.pos[2] != vecLastLocation[i][2]) { movePoints.AddPoint(meta); if(movePoints.Length > MAX_VALID_LOCATIONS) { - PrintToServer("[GuessWho] Hit MAX_VALID_LOCATIONS (%d), clearing some locations", MAX_VALID_LOCATIONS); + Game.Warn("Hit MAX_VALID_LOCATIONS (%d), clearing some locations", MAX_VALID_LOCATIONS); movePoints.Sort(Sort_Random, Sort_Float); movePoints.Erase(RoundFloat(MAX_VALID_LOCATIONS * MAX_VALID_LOCATIONS_KEEP_PERCENT)); } @@ -606,15 +606,6 @@ Action Timer_AcquireLocations(Handle h) { return Plugin_Continue; } -void GetMovePoint(int i) { - activeBotLocations[i].runto = GetURandomFloat() < BOT_MOVE_RUN_CHANCE; - activeBotLocations[i].attempts = 0; - movePoints.GetArray(GetURandomInt() % movePoints.Length, activeBotLocations[i]); - #if defined DEBUG_SHOW_POINTS - Effect_DrawBeamBoxRotatableToAll(activeBotLocations[i].pos, DEBUG_POINT_VIEW_MIN, DEBUG_POINT_VIEW_MAX, NULL_VECTOR, g_iLaserIndex, 0, 0, 0, 150.0, 0.1, 0.1, 0, 0.0, {255, 0, 255, 120}, 0); - #endif -} - Action Timer_BotMove(Handle h, int userid) { int i = GetClientOfUserId(userid); if(i == 0) return Plugin_Stop; @@ -637,7 +628,7 @@ Action Timer_BotMove(Handle h, int userid) { TE_SendToAll(); L4D2_RunScript("CommandABot({cmd=1,bot=GetPlayerFromUserID(%i),pos=Vector(%f,%f,%f)})", GetClientUserId(i), seekerPos[0], seekerPos[1], seekerPos[2]); #if defined DEBUG_BOT_MOVE - PrintToConsoleAll("[gw/debug] BOT %N TOO FAR (%f) BOUNDS (%f, %f)-> Moving to seeker (%f %f %f)", i, botFlow, flowMin, flowMax, seekerPos[0], seekerPos[1], seekerPos[2]); + Game.DebugConsole("BOT %N TOO FAR (%f) BOUNDS (%f, %f)-> Moving to seeker (%f %f %f)", i, botFlow, flowMin, flowMax, seekerPos[0], seekerPos[1], seekerPos[2]); #endif activeBotLocations[i].attempts = 0; } else if(movePoints.Length > 0) { @@ -653,12 +644,12 @@ Action Timer_BotMove(Handle h, int userid) { if(mapConfig.hasSpawnpoint && FloatAbs(botFlow - seekerFlow) < BOT_MOVE_AVOID_FLOW_DIST && GetURandomFloat() < BOT_MOVE_AVOID_SEEKER_CHANCE) { if(!movePoints.GetRandomPointFar(seekerPos, activeBotLocations[i].pos, BOT_MOVE_AVOID_MIN_DISTANCE)) { #if defined DEBUG_BOT_MOVE - PrintToConsoleAll("[gw/debug] BOT %N TOO CLOSE -> Failed to find far point, falling back to spawn", i); + // DebugConsole("BOT %N TOO CLOSE -> Failed to find far point, falling back to spawn", i); #endif activeBotLocations[i].pos = mapConfig.spawnpoint; } else { #if defined DEBUG_BOT_MOVE - PrintToConsoleAll("[gw/debug] BOT %N TOO CLOSE -> Moving to far point (%f %f %f) (%f units away)", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2], GetVectorDistance(seekerPos, activeBotLocations[i].pos)); + // DebugConsole("BOT %N TOO CLOSE -> Moving to far point (%f %f %f) (%f units away)", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2], GetVectorDistance(seekerPos, activeBotLocations[i].pos)); #endif } activeBotLocations[i].runto = GetURandomFloat() < 0.75; @@ -666,15 +657,14 @@ Action Timer_BotMove(Handle h, int userid) { Effect_DrawBeamBoxRotatableToAll(activeBotLocations[i].pos, DEBUG_POINT_VIEW_MIN, DEBUG_POINT_VIEW_MAX, NULL_VECTOR, g_iLaserIndex, 0, 0, 0, 150.0, 0.2, 0.1, 0, 0.0, {255, 255, 255, 255}, 0); #endif } else { - GetMovePoint(i); + movePoints.GetRandomPoint(activeBotLocations[i]); } if(!L4D2_IsReachable(i, activeBotLocations[i].pos)) { #if defined DEBUG_BOT_MOVE - PrintToChatAll("[gw/debug] POINT UNREACHABLE (Bot:%d) (%f %f %f)", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2]); - PrintToServer("[gw/debug] POINT UNREACHABLE (Bot:%d) (%f %f %f)", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2]); + Game.Warn("Point is unreachable at (%f, %f, %f) for %L", activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2], i); Effect_DrawBeamBoxRotatableToAll(activeBotLocations[i].pos, DEBUG_POINT_VIEW_MIN, view_as({ 10.0, 10.0, 100.0 }), NULL_VECTOR, g_iLaserIndex, 0, 0, 0, 400.0, 2.0, 3.0, 0, 0.0, {255, 0, 0, 255}, 0); #endif - GetMovePoint(i); + movePoints.GetRandomPoint(activeBotLocations[i]); } } else { // Has not reached dest @@ -685,7 +675,7 @@ Action Timer_BotMove(Handle h, int userid) { if(activeBotLocations[i].attempts == BOT_MOVE_NOT_REACHED_ATTEMPT_RUNJUMP) { if(distanceToPoint <= (BOT_MOVE_NOT_REACHED_DISTANCE * 2)) { #if defined DEBUG_BOT_MOVE - PrintToConsoleAll("[gw/debug] Bot %d still has not reached point (%f %f %f), jumping", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2]); + Game.DebugConsole("Bot %d still has not reached point (%f %f %f), jumping", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2]); L4D2_SetPlayerSurvivorGlowState(i, true); L4D2_SetEntityGlow(i, L4D2Glow_Constant, 0, 10, PLAYER_GLOW_COLOR, true); #endif @@ -693,7 +683,7 @@ Action Timer_BotMove(Handle h, int userid) { } else { activeBotLocations[i].runto = true; #if defined DEBUG_BOT_MOVE - PrintToConsoleAll("[gw/debug] Bot %d not reached point (%f %f %f), running", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2]); + Game.DebugConsole("Bot %d not reached point (%f %f %f), running", i, activeBotLocations[i].pos[0], activeBotLocations[i].pos[1], activeBotLocations[i].pos[2]); L4D2_SetEntityGlow(i, L4D2Glow_Constant, 0, 10, PLAYER_GLOW_COLOR, true); L4D2_SetPlayerSurvivorGlowState(i, true); #endif @@ -704,7 +694,7 @@ Action Timer_BotMove(Handle h, int userid) { L4D2_SetEntityGlow(i, L4D2Glow_Constant, 0, 10, SEEKER_GLOW_COLOR, true); L4D2_SetPlayerSurvivorGlowState(i, true); #endif - GetMovePoint(i); + movePoints.GetRandomPoint(activeBotLocations[i]); } #if defined DEBUG_SHOW_POINTS int color[4];