aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--advtrains/crafting.lua36
-rw-r--r--advtrains/wagons.lua6
-rw-r--r--advtrains_interlocking/depends.txt3
-rw-r--r--advtrains_interlocking/tsr_rail.lua23
-rw-r--r--advtrains_line_automation/depends.txt2
-rw-r--r--advtrains_line_automation/stoprail.lua23
-rw-r--r--advtrains_luaautomation/active_common.lua7
-rw-r--r--advtrains_luaautomation/atc_rail.lua71
-rw-r--r--advtrains_train_track/init.lua53
9 files changed, 123 insertions, 101 deletions
diff --git a/advtrains/crafting.lua b/advtrains/crafting.lua
index d7e7343..cb0813c 100644
--- a/advtrains/crafting.lua
+++ b/advtrains/crafting.lua
@@ -2,41 +2,7 @@
--crafting.lua
--registers crafting recipes
---tracks
-minetest.register_craft({
- output = 'advtrains:dtrack_placer 50',
- recipe = {
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- },
-})
-minetest.register_craft({
- type = "shapeless",
- output = 'advtrains:dtrack_slopeplacer 2',
- recipe = {
- "advtrains:dtrack_placer",
- "advtrains:dtrack_placer",
- "default:gravel",
- },
-})
-
-minetest.register_craft({
- output = 'advtrains:dtrack_bumper_placer 2',
- recipe = {
- {'group:wood', 'dye:red'},
- {'default:steel_ingot', 'default:steel_ingot'},
- {'advtrains:dtrack_placer', 'advtrains:dtrack_placer'},
- },
-})
-minetest.register_craft({
- type="shapeless",
- output = 'advtrains:dtrack_detector_off_placer',
- recipe = {
- "advtrains:dtrack_placer",
- "mesecons:wire_00000000_off"
- },
-})
+--tracks: see advtrains_train_track
--signals
minetest.register_craft({
output = 'advtrains:retrosignal_off 2',
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 28a471a..ba746ef 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -486,10 +486,10 @@ function wagon:on_step(dtime)
-- unload entity if out of range (because relevant pr won't be merged in engine)
-- This is a WORKAROUND!
- local outofrange = false
+ local outofrange = true
for _,p in pairs(minetest.get_connected_players()) do
- if vector.distance(p:get_pos(),pos)>=unload_wgn_range then
- outofrange = true
+ if vector.distance(p:get_pos(),pos)<=unload_wgn_range then
+ outofrange = false
end
end
if outofrange then
diff --git a/advtrains_interlocking/depends.txt b/advtrains_interlocking/depends.txt
index 6f00bf6..fdf6b17 100644
--- a/advtrains_interlocking/depends.txt
+++ b/advtrains_interlocking/depends.txt
@@ -1 +1,2 @@
-advtrains \ No newline at end of file
+advtrains
+advtrains_train_track? \ No newline at end of file
diff --git a/advtrains_interlocking/tsr_rail.lua b/advtrains_interlocking/tsr_rail.lua
index 89da290..a500c8f 100644
--- a/advtrains_interlocking/tsr_rail.lua
+++ b/advtrains_interlocking/tsr_rail.lua
@@ -42,14 +42,15 @@ local adefunc = function(def, preset, suffix, rotation)
end
-
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains_interlocking:dtrack_npr",
- texture_prefix="advtrains_dtrack_npr",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_npr.png",
- description="Point Speed Restriction Rail",
- formats={},
- get_additional_definiton = adefunc,
-}, advtrains.trackpresets.t_30deg_straightonly)
+if minetest.get_modpath("advtrains_train_track") ~= nil then
+ advtrains.register_tracks("default", {
+ nodename_prefix="advtrains_interlocking:dtrack_npr",
+ texture_prefix="advtrains_dtrack_npr",
+ models_prefix="advtrains_dtrack",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_shared_npr.png",
+ description="Point Speed Restriction Rail",
+ formats={},
+ get_additional_definiton = adefunc,
+ }, advtrains.trackpresets.t_30deg_straightonly)
+end \ No newline at end of file
diff --git a/advtrains_line_automation/depends.txt b/advtrains_line_automation/depends.txt
index 53500ee..ce2e23c 100644
--- a/advtrains_line_automation/depends.txt
+++ b/advtrains_line_automation/depends.txt
@@ -1,2 +1,2 @@
advtrains_interlocking
-advtrains_train_track \ No newline at end of file
+advtrains_train_track? \ No newline at end of file
diff --git a/advtrains_line_automation/stoprail.lua b/advtrains_line_automation/stoprail.lua
index 0990876..ee8faac 100644
--- a/advtrains_line_automation/stoprail.lua
+++ b/advtrains_line_automation/stoprail.lua
@@ -204,14 +204,15 @@ local adefunc = function(def, preset, suffix, rotation)
}
end
-
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains_line_automation:dtrack_stop",
- texture_prefix="advtrains_dtrack_stop",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_stop.png",
- description="Station/Stop Rail",
- formats={},
- get_additional_definiton = adefunc,
-}, advtrains.trackpresets.t_30deg_straightonly)
+if minetest.get_modpath("advtrains_train_track") ~= nil then
+ advtrains.register_tracks("default", {
+ nodename_prefix="advtrains_line_automation:dtrack_stop",
+ texture_prefix="advtrains_dtrack_stop",
+ models_prefix="advtrains_dtrack",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_shared_stop.png",
+ description="Station/Stop Rail",
+ formats={},
+ get_additional_definiton = adefunc,
+ }, advtrains.trackpresets.t_30deg_straightonly)
+end \ No newline at end of file
diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua
index 48f75ac..dac81b3 100644
--- a/advtrains_luaautomation/active_common.lua
+++ b/advtrains_luaautomation/active_common.lua
@@ -165,4 +165,11 @@ if advtrains.lines and advtrains.lines.sched then
end)
end
+ac.trackdef_advtrains_defs = {
+ on_train_enter = function(pos, train_id)
+ --do async. Event is fired in train steps
+ atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id})
+ end,
+}
+
atlatc.active=ac
diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua
index ce9e0fa..0b9c911 100644
--- a/advtrains_luaautomation/atc_rail.lua
+++ b/advtrains_luaautomation/atc_rail.lua
@@ -131,46 +131,39 @@ function r.fire_event(pos, evtdata)
end
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains_luaautomation:dtrack",
- texture_prefix="advtrains_dtrack_atc",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_atc.png",
- description=atltrans("LuaAutomation ATC Rail"),
- formats={},
- get_additional_definiton = function(def, preset, suffix, rotation)
- return {
- after_place_node = atlatc.active.after_place_node,
- after_dig_node = atlatc.active.after_dig_node,
-
- on_receive_fields = function(pos, ...)
- atlatc.active.on_receive_fields(pos, ...)
-
- --set arrowconn (for ATC)
- local ph=minetest.pos_to_string(pos)
- local _, conns=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes)
- atlatc.active.nodes[ph].arrowconn=conns[1].c
- end,
-
- advtrains = {
- on_train_enter = function(pos, train_id)
- --do async. Event is fired in train steps
- atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id})
+if minetest.get_modpath("advtrains_train_track") ~= nil then
+ advtrains.register_tracks("default", {
+ nodename_prefix="advtrains_luaautomation:dtrack",
+ texture_prefix="advtrains_dtrack_atc",
+ models_prefix="advtrains_dtrack",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_shared_atc.png",
+ description=atltrans("LuaAutomation ATC Rail"),
+ formats={},
+ get_additional_definiton = function(def, preset, suffix, rotation)
+ return {
+ after_place_node = atlatc.active.after_place_node,
+ after_dig_node = atlatc.active.after_dig_node,
+ on_receive_fields = function(pos, ...)
+ atlatc.active.on_receive_fields(pos, ...)
+ --set arrowconn (for ATC)
+ local ph=minetest.pos_to_string(pos)
+ local _, conns=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes)
+ atlatc.active.nodes[ph].arrowconn=conns[1].c
end,
- },
- luaautomation = {
- fire_event=r.fire_event
- },
- digiline = {
- receptor = {},
- effector = {
- action = atlatc.active.on_digiline_receive
+ advtrains = atlatc.active.trackdef_advtrains_defs,
+ luaautomation = {
+ fire_event=r.fire_event
},
- },
- }
- end,
-}, advtrains.trackpresets.t_30deg_straightonly)
-
+ digiline = {
+ receptor = {},
+ effector = {
+ action = atlatc.active.on_digiline_receive
+ },
+ },
+ }
+ end,
+ }, advtrains.trackpresets.t_30deg_straightonly)
+end
atlatc.rail = r
diff --git a/advtrains_train_track/init.lua b/advtrains_train_track/init.lua
index b646ed7..a14335f 100644
--- a/advtrains_train_track/init.lua
+++ b/advtrains_train_track/init.lua
@@ -12,6 +12,15 @@ advtrains.register_tracks("default", {
formats={},
}, advtrains.ap.t_30deg_flat)
+minetest.register_craft({
+ output = 'advtrains:dtrack_placer 50',
+ recipe = {
+ {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
+ {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
+ {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
+ },
+})
+
-- Diamond Crossings
-- perpendicular
advtrains.register_tracks("default", {
@@ -23,6 +32,15 @@ advtrains.register_tracks("default", {
description=attrans("Perpendicular Diamond Crossing Track"),
formats = {}
}, advtrains.ap.t_perpcrossing)
+
+minetest.register_craft({
+ output = 'advtrains:dtrack_xing_placer 3',
+ recipe = {
+ {'', 'advtrains:dtrack_placer', ''},
+ {'advtrains:dtrack_placer', 'advtrains:dtrack_placer', 'advtrains:dtrack_placer'},
+ {'', 'advtrains:dtrack_placer', ''}
+ }
+})
-- 45-90(
advtrains.register_tracks("default", {
nodename_prefix="advtrains:dtrack_xing4590",
@@ -33,6 +51,14 @@ advtrains.register_tracks("default", {
description=attrans("45/90 Degree Diamond Crossing Track"),
formats = {}
}, advtrains.ap.t_9045crossing)
+minetest.register_craft({
+ output = 'advtrains:dtrack_xing4590_placer 2',
+ recipe = {
+ {'advtrains:dtrack_placer', '', ''},
+ {'advtrains:dtrack_placer', 'advtrains:dtrack_placer', 'advtrains:dtrack_placer'},
+ {'', '', 'advtrains:dtrack_placer'}
+ }
+})
--slopes
advtrains.register_tracks("default", {
@@ -46,6 +72,17 @@ advtrains.register_tracks("default", {
formats={vst1={true, false, true}, vst2={true, false, true}, vst31={true}, vst32={true}, vst33={true}},
}, advtrains.ap.t_30deg_slope)
+minetest.register_craft({
+ type = "shapeless",
+ output = 'advtrains:dtrack_slopeplacer 2',
+ recipe = {
+ "advtrains:dtrack_placer",
+ "advtrains:dtrack_placer",
+ "default:gravel",
+ },
+})
+
+
--bumpers
advtrains.register_tracks("default", {
nodename_prefix="advtrains:dtrack_bumper",
@@ -57,6 +94,14 @@ advtrains.register_tracks("default", {
description=attrans("Bumper"),
formats={},
}, advtrains.ap.t_30deg_straightonly)
+minetest.register_craft({
+ output = 'advtrains:dtrack_bumper_placer 2',
+ recipe = {
+ {'group:wood', 'dye:red'},
+ {'default:steel_ingot', 'default:steel_ingot'},
+ {'advtrains:dtrack_placer', 'advtrains:dtrack_placer'},
+ },
+})
--legacy bumpers
for _,rot in ipairs({"", "_30", "_45", "_60"}) do
minetest.register_alias("advtrains:dtrack_bumper"..rot, "advtrains:dtrack_bumper_st"..rot)
@@ -221,6 +266,14 @@ if mesecon then
}
end
}, advtrains.ap.t_30deg_straightonly_noplacer)
+ minetest.register_craft({
+ type="shapeless",
+ output = 'advtrains:dtrack_detector_off_placer',
+ recipe = {
+ "advtrains:dtrack_placer",
+ "mesecons:wire_00000000_off"
+ },
+})
end
--TODO legacy
--I know lbms are better for this purpose