aboutsummaryrefslogtreecommitdiff
path: root/advtrains_line_automation
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-12-18 10:01:47 +0100
committerorwell96 <orwell@bleipb.de>2019-12-18 10:01:47 +0100
commit50a81dd1f312cf427944812f0e599b54e11b1a61 (patch)
treec4484ea360674bd0f31f9f473bc426b446f18181 /advtrains_line_automation
parentd123679b3c6e44a002ea2fb9e32daa1aa1b0663d (diff)
downloadadvtrains-50a81dd1f312cf427944812f0e599b54e11b1a61.tar.gz
advtrains-50a81dd1f312cf427944812f0e599b54e11b1a61.tar.bz2
advtrains-50a81dd1f312cf427944812f0e599b54e11b1a61.zip
Fix RWT initialization when creating new world (H#142)
Diffstat (limited to 'advtrains_line_automation')
-rw-r--r--advtrains_line_automation/railwaytime.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/advtrains_line_automation/railwaytime.lua b/advtrains_line_automation/railwaytime.lua
index 3a044b6..258009e 100644
--- a/advtrains_line_automation/railwaytime.lua
+++ b/advtrains_line_automation/railwaytime.lua
@@ -39,6 +39,7 @@ local rwt = {}
--Time Stamp (Seconds since start of world)
local e_time = 0
+local e_has_loaded = false
local setting_rwt_real = minetest.settings:get("advtrains_lines_rwt_realtime")
if setting_rwt_real=="" then
@@ -71,6 +72,8 @@ function rwt.set_time(t)
end
atlog("[lines][rwt] Initialized railway time: ",rwt.to_string(e_time))
e_last_epoch = os.time()
+
+ e_has_loaded = true
end
function rwt.get_time()
@@ -78,6 +81,10 @@ function rwt.get_time()
end
function rwt.step(dt)
+ if not e_has_loaded then
+ rwt.set_time(0)
+ end
+
if setting_rwt_real=="independent" then
-- Regular stepping with dtime
e_time = e_time + dt