aboutsummaryrefslogtreecommitdiff
path: root/advtrains/init.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-05-17 12:30:30 +0200
committerorwell96 <orwell@bleipb.de>2018-06-14 17:39:42 +0200
commit5dca1553333b8267de72ebf8788afbb928251ebf (patch)
tree3ba70019b0a79acf0a24c95fda6c99a5d6a2a107 /advtrains/init.lua
parentb420a719398fa0e342d5ee8547464179664ae6b9 (diff)
downloadadvtrains-5dca1553333b8267de72ebf8788afbb928251ebf.tar.gz
advtrains-5dca1553333b8267de72ebf8788afbb928251ebf.tar.bz2
advtrains-5dca1553333b8267de72ebf8788afbb928251ebf.zip
Implement collisions. (does not work yet, still code errors)
Diffstat (limited to 'advtrains/init.lua')
-rw-r--r--advtrains/init.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua
index 93b25e5..21af66d 100644
--- a/advtrains/init.lua
+++ b/advtrains/init.lua
@@ -105,6 +105,7 @@ atwarn=function(t, ...)
end
sid=function(id) if id then return string.sub(id, -6) end end
+
--ONLY use this function for temporary debugging. for consistent debug prints use atprint
atdebug=function(t, ...)
local text=advtrains.print_concat_table({t, ...})
@@ -124,6 +125,12 @@ if minetest.settings:get_bool("advtrains_enable_debugging") then
dofile(advtrains.modpath.."/debugringbuffer.lua")
end
+function assertt(var, typ)
+ if type(var)~=typ then
+ error("Assertion failed, variable has to be of type "..typ)
+ end
+end
+
dofile(advtrains.modpath.."/helpers.lua");
--dofile(advtrains.modpath.."/debugitems.lua");
@@ -196,6 +203,7 @@ function advtrains.avt_load()
--remove wagon_save entries that are not part of a train
local todel=advtrains.merge_tables(advtrains.wagon_save)
for tid, train in pairs(advtrains.trains) do
+ train.id = tid
for _, wid in ipairs(train.trainparts) do
todel[wid]=nil
end