aboutsummaryrefslogtreecommitdiff
path: root/tracks.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-12-22 12:02:44 +0100
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-12-22 12:02:44 +0100
commit633d514f5b63d28d80a5c0981ee3e99b61899c41 (patch)
tree8de10d387ef66438c4f7252912386e81fd3f8baa /tracks.lua
parent2f799655facc799b8073355ece91f3c82f223b63 (diff)
downloadadvtrains-633d514f5b63d28d80a5c0981ee3e99b61899c41.tar.gz
advtrains-633d514f5b63d28d80a5c0981ee3e99b61899c41.tar.bz2
advtrains-633d514f5b63d28d80a5c0981ee3e99b61899c41.zip
Added stop and reverse rail
Diffstat (limited to 'tracks.lua')
-rw-r--r--tracks.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tracks.lua b/tracks.lua
index 99dbb27..0b7d125 100644
--- a/tracks.lua
+++ b/tracks.lua
@@ -584,6 +584,30 @@ for _,rot in ipairs({"", "_30", "_45", "_60"}) do
minetest.register_alias("advtrains:dtrack_bumper"..rot, "advtrains:dtrack_bumper_st"..rot)
end
+advtrains.register_tracks("default", {
+ nodename_prefix="advtrains:dtrack_stop",
+ texture_prefix="advtrains_dtrack_stop",
+ models_prefix="advtrains_dtrack",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_rail_stop.png",
+ description="Stop and reverse rail",
+ formats={},
+ get_additional_definiton = function(def, preset, suffix, rotation)
+ return {
+ advtrains = {
+ on_train_enter=function(pos, train_id)
+ local train = advtrains.trains[train_id];
+ local endsp = train.tarvelocity;
+ train.tarvelocity = 0;
+ train.velocity = 0;
+ minetest.after(10,function(t,sp) train.movedir = -train.movedir; t.tarvelocity=sp; end, train, endsp);
+ end
+ }
+ }
+ end
+}, t_30deg_straightonly)
+
+
if mesecon then
advtrains.register_tracks("default", {
nodename_prefix="advtrains:dtrack_detector_off",