diff --git a/addons/sourcemod/scripting/confoglcompmod.sp b/addons/sourcemod/scripting/confoglcompmod.sp index e3b6d7115..3701e8064 100644 --- a/addons/sourcemod/scripting/confoglcompmod.sp +++ b/addons/sourcemod/scripting/confoglcompmod.sp @@ -3,7 +3,7 @@ #define DEBUG_ALL 0 -#define PLUGIN_VERSION "2.4.3" +#define PLUGIN_VERSION "2.4.4" // Using these macros, you can disable unnecessary modules, // and they will not be included in the plugin at compile time, diff --git a/addons/sourcemod/scripting/confoglcompmod/BossSpawning.sp b/addons/sourcemod/scripting/confoglcompmod/BossSpawning.sp index e10719d62..1e3b8fe69 100644 --- a/addons/sourcemod/scripting/confoglcompmod/BossSpawning.sp +++ b/addons/sourcemod/scripting/confoglcompmod/BossSpawning.sp @@ -3,7 +3,7 @@ #endif #define __boss_spawning_included -#define DEBUG_BS 0 +#define DEBUG_BS false #define BS_MODULE_NAME "BossSpawning" #define MAX_TANKS 5 @@ -14,6 +14,7 @@ static char BS_sMap[64] = "\0"; static bool + BS_bDebugEnabled = DEBUG_BS, BS_bEnabled = true, BS_bIsFirstRound = true, BS_bDeleteWitches = false, @@ -123,13 +124,13 @@ void BS_OnTankSpawnPost_Forward(int iTankClient) return; } - if (DEBUG_BS || IsDebugEnabled()) { + if (BS_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Tracking this tank spawn. Currently, %d tanks", BS_MODULE_NAME, BS_iTankCount[view_as(!BS_bIsFirstRound)]); } if (BS_bIsFirstRound) { GetClientAbsOrigin(iTankClient, BS_fTankSpawn[BS_iTankCount[0]]); - if (DEBUG_BS || IsDebugEnabled()) { + if (BS_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Saving tank at %f %f %f", \ BS_MODULE_NAME, BS_fTankSpawn[BS_iTankCount[0]][0], BS_fTankSpawn[BS_iTankCount[0]][1], BS_fTankSpawn[BS_iTankCount[0]][2]); } @@ -138,13 +139,13 @@ void BS_OnTankSpawnPost_Forward(int iTankClient) } else if (BS_iTankCount[0] > BS_iTankCount[1]) { TeleportEntity(iTankClient, BS_fTankSpawn[BS_iTankCount[1]], NULL_VECTOR, NULL_VECTOR); - if (DEBUG_BS || IsDebugEnabled()) { + if (BS_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Teleporting tank to tank at %f %f %f", \ BS_MODULE_NAME, BS_fTankSpawn[BS_iTankCount[1]][0], BS_fTankSpawn[BS_iTankCount[1]][1], BS_fTankSpawn[BS_iTankCount[1]][2]); } BS_iTankCount[1]++; - } else if (DEBUG_BS || IsDebugEnabled()) { + } else if (BS_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Not first round and not acceptable tank", BS_MODULE_NAME); LogMessage("[%s] IsFirstRound: %d R1Count: %d R2Count: %d", BS_MODULE_NAME, BS_bIsFirstRound, BS_iTankCount[0], BS_iTankCount[1]); } @@ -183,7 +184,7 @@ static void FixZDistance(int iTankClient) float WarpToLocation[3], TankLocation[3], TempSurvivorLocation[3]; GetClientAbsOrigin(iTankClient, TankLocation); - if (DEBUG_BS || IsDebugEnabled()) { + if (BS_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] tank z spawn check... Map: %s, Tank Location: %f, %f, %f", BS_MODULE_NAME, BS_sMap, TankLocation[0], TankLocation[1], TankLocation[2]); } @@ -194,7 +195,7 @@ static void FixZDistance(int iTankClient) if (index != 0 && IsValidEntity(index)) { GetClientAbsOrigin(index, TempSurvivorLocation); - if (DEBUG_BS || IsDebugEnabled()) { + if (BS_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Survivor %d Location: %f, %f, %f", BS_MODULE_NAME, i, TempSurvivorLocation[0], TempSurvivorLocation[1], TempSurvivorLocation[2]); } diff --git a/addons/sourcemod/scripting/confoglcompmod/EntityRemover.sp b/addons/sourcemod/scripting/confoglcompmod/EntityRemover.sp index 4f73d4d04..45a85e69f 100644 --- a/addons/sourcemod/scripting/confoglcompmod/EntityRemover.sp +++ b/addons/sourcemod/scripting/confoglcompmod/EntityRemover.sp @@ -21,6 +21,7 @@ #define ER_KV_CONDITION_CONTAINS 5 static bool + ER_bDebugEnabled = DEBUG_ER, ER_bKillParachutist = true, ER_bReplaceGhostHurt = false; @@ -77,7 +78,7 @@ static void ER_KV_Load() { char sNameBuff[PLATFORM_MAX_PATH], sDescBuff[256], sValBuff[32]; - if (DEBUG_ER || IsDebugEnabled()) { + if (ER_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Loading EntityRemover KeyValues", ER_MODULE_NAME); } @@ -92,7 +93,7 @@ static void ER_KV_Load() } // Create cvars for all entity removes - if (DEBUG_ER || IsDebugEnabled()) { + if (ER_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Creating entry CVARs", ER_MODULE_NAME); } @@ -108,7 +109,7 @@ static void ER_KV_Load() CreateConVarEx(sNameBuff, sValBuff, sDescBuff); - if (DEBUG_ER || IsDebugEnabled()) { + if (ER_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Creating CVAR %s", ER_MODULE_NAME, sNameBuff); } @@ -266,7 +267,7 @@ static bool ER_KV_TakeAction(int action, int iEntity) { switch (action) { case ER_KV_ACTION_KILL: { - if (DEBUG_ER || IsDebugEnabled()) { + if (ER_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Killing!", ER_MODULE_NAME); } @@ -359,7 +360,7 @@ public void ER_RoundStart_Event(Event hEvent, const char[] sEventName, bool bdon public Action ER_RoundStart_Timer(Handle hTimer) { char sBuffer[MAX_ENTITY_NAME_LENGTH]; - if (DEBUG_ER || IsDebugEnabled()) { + if (ER_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Starting RoundStart Event", ER_MODULE_NAME); } @@ -381,7 +382,7 @@ public Action ER_RoundStart_Timer(Handle hTimer) } else if (ER_bReplaceGhostHurt && ER_ReplaceTriggerHurtGhost(ent)) { //empty } else if (kERData != null && kERData.JumpToKey(sBuffer)) { - if (DEBUG_ER || IsDebugEnabled()) { + if (ER_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Dealing with an instance of %s", ER_MODULE_NAME, sBuffer); } diff --git a/addons/sourcemod/scripting/confoglcompmod/MapInfo.sp b/addons/sourcemod/scripting/confoglcompmod/MapInfo.sp index a095b785d..5cd36a14e 100644 --- a/addons/sourcemod/scripting/confoglcompmod/MapInfo.sp +++ b/addons/sourcemod/scripting/confoglcompmod/MapInfo.sp @@ -3,7 +3,7 @@ #endif #define __map_info_included -#define DEBUG_MI 0 +#define DEBUG_MI false #define MI_MODULE_NAME "MapInfo" static int @@ -11,6 +11,7 @@ static int iIsInEditMode[MAXPLAYERS + 1] = {0, ...}; static bool + MI_bDebugEnabled = DEBUG_MI, MapDataAvailable = false; static float @@ -194,7 +195,7 @@ static void MI_KV_Load() { char sNameBuff[PLATFORM_MAX_PATH]; - if (DEBUG_MI || IsDebugEnabled()) { + if (MI_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Loading MapInfo KeyValues", MI_MODULE_NAME); } diff --git a/addons/sourcemod/scripting/confoglcompmod/ReqMatch.sp b/addons/sourcemod/scripting/confoglcompmod/ReqMatch.sp index 234466bc8..632f71157 100644 --- a/addons/sourcemod/scripting/confoglcompmod/ReqMatch.sp +++ b/addons/sourcemod/scripting/confoglcompmod/ReqMatch.sp @@ -3,13 +3,14 @@ #endif #define __reg_match_included -#define RM_DEBUG 0 +#define RM_DEBUG false #define RM_MODULE_NAME "ReqMatch" #define MAPRESTARTTIME 3.0 #define RESETMINTIME 60.0 static bool + RM_bDebugEnabled = RM_DEBUG, // RM_bMatchRequest[2] = {false, ...}, RM_bIsMatchModeLoaded = false, RM_bIsAMatchActive = false, @@ -92,7 +93,7 @@ void RM_OnModuleStart() if (RM_hReloaded.BoolValue) { - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Plugin was reloaded from match mode, executing match load", RM_MODULE_NAME); } @@ -116,7 +117,7 @@ void RM_OnMapStart() return; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] New map, executing match config...", RM_MODULE_NAME); } @@ -140,7 +141,7 @@ void RM_OnClientPutInServer() static void RM_Match_Load() { - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match Load", RM_MODULE_NAME); } @@ -155,7 +156,7 @@ static void RM_Match_Load() if (!RM_bIsPluginsLoaded) { - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Loading plugins and reload self", RM_MODULE_NAME); } @@ -185,7 +186,7 @@ static void RM_Match_Load() RM_hConfigFile_On.GetString(sBuffer, sizeof(sBuffer)); ExecuteCfg(sBuffer); - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match config executed", RM_MODULE_NAME); } @@ -195,7 +196,7 @@ static void RM_Match_Load() return; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Setting match mode active", RM_MODULE_NAME); } @@ -227,7 +228,7 @@ static void RM_Match_Load() hDp.WriteString(sMap); } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match mode loaded!", RM_MODULE_NAME); } @@ -244,7 +245,7 @@ static void RM_Match_Unload(bool bForced = false) if (!bIsHumansOnServer || bForced) { - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match is no longer active, sb_all_bot_game reset to 0, IsHumansOnServer %b, bForced %b", RM_MODULE_NAME, bIsHumansOnServer, bForced); } @@ -258,7 +259,7 @@ static void RM_Match_Unload(bool bForced = false) return; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Unloading match mode...", RM_MODULE_NAME); } @@ -290,7 +291,7 @@ static void RM_Match_Unload(bool bForced = false) ExecuteCfg(sBuffer); } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match mode unloaded!", RM_MODULE_NAME); } @@ -300,7 +301,7 @@ public Action RM_Match_MapRestart_Timer(Handle hTimer, DataPack hDp) { ServerCommand("sm plugins load_lock"); // rework - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Restarting map...", RM_MODULE_NAME); } @@ -324,7 +325,7 @@ static bool RM_UpdateCfgOn(const char[] cfgfile, bool bIsPrint = true) // PrintToChatAll("\x01[\x05Confogl\x01] Using \"\x04%s\x01\" config.", cfgfile); CPrintToChatAll("{blue}[{default}Confogl{blue}]{default} Loading '{olive}%s{default}'.", cfgfile); - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Starting match on config %s", RM_MODULE_NAME, cfgfile); } @@ -348,7 +349,7 @@ public Action RM_Cmd_ForceMatch(int client, int args) return Plugin_Handled; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match mode forced to load!", RM_MODULE_NAME); } @@ -422,7 +423,7 @@ public Action RM_Cmd_ResetMatch(int client, int args) return Plugin_Handled; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match mode forced to unload!", RM_MODULE_NAME); } @@ -490,7 +491,7 @@ public Action RM_CMD_ChangeMatch(int client, int args) return Plugin_Handled; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match mode forced to unload! [Change in this case!]", RM_MODULE_NAME); } @@ -513,7 +514,7 @@ public Action Timer_DelayToLoadMatchMode(Handle timer) return Plugin_Handled; } - if (RM_DEBUG || IsDebugEnabled()) + if (RM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] Match mode forced to load! [Change in this case!]", RM_MODULE_NAME); } diff --git a/addons/sourcemod/scripting/confoglcompmod/ScoreMod.sp b/addons/sourcemod/scripting/confoglcompmod/ScoreMod.sp index 87dcdea33..fdf845f37 100644 --- a/addons/sourcemod/scripting/confoglcompmod/ScoreMod.sp +++ b/addons/sourcemod/scripting/confoglcompmod/ScoreMod.sp @@ -3,7 +3,7 @@ #endif #define __scoremod_included -#define DEBUG_SM 0 +#define DEBUG_SM false #define SM_MODULE_NAME "ScoreMod" static int @@ -21,6 +21,7 @@ static float SM_fTempMulti[3] = {0.0, ...}; static bool + SM_bDebugEnabled = DEBUG_SM, SM_bEventsHooked = false, SM_bModuleIsEnabled = false, SM_bHooked = false, @@ -348,7 +349,7 @@ public Action SM_Cmd_Health(int client, int args) int iScore = RoundToFloor(fAvgHealth * SM_fMapMulti * SM_fHBRatio) * iAliveCount; - if (DEBUG_SM || IsDebugEnabled()) { + if (SM_bDebugEnabled || IsDebugEnabled()) { LogMessage("[%s] CalcScore: %d MapMulti: %.02f Multiplier %.02f", SM_MODULE_NAME, iScore, SM_fMapMulti, SM_fHBRatio); } @@ -462,11 +463,11 @@ static float SM_CalculateAvgHealth(int &iAliveCount = 0) // return Average Health Points float fAvgHealth = (iTotalHealth + fTotalAdjustedTempHealth) / iSurvCount; - -#if DEBUG_SM - LogMessage("[%s] TotalPerm: %d TotalAdjustedTemp: %.02f SurvCount: %d AliveCount: %d AvgHealth: %.02f", \ - SM_MODULE_NAME, iTotalHealth, fTotalAdjustedTempHealth, iSurvCount, iAliveCount, fAvgHealth); -#endif + + if (SM_bDebugEnabled || IsDebugEnabled()) { + LogMessage("[%s] TotalPerm: %d TotalAdjustedTemp: %.02f SurvCount: %d AliveCount: %d AvgHealth: %.02f", \ + SM_MODULE_NAME, iTotalHealth, fTotalAdjustedTempHealth, iSurvCount, iAliveCount, fAvgHealth); + } return fAvgHealth; } diff --git a/addons/sourcemod/scripting/confoglcompmod/includes/debug.sp b/addons/sourcemod/scripting/confoglcompmod/includes/debug.sp index 7b6199262..77eaba767 100644 --- a/addons/sourcemod/scripting/confoglcompmod/includes/debug.sp +++ b/addons/sourcemod/scripting/confoglcompmod/includes/debug.sp @@ -3,26 +3,16 @@ #endif #define __confogl_debug_included -#if DEBUG_ALL - #define DEBUG_DEFAULT "1" -#else - #define DEBUG_DEFAULT "0" -#endif - static char g_sLogAction[256]; -static bool - g_bConfoglDebug = false; - static ConVar g_hCvarCustomErrorLog = null, g_hCvarDebugConVar = null; void Debug_OnModuleStart() { - g_hCvarDebugConVar = CreateConVarEx("debug", DEBUG_DEFAULT, "Turn on Debug Logging in all Confogl Modules", _, true, 0.0, true, 1.0); - + g_hCvarDebugConVar = CreateConVarEx("debug", "0", "Turn on debug logging in all confogl modules", _, true, 0.0, true, 1.0); //confogl_custom_error_logs g_hCvarCustomErrorLog = CreateConVarEx( \ "custom_error_logs", \ @@ -31,8 +21,9 @@ void Debug_OnModuleStart() _, true, 0.0, true, 1.0 \ ); - g_bConfoglDebug = g_hCvarDebugConVar.BoolValue; - g_hCvarDebugConVar.AddChangeHook(Debug_ConVarChange); +#if DEBUG_ALL + g_hCvarDebugConVar.BoolValue = true; +#endif char sTime[64], sBuffer[64]; FormatTime(sTime, sizeof(sTime), "%Y%m%d"); @@ -45,14 +36,9 @@ void Debug_OnModuleStart() } } -public void Debug_ConVarChange(ConVar hConvar, const char[] sOldValue, const char[] sNewValue) -{ - g_bConfoglDebug = hConvar.BoolValue; -} - stock bool IsDebugEnabled() { - return (g_bConfoglDebug || DEBUG_ALL); + return (g_hCvarDebugConVar.BoolValue); } stock void Debug_LogError(const char[] sModuleName, const char[] sMessage, any ...)