aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/tracks.lua10
-rw-r--r--advtrains/trainlogic.lua4
2 files changed, 12 insertions, 2 deletions
diff --git a/advtrains/tracks.lua b/advtrains/tracks.lua
index bfa95fe..1cbbc0b 100644
--- a/advtrains/tracks.lua
+++ b/advtrains/tracks.lua
@@ -408,11 +408,19 @@ end
function advtrains.is_track_and_drives_on(nodename, drives_on_p)
+ local drives_on = drives_on_p
+ if not drives_on then drives_on = advtrains.all_tracktypes end
+ local hasentry = false
+ for _,_ in pairs(drives_on) do
+ hasentry=true
+ end
+ if not hasentry then drives_on = advtrains.all_tracktypes end
+
if not minetest.registered_nodes[nodename] then
return false
end
local nodedef=minetest.registered_nodes[nodename]
- for k,v in pairs(drives_on_p) do
+ for k,v in pairs(drives_on) do
if nodedef.groups["advtrains_track_"..k] then
return true
end
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index c158ebe..cd5017b 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -576,6 +576,7 @@ function advtrains.train_step_b(id, train, dtime)
end
--- 8b damage players ---
if not minetest.settings:get_bool("creative_mode") then
+ local testpts = minetest.pos_to_string(testpos)
local player=advtrains.playersbypts[testpts]
if player and not minetest.check_player_privs(player, "creative") and train.velocity>3 then
--instantly kill player
@@ -644,7 +645,8 @@ function advtrains.add_wagon_to_train(wagon, train_id, index)
end
function advtrains.update_trainpart_properties(train_id, invert_flipstate)
local train=advtrains.trains[train_id]
- train.drives_on=advtrains.all_tracktypes
+ train.drives_on=advtrains.merge_tables(advtrains.all_tracktypes)
+ --FIX: deep-copy the table!!!
train.max_speed=20
local rel_pos=0
local count_l=0