aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorAuke Kok <sofar+github@foo-projects.org>2017-04-02 08:51:16 +0000
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-02 10:51:16 +0200
commit75fb3e47308823cf39d4aae0fd739ca445e8e36c (patch)
treea897010733e9dcf9f287c4e7a7e7ecca700dfab2 /builtin
parent26f4a5c2d1e3d825816188fcd63f6d1f6758ae60 (diff)
downloadminetest-75fb3e47308823cf39d4aae0fd739ca445e8e36c.tar.gz
minetest-75fb3e47308823cf39d4aae0fd739ca445e8e36c.tar.bz2
minetest-75fb3e47308823cf39d4aae0fd739ca445e8e36c.zip
minetest.after(): simplify further, pause in singleplayer (#5500)
Using the `dtime` value entirely, this will stop the clock if the game is paused in singleplayer. Since most of the clocks were fixed a long time ago, this should again be safe to use.
Diffstat (limited to 'builtin')
-rw-r--r--builtin/common/after.lua12
1 files changed, 1 insertions, 11 deletions
diff --git a/builtin/common/after.lua b/builtin/common/after.lua
index 30a9c7bad..cdfaaab86 100644
--- a/builtin/common/after.lua
+++ b/builtin/common/after.lua
@@ -1,18 +1,8 @@
local jobs = {}
local time = 0.0
-local last = core.get_us_time() / 1000000
core.register_globalstep(function(dtime)
- local new = core.get_us_time() / 1000000
- if new > last then
- time = time + (new - last)
- else
- -- Overflow, we may lose a little bit of time here but
- -- only 1 tick max, potentially running timers slightly
- -- too early.
- time = time + new
- end
- last = new
+ time = time + dtime
if #jobs < 1 then
return