summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-07-03 18:38:18 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-07-03 18:43:03 -0400
commit769dd7fe7bfd8290148b3aeb3e8cd366183a8167 (patch)
tree6c5c441badde77d9b877f3712e7263b18031bcd3
parent3c20e910298bd7064eb8bd8a5ed0caaf5b20b6c4 (diff)
downloadpipeworks-769dd7fe7bfd8290148b3aeb3e8cd366183a8167.tar
pipeworks-769dd7fe7bfd8290148b3aeb3e8cd366183a8167.tar.gz
pipeworks-769dd7fe7bfd8290148b3aeb3e8cd366183a8167.tar.bz2
pipeworks-769dd7fe7bfd8290148b3aeb3e8cd366183a8167.tar.xz
pipeworks-769dd7fe7bfd8290148b3aeb3e8cd366183a8167.zip
Adjust rate control code to work better
now it'll run at full speed if there's enough time else it'll throttle back to 1/3. (at that point, the movement imprecision caused by this will become hidden behind lag-induced imprecision)
-rw-r--r--luaentity.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/luaentity.lua b/luaentity.lua
index 382b0c1..34b6665 100644
--- a/luaentity.lua
+++ b/luaentity.lua
@@ -362,13 +362,12 @@ local move_entities_globalstep_part2 = function(dtime)
end
end
-local handle_active_blocks_step = 0.2
local handle_active_blocks_timer = 0.1
minetest.register_globalstep(function(dtime)
handle_active_blocks_timer = handle_active_blocks_timer + dtime
- if handle_active_blocks_timer >= handle_active_blocks_step then
- handle_active_blocks_timer = handle_active_blocks_timer - handle_active_blocks_step
+ if dtime < 0.2 or handle_active_blocks_timer >= (dtime * 3) then
+ handle_active_blocks_timer = 0.1
move_entities_globalstep_part1(dtime)
move_entities_globalstep_part2(dtime)
end