Merge pull request #55 from mollthecoder/patch-1

Create libhooktick.js
This commit is contained in:
slweeb 2023-01-16 17:55:55 -05:00 committed by GitHub
commit 485b5ca561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

13
mods/libhooktick.js Normal file
View File

@ -0,0 +1,13 @@
clearInterval(tickInterval);
const oldTick = tick;
let __registeredTickCallbacks = [];
function everyTick(callback){
__registeredTickCallbacks.push(callback);
}
tick = function(){
oldTick();
__registeredTickCallbacks.forEach(func=>{
func();
});
}
tickInterval = setInterval(tick, 1000/tps);