diff options
author | orwell96 <mono96.mml@gmail.com> | 2016-11-10 22:58:27 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2016-11-10 22:58:27 +0100 |
commit | 06f0150b61e47b90af424992e47fdd3fb378a250 (patch) | |
tree | 3073caaa1fbc6cce6dad8fffd45ca7283722da6b | |
parent | 5bece1ecc14928626e3673c77fdc5920facb6fd3 (diff) | |
download | advtrains-06f0150b61e47b90af424992e47fdd3fb378a250.tar.gz advtrains-06f0150b61e47b90af424992e47fdd3fb378a250.tar.bz2 advtrains-06f0150b61e47b90af424992e47fdd3fb378a250.zip |
Add detector rails
-rw-r--r-- | advtrains.zip | bin | 1548122 -> 1577814 bytes | |||
-rw-r--r-- | atc.lua | 4 | ||||
-rw-r--r-- | depends.txt | 3 | ||||
-rw-r--r-- | init.lua | 3 | ||||
-rw-r--r-- | models/advtrains_dtrack_detector_st.b3d | bin | 0 -> 17157 bytes | |||
-rw-r--r-- | models/advtrains_dtrack_detector_st_30.b3d | bin | 0 -> 32779 bytes | |||
-rw-r--r-- | models/advtrains_dtrack_detector_st_45.b3d | bin | 0 -> 17163 bytes | |||
-rw-r--r-- | models/advtrains_dtrack_detector_st_60.b3d | bin | 0 -> 32779 bytes | |||
-rw-r--r-- | models/blender/gleis/rail_my_rt_final.blend | bin | 827052 -> 1094836 bytes | |||
-rw-r--r-- | models/blender/gleis/rail_my_rt_final.blend1 | bin | 843380 -> 827052 bytes | |||
-rw-r--r-- | textures/advtrains_dtrack_detector_placer.png | bin | 0 -> 1253 bytes | |||
-rw-r--r-- | textures/advtrains_dtrack_rail_detector_on.png | bin | 0 -> 2844 bytes | |||
-rw-r--r-- | tracks.lua | 111 |
13 files changed, 107 insertions, 14 deletions
diff --git a/advtrains.zip b/advtrains.zip Binary files differindex 0073d49..84727b9 100644 --- a/advtrains.zip +++ b/advtrains.zip @@ -0,0 +1,4 @@ +--atc.lua +--registers and controls the ATC system + +--(simple)mesecon detector rails diff --git a/depends.txt b/depends.txt index 331d858..20aa884 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ -default
\ No newline at end of file +default +mesecons?
\ No newline at end of file @@ -12,10 +12,13 @@ print = function(t) minetest.log("action", t) minetest.chat_send_all(t) end dofile(advtrains.modpath.."/helpers.lua"); dofile(advtrains.modpath.."/debugitems.lua"); +advtrains.meseconrules = mesecon.rules.pplate + dofile(advtrains.modpath.."/trainlogic.lua"); dofile(advtrains.modpath.."/trainhud.lua") dofile(advtrains.modpath.."/trackplacer.lua") dofile(advtrains.modpath.."/tracks.lua") +dofile(advtrains.modpath.."/atc.lua") dofile(advtrains.modpath.."/wagons.lua") dofile(advtrains.modpath.."/pseudoload.lua"); diff --git a/models/advtrains_dtrack_detector_st.b3d b/models/advtrains_dtrack_detector_st.b3d Binary files differnew file mode 100644 index 0000000..893c8cd --- /dev/null +++ b/models/advtrains_dtrack_detector_st.b3d diff --git a/models/advtrains_dtrack_detector_st_30.b3d b/models/advtrains_dtrack_detector_st_30.b3d Binary files differnew file mode 100644 index 0000000..2e59e93 --- /dev/null +++ b/models/advtrains_dtrack_detector_st_30.b3d diff --git a/models/advtrains_dtrack_detector_st_45.b3d b/models/advtrains_dtrack_detector_st_45.b3d Binary files differnew file mode 100644 index 0000000..c73166f --- /dev/null +++ b/models/advtrains_dtrack_detector_st_45.b3d diff --git a/models/advtrains_dtrack_detector_st_60.b3d b/models/advtrains_dtrack_detector_st_60.b3d Binary files differnew file mode 100644 index 0000000..b6bc9af --- /dev/null +++ b/models/advtrains_dtrack_detector_st_60.b3d diff --git a/models/blender/gleis/rail_my_rt_final.blend b/models/blender/gleis/rail_my_rt_final.blend Binary files differindex 1f346ae..6a9a088 100644 --- a/models/blender/gleis/rail_my_rt_final.blend +++ b/models/blender/gleis/rail_my_rt_final.blend diff --git a/models/blender/gleis/rail_my_rt_final.blend1 b/models/blender/gleis/rail_my_rt_final.blend1 Binary files differindex 12beed9..1f346ae 100644 --- a/models/blender/gleis/rail_my_rt_final.blend1 +++ b/models/blender/gleis/rail_my_rt_final.blend1 diff --git a/textures/advtrains_dtrack_detector_placer.png b/textures/advtrains_dtrack_detector_placer.png Binary files differnew file mode 100644 index 0000000..e6c6ad6 --- /dev/null +++ b/textures/advtrains_dtrack_detector_placer.png diff --git a/textures/advtrains_dtrack_rail_detector_on.png b/textures/advtrains_dtrack_rail_detector_on.png Binary files differnew file mode 100644 index 0000000..3ae0dac --- /dev/null +++ b/textures/advtrains_dtrack_rail_detector_on.png @@ -76,6 +76,7 @@ local t_30deg={ swrst="on",
swrcr="off",
},
+ regtp=true,
trackplacer={
st=true,
cr=true,
@@ -107,6 +108,31 @@ local t_30deg_straightonly={ },
switchmc={
},
+ regtp=true,
+ trackplacer={
+ },
+ tpsingle={
+ },
+ tpdefault="st",
+ trackworker={
+ ["st"]="st",
+ },
+ rotation={"", "_30", "_45", "_60"},
+ increativeinv={st},
+}
+local t_30deg_straightonly_noplacer={
+ regstep=1,
+ variant={
+ st=conns(0,8),
+ },
+ description={
+ st="straight",
+ },
+ switch={
+ },
+ switchmc={
+ },
+ regtp=false,
trackplacer={
},
tpsingle={
@@ -152,6 +178,7 @@ local t_45deg={ swrst="on",
swrcr="off",
},
+ regtp=true,
trackplacer={
st=true,
cr=true,
@@ -195,7 +222,8 @@ function advtrains.register_tracks(tracktype, def, preset) advtrains.reset_trackdb_position(pos)
end
return switchfunc, {effector = {
- ["action_"..mesecon_state] = switchfunc
+ ["action_"..mesecon_state] = switchfunc,
+ rules=advtrains.meseconrules
}}
end
local function make_overdef(suffix, rotation, conns, switchfunc, mesecontbl, in_creative_inv)
@@ -260,7 +288,9 @@ function advtrains.register_tracks(tracktype, def, preset) }, def.common or {})
--make trackplacer base def
advtrains.trackplacer.register_tracktype(def.nodename_prefix, preset.tpdefault)
- advtrains.trackplacer.register_track_placer(def.nodename_prefix, def.texture_prefix, def.description)
+ if preset.regtp then
+ advtrains.trackplacer.register_track_placer(def.nodename_prefix, def.texture_prefix, def.description)
+ end
for suffix, conns in pairs(preset.variant) do
for rotid, rotation in ipairs(preset.rotation) do
if not def.formats[suffix] or def.formats[suffix][rotid] then
@@ -268,22 +298,29 @@ function advtrains.register_tracks(tracktype, def, preset) if preset.switch[suffix] then
switchfunc, mesecontbl=make_switchfunc(preset.switch[suffix]..rotation, preset.switchmc[suffix])
end
-
+ local adef={}
+ if def.get_additional_definiton then
+ adef=def.get_additional_definiton(def, preset, suffix, rotation)
+ end
+
minetest.register_node(def.nodename_prefix.."_"..suffix..rotation, advtrains.merge_tables(
common_def,
make_overdef(
suffix, rotation,
cycle_conns(conns, rotid),
switchfunc, mesecontbl, preset.increativeinv[suffix]
- )
+ ),
+ adef
)
)
--trackplacer
- if preset.trackplacer[suffix] then
- advtrains.trackplacer.add_double_conn(def.nodename_prefix, suffix, rotation, cycle_conns(conns, rotid))
- end
- if preset.tpsingle[suffix] then
- advtrains.trackplacer.add_single_conn(def.nodename_prefix, suffix, rotation, cycle_conns(conns, rotid))
+ if preset.regtp then
+ if preset.trackplacer[suffix] then
+ advtrains.trackplacer.add_double_conn(def.nodename_prefix, suffix, rotation, cycle_conns(conns, rotid))
+ end
+ if preset.tpsingle[suffix] then
+ advtrains.trackplacer.add_single_conn(def.nodename_prefix, suffix, rotation, cycle_conns(conns, rotid))
+ end
end
advtrains.trackplacer.add_worked(def.nodename_prefix, suffix, rotation, preset.trackworker[suffix])
end
@@ -430,10 +467,58 @@ for _,rot in ipairs({"", "_30", "_45", "_60"}) do minetest.register_alias("advtrains:dtrack_bumper"..rot, "advtrains:dtrack_bumper_st"..rot)
end
-
-
-
-
+if mesecon then
+ advtrains.register_tracks("default", {
+ nodename_prefix="advtrains:dtrack_detector_off",
+ texture_prefix="advtrains_dtrack_detector",
+ models_prefix="advtrains_dtrack_detector",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_rail.png",
+ description="Detector Rail",
+ formats={},
+ get_additional_definiton = function(def, preset, suffix, rotation)
+ return {
+ mesecons = {
+ receptor = {
+ state = mesecon.state.off,
+ rules = advtrains.meseconrules
+ }
+ },
+ advtrains = {
+ on_train_enter=function(pos, train_id)
+ minetest.swap_node(pos, {name="advtrains:dtrack_detector_on".."_"..suffix..rotation})
+ mesecon.receptor_on(pos, advtrains.meseconrules)
+ end
+ }
+ }
+ end
+ }, t_30deg_straightonly)
+ advtrains.register_tracks("default", {
+ nodename_prefix="advtrains:dtrack_detector_on",
+ texture_prefix="advtrains_dtrack_detector",
+ models_prefix="advtrains_dtrack_detector",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_rail_detector_on.png",
+ description="Detector(on)(you hacker you)",
+ formats={},
+ get_additional_definiton = function(def, preset, suffix, rotation)
+ return {
+ mesecons = {
+ receptor = {
+ state = mesecon.state.on,
+ rules = advtrains.meseconrules
+ }
+ },
+ advtrains = {
+ on_train_leave=function(pos, train_id)
+ minetest.swap_node(pos, {name="advtrains:dtrack_detector_off".."_"..suffix..rotation})
+ mesecon.receptor_off(pos, advtrains.meseconrules)
+ end
+ }
+ }
+ end
+ }, t_30deg_straightonly_noplacer)
+end
--TODO legacy
--I know lbms are better for this purpose
for name,rep in pairs({swl_st="swlst", swr_st="swrst", swl_cr="swlcr", swr_cr="swrcr", }) do
|