mouseas / steamSummerMinigame

Steam Summer Sale 2015 - Auto-play Optimizer
MIT License
136 stars 189 forks source link

Optimized the starting code and fixed the first run code for Tampermonkey / Greasemonkey users. #40

Closed winneon closed 9 years ago

winneon commented 9 years ago

Only manual users of the script felt the first run code changes (disable particles and flinching animations) because the TM / GM runs the instant the page is loaded, not when the game is loaded.

The script got past the original checks like normal in TM / GM because it checked to see if m_bRunning and m_rgPlayerTechTree existed first (those indicate the game has fully loaded). However, the first run code was run before the interval started, thus making it useless to TM / GM users. This pull request fixes that by putting all of that code into a firstRun function and only running it once after it goes through the initial check.

The TODO statements were placed at the top for readability, and I updated their bullets to match the README.md's version.

Due to the first run changes, I moved the interval checking to the bottom. This also removes the need to run the check every single time the interval goes through a cycle.