diff options
-rw-r--r-- | advtrains/trainlogic.lua | 2 | ||||
-rw-r--r-- | advtrains_train_subway/init.lua | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index ea7ea60..381e1a0 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -783,7 +783,7 @@ function advtrains.collide_and_spawn_couple(id1, pos, id2, t1_is_backpos) return end - atprint("COLLISION: "..sid(id1).." and "..sid(id2).." at ",pos,", t1_is_backpos="..(t1_is_backpos and "true" or "false")) + atprint("COLLISION: ",sid(id1)," and ",sid(id2)," at ",pos,", t1_is_backpos=",(t1_is_backpos and "true" or "false")) --TODO: local train1=advtrains.trains[id1] diff --git a/advtrains_train_subway/init.lua b/advtrains_train_subway/init.lua index 5f48a3c..e3c73c9 100644 --- a/advtrains_train_subway/init.lua +++ b/advtrains_train_subway/init.lua @@ -104,10 +104,7 @@ minetest.register_craftitem(":advtrains:subway_train", { local node=minetest.get_node_or_nil(pointed_thing.under) if not node then atprint("[advtrains]Ignore at placer position") return itemstack end local nodename=node.name - if(not advtrains.is_track_and_drives_on(nodename, prototype.drives_on)) then - atprint("no track here, not placing.") - return itemstack - end + if not minetest.check_player_privs(placer, {train_place = true }) and minetest.is_protected(pointed_thing.under, placer:get_player_name()) then minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) return @@ -116,7 +113,7 @@ minetest.register_craftitem(":advtrains:subway_train", { local id=advtrains.create_new_train_at(pointed_thing.under, advtrains.dirCoordSet(pointed_thing.under, conn1)) for i=1,3 do - local ob=minetest.add_entity(pointed_thing.under, "advtrains:"..sysname) + local ob=minetest.add_entity(pointed_thing.under, "advtrains:subway_wagon") if not ob then atprint("couldn't add_entity, aborting") end @@ -128,7 +125,11 @@ minetest.register_craftitem(":advtrains:subway_train", { advtrains.add_wagon_to_train(le, id) end + minetest.after(1,function() + advtrains.trains[id].tarvelocity=2 advtrains.trains[id].velocity=2 + advtrains.trains[id].movedir=1 + end) if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end |