TungstenVn

Trapdoor_idea

Sep 14th, 2021 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.56 KB | None | 0 0
  1. 1) find out if there is any better api for this, like, get chunktick of a specific areas or anything else
  2.  
  3. 2) if there is none beside the "LevelChunk_tick_9d729ccd"
  4. than maybe this idea would work:
  5. this is the current code:
  6. =============================================================================================
  7. THook(void, LevelChunk_tick_9d729ccd, void *levelChunk,
  8.       trapdoor::BlockSource *blockSource, size_t *tick) {
  9.     if (mod::tick::gameProfiler.inProfiling) {
  10.         TIMER_START
  11.         original(levelChunk, blockSource, tick);
  12.         TIMER_END
  13.         mod::tick::gameProfiler.chunkTickTime += timeReslut;
  14.         mod::tick::gameProfiler.tickChunkNum++;
  15.     } else {
  16.         original(levelChunk, blockSource, tick);
  17.     }
  18. }
  19. ==============================================================================================
  20. - make it alway running, no need to wait for inProfiling to be changed to true
  21. - idk how many ticks will pass for this thook to be called again, but i think it is not a long time so each time when this THook is called, you make a loop code to get all online players position and save it into a variable.
  22. - now check if ChunkTick is bigger than some value, maybe 50ms, if yes, than there is a lag chunk.
  23. - you check players position again, if anyone have a different position which further than some value, maybe 256 block, than teleport them back in spawn point
  24.  
  25. so it is only 3 steps:
  26. 1) make a loop code to get players coord, and compare coords
  27. 2) check if chunktick is bigger than some value
  28. 3) teleport player to spawnpoint
  29.  
Add Comment
Please, Sign In to add comment