track_defs.lua 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. --== Insert track defs here! ==--
  2. -- Default tracks for advtrains
  3. -- (c) orwell96 and contributors
  4. --flat
  5. advtrains.register_tracks("default", {
  6. nodename_prefix="advtrains:dtrack",
  7. texture_prefix="advtrains_dtrack",
  8. models_prefix="advtrains_dtrack",
  9. models_suffix=".b3d",
  10. shared_texture="advtrains_dtrack_shared.png",
  11. description=attrans("Track"),
  12. formats={},
  13. }, advtrains.ap.t_30deg_flat)
  14. --slopes
  15. advtrains.register_tracks("default", {
  16. nodename_prefix="advtrains:dtrack",
  17. texture_prefix="advtrains_dtrack",
  18. models_prefix="advtrains_dtrack",
  19. models_suffix=".obj",
  20. shared_texture="advtrains_dtrack_shared.png",
  21. second_texture="default_gravel.png",
  22. description=attrans("Track"),
  23. formats={vst1={true, false, true}, vst2={true, false, true}, vst31={true}, vst32={true}, vst33={true}},
  24. }, advtrains.ap.t_30deg_slope)
  25. --bumpers
  26. advtrains.register_tracks("default", {
  27. nodename_prefix="advtrains:dtrack_bumper",
  28. texture_prefix="advtrains_dtrack_bumper",
  29. models_prefix="advtrains_dtrack_bumper",
  30. models_suffix=".b3d",
  31. shared_texture="advtrains_dtrack_rail.png",
  32. --bumpers still use the old texture until the models are redone.
  33. description=attrans("Bumper"),
  34. formats={},
  35. }, advtrains.ap.t_30deg_straightonly)
  36. -- atc track
  37. advtrains.register_tracks("default", {
  38. nodename_prefix="advtrains:dtrack_atc",
  39. texture_prefix="advtrains_dtrack_atc",
  40. models_prefix="advtrains_dtrack",
  41. models_suffix=".b3d",
  42. shared_texture="advtrains_dtrack_shared_atc.png",
  43. description=attrans("ATC controller"),
  44. formats={},
  45. get_additional_definiton = advtrains.atc_function
  46. }, advtrains.trackpresets.t_30deg_straightonly)
  47. advtrains.register_tracks("default", {
  48. nodename_prefix="advtrains:dtrack_unload",
  49. texture_prefix="advtrains_dtrack_unload",
  50. models_prefix="advtrains_dtrack",
  51. models_suffix=".b3d",
  52. shared_texture="advtrains_dtrack_shared_unload.png",
  53. description=attrans("Unloading Track"),
  54. formats={},
  55. get_additional_definiton = function(def, preset, suffix, rotation)
  56. return {
  57. after_dig_node=function(pos)
  58. advtrains.invalidate_all_paths()
  59. advtrains.ndb.clear(pos)
  60. end,
  61. advtrains = {
  62. on_train_enter = function(pos, train_id)
  63. train_load(pos, train_id, true)
  64. end,
  65. },
  66. }
  67. end
  68. }, advtrains.trackpresets.t_30deg_straightonly)
  69. advtrains.register_tracks("default", {
  70. nodename_prefix="advtrains:dtrack_load",
  71. texture_prefix="advtrains_dtrack_load",
  72. models_prefix="advtrains_dtrack",
  73. models_suffix=".b3d",
  74. shared_texture="advtrains_dtrack_shared_load.png",
  75. description=attrans("Loading Track"),
  76. formats={},
  77. get_additional_definiton = function(def, preset, suffix, rotation)
  78. return {
  79. after_dig_node=function(pos)
  80. advtrains.invalidate_all_paths()
  81. advtrains.ndb.clear(pos)
  82. end,
  83. advtrains = {
  84. on_train_enter = function(pos, train_id)
  85. train_load(pos, train_id, false)
  86. end,
  87. },
  88. }
  89. end
  90. }, advtrains.trackpresets.t_30deg_straightonly)
  91. advtrains.register_tracks("default", {
  92. nodename_prefix="advtrains:dtrack_detector_off",
  93. texture_prefix="advtrains_dtrack_detector",
  94. models_prefix="advtrains_dtrack",
  95. models_suffix=".b3d",
  96. shared_texture="advtrains_dtrack_shared_detector_off.png",
  97. description=attrans("Detector Rail"),
  98. formats={},
  99. get_additional_definiton = function(def, preset, suffix, rotation)
  100. return {
  101. mesecons = {
  102. receptor = {
  103. state = mesecon.state.off,
  104. rules = advtrains.meseconrules
  105. }
  106. },
  107. advtrains = {
  108. on_train_enter=function(pos, train_id)
  109. advtrains.ndb.swap_node(pos, {name="advtrains:dtrack_detector_on".."_"..suffix..rotation, param2=advtrains.ndb.get_node(pos).param2})
  110. mesecon.receptor_on(pos, advtrains.meseconrules)
  111. end
  112. }
  113. }
  114. end
  115. }, advtrains.ap.t_30deg_straightonly)
  116. advtrains.register_tracks("default", {
  117. nodename_prefix="advtrains:dtrack_detector_on",
  118. texture_prefix="advtrains_dtrack",
  119. models_prefix="advtrains_dtrack",
  120. models_suffix=".b3d",
  121. shared_texture="advtrains_dtrack_shared_detector_on.png",
  122. description="Detector(on)(you hacker you)",
  123. formats={},
  124. get_additional_definiton = function(def, preset, suffix, rotation)
  125. return {
  126. mesecons = {
  127. receptor = {
  128. state = mesecon.state.on,
  129. rules = advtrains.meseconrules
  130. }
  131. },
  132. advtrains = {
  133. on_train_leave=function(pos, train_id)
  134. advtrains.ndb.swap_node(pos, {name="advtrains:dtrack_detector_off".."_"..suffix..rotation, param2=advtrains.ndb.get_node(pos).param2})
  135. mesecon.receptor_off(pos, advtrains.meseconrules)
  136. end
  137. }
  138. }
  139. end
  140. }, advtrains.ap.t_30deg_straightonly_noplacer)
  141. --== END insert track defs ==--