if not GamePlayCentralManager or GamePlayCentralManager._ht_cook_start_hooked then return end
GamePlayCentralManager._ht_cook_start_hooked = true
local original_start = GamePlayCentralManager.start_heist_timer
local function run_event(id)
    local player = managers.player and managers.player:player_unit()
    if not alive(player) then return end
    for _, script in pairs(managers.mission and managers.mission._scripts or {}) do
        local element = script:elements()[id]
        if element then element:on_executed(player) return end
    end
end
function GamePlayCentralManager:start_heist_timer(...)
    local result = original_start(self, ...)
    if Global.game_settings and Global.game_settings.level_id == "rat" and HT:getSetting("cook_spawn_twitch_start") then
        DelayedCalls:Add("ht_spawn_twitch_start", 1, function() pcall(run_event, 101127) end)
    end
    return result
end
