Skip to content

Commit

Permalink
Reset timers on map change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikusch committed Feb 27, 2025
1 parent c91ef85 commit 0874dd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/mitm.sp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void OnMapStart()
g_bInWaitingForPlayers = false;

Precache();
DHooks_HookGameRules();
DHooks_OnMapStart();
}

public void VScript_OnScriptVMInitialized()
Expand Down
15 changes: 9 additions & 6 deletions addons/sourcemod/scripting/mitm/dhooks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ void DHooks_VScriptInit()
DHooks_CreateScriptDetour(NULL_STRING, "IsPlayerABot", DHookCallback_IsPlayerABot_Pre);
}

void DHooks_OnMapStart()
{
m_cooldownTimer.Invalidate();
m_checkForDangerousSentriesTimer.Invalidate();

if (g_hDHook_CTeamplayRoundBasedRules_RespawnPlayers)
PSM_DHookGameRules(g_hDHook_CTeamplayRoundBasedRules_RespawnPlayers, Hook_Pre, DHookCallback_CTFGameRules_RespawnPlayers_Pre);
}

void DHooks_OnEntityCreated(int entity, const char[] classname)
{
if (IsEntityClient(entity))
Expand Down Expand Up @@ -195,12 +204,6 @@ void DHooks_OnEntityCreated(int entity, const char[] classname)
}
}

void DHooks_HookGameRules()
{
if (g_hDHook_CTeamplayRoundBasedRules_RespawnPlayers)
PSM_DHookGameRules(g_hDHook_CTeamplayRoundBasedRules_RespawnPlayers, Hook_Pre, DHookCallback_CTFGameRules_RespawnPlayers_Pre);
}

static void DHooks_CopyScriptFunctionBinding(const char[] sourceClassName, const char[] functionName, const char[] targetClassName, DHookCallback callbackPre = INVALID_FUNCTION, DHookCallback callbackPost = INVALID_FUNCTION, bool bEmpty = true)
{
VScriptFunction pTargetFunc = VScript_GetClassFunction(targetClassName, functionName);
Expand Down

0 comments on commit 0874dd6

Please sign in to comment.