aboutsummaryrefslogtreecommitdiff
path: root/advtrains/tracks.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-12-22 18:55:10 +0100
committerorwell96 <mono96.mml@gmail.com>2016-12-22 18:55:10 +0100
commitd08e202346192c50072450a3eaa3b28cad852b84 (patch)
treefcb449a63df2c21178fba742d2121cb98c0ff6ab /advtrains/tracks.lua
parentf806ed9eee8c13eb0b4868641311d25257c63f46 (diff)
downloadadvtrains-d08e202346192c50072450a3eaa3b28cad852b84.tar.gz
advtrains-d08e202346192c50072450a3eaa3b28cad852b84.tar.bz2
advtrains-d08e202346192c50072450a3eaa3b28cad852b84.zip
remove train type concept and calculate train's capabilities based on used wagons
Diffstat (limited to 'advtrains/tracks.lua')
-rw-r--r--advtrains/tracks.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/advtrains/tracks.lua b/advtrains/tracks.lua
index 99dbb27..8bd5666 100644
--- a/advtrains/tracks.lua
+++ b/advtrains/tracks.lua
@@ -346,17 +346,17 @@ function advtrains.register_tracks(tracktype, def, preset)
end
end
end
- table.insert(advtrains.all_tracktypes, tracktype)
+ advtrains.all_tracktypes[tracktype]=true
end
-function advtrains.is_track_and_drives_on(nodename, drives_on)
+function advtrains.is_track_and_drives_on(nodename, drives_on_p)
if not minetest.registered_nodes[nodename] then
return false
end
local nodedef=minetest.registered_nodes[nodename]
- for k,v in ipairs(drives_on) do
- if nodedef.groups["advtrains_track_"..v] then
+ for k,v in pairs(drives_on_p) do
+ if nodedef.groups["advtrains_track_"..k] then
return true
end
end