init.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. local S
  2. if minetest.get_modpath("intllib") then
  3. S = intllib.Getter()
  4. else
  5. S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
  6. end
  7. advtrains.register_wagon("engine_electronic", {
  8. mesh="advtrains_engine_electronic.b3d",
  9. textures = {"advtrains_engine_electronic.png"},
  10. drives_on={default=true},
  11. max_speed=15,
  12. seats = {
  13. {
  14. name=S("Driver Stand (front)"),
  15. attach_offset={x=0, y=6, z=8},
  16. view_offset={x=0, y=-3, z=0},
  17. driving_ctrl_access=true,
  18. group = "dstand",
  19. },
  20. {
  21. name=S("Driver Stand (back)"),
  22. attach_offset={x=0, y=-6, z=8},
  23. view_offset={x=0, y=-3, z=0},
  24. driving_ctrl_access=true,
  25. group = "dstand",
  26. },
  27. },
  28. seat_groups = {
  29. dstand={
  30. name = "Driver Stand",
  31. access_to = {},
  32. },
  33. },
  34. assign_to_seat_group = {"dstand"},
  35. wagon_span=2.1,
  36. visual_size = {x=1, y=1},
  37. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  38. is_locomotive=true,
  39. drops={"advtrains:engine_electronic"},
  40. horn_sound = "advtrains_engine_diesel_horn",
  41. custom_on_velocity_change = function(self, velocity, old_velocity, dtime)
  42. if not velocity or not old_velocity then return end
  43. if old_velocity == 0 and velocity > 0 then
  44. minetest.sound_play("advtrains_train_orient_express_engine_throttle", {object = self.object})
  45. end
  46. end
  47. }, S("electronic engine"), "advtrains_engine_electronic_inv.png")
  48. advtrains.register_wagon("wagon_compartment", {
  49. mesh="advtrains_wagon_compartment.b3d",
  50. textures = {"advtrains_compartment.png"},
  51. drives_on={default=true},
  52. max_speed=15,
  53. seats = {
  54. {
  55. name="1",
  56. attach_offset={x=2, y=6, z=8},
  57. view_offset={x=0, y=-4, z=0},
  58. group="pass",
  59. },
  60. {
  61. name="2",
  62. attach_offset={x=-1, y=6, z=8},
  63. view_offset={x=0, y=-4, z=0},
  64. group="pass",
  65. },
  66. {
  67. name="3",
  68. attach_offset={x=-4, y=8, z=-8},
  69. view_offset={x=0, y=0, z=0},
  70. group="pass",
  71. },
  72. {
  73. name="4",
  74. attach_offset={x=4, y=8, z=-8},
  75. view_offset={x=0, y=0, z=0},
  76. group="pass",
  77. },
  78. },
  79. seat_groups = {
  80. pass={
  81. name = "Passenger area",
  82. access_to = {},
  83. },
  84. },
  85. assign_to_seat_group = {"pass"},
  86. visual_size = {x=1, y=1},
  87. wagon_span=2.5,
  88. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  89. drops={"default:steelblock 4"},
  90. }, S("Passenger compartment Wagon"), "advtrains_compartment_inv.png")
  91. advtrains.register_wagon("wagon_compartment_restored", {
  92. mesh="advtrains_wagon_compartment.b3d",
  93. textures = {"advtrains_orient_express_restored.png"},
  94. drives_on={default=true},
  95. max_speed=15,
  96. seats = {
  97. {
  98. name="1",
  99. attach_offset={x=2, y=6, z=8},
  100. view_offset={x=0, y=-4, z=0},
  101. group="pass",
  102. },
  103. {
  104. name="2",
  105. attach_offset={x=-1, y=6, z=8},
  106. view_offset={x=0, y=-4, z=0},
  107. group="pass",
  108. },
  109. {
  110. name="3",
  111. attach_offset={x=-4, y=8, z=-8},
  112. view_offset={x=0, y=0, z=0},
  113. group="pass",
  114. },
  115. {
  116. name="4",
  117. attach_offset={x=4, y=8, z=-8},
  118. view_offset={x=0, y=0, z=0},
  119. group="pass",
  120. },
  121. },
  122. seat_groups = {
  123. pass={
  124. name = "Passenger area",
  125. access_to = {},
  126. },
  127. },
  128. assign_to_seat_group = {"pass"},
  129. visual_size = {x=1, y=1},
  130. wagon_span=2.5,
  131. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  132. drops={"default:steelblock 4"},
  133. }, S("Passenger Restored Wagon"), "advtrains_orient_express_restored_inv.png")
  134. advtrains.register_wagon("wagon_sleep", {
  135. mesh="advtrains_wagon_sleep.b3d",
  136. textures = {"advtrains_sleep.png"},
  137. drives_on={default=true},
  138. max_speed=15,
  139. seats = {
  140. {
  141. name="1",
  142. attach_offset={x=2, y=6, z=8},
  143. view_offset={x=0, y=-2, z=0},
  144. group="pass",
  145. },
  146. {
  147. name="2",
  148. attach_offset={x=-1, y=6, z=8},
  149. view_offset={x=0, y=-4, z=0},
  150. group="pass",
  151. },
  152. {
  153. name="3",
  154. attach_offset={x=-4, y=8, z=-8},
  155. view_offset={x=0, y=0, z=0},
  156. group="pass",
  157. },
  158. {
  159. name="4",
  160. attach_offset={x=4, y=8, z=-8},
  161. view_offset={x=0, y=0, z=0},
  162. group="pass",
  163. },
  164. },
  165. seat_groups = {
  166. pass={
  167. name = "Passenger area",
  168. access_to = {},
  169. },
  170. },
  171. assign_to_seat_group = {"pass"},
  172. visual_size = {x=1, y=1},
  173. wagon_span=2.5,
  174. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  175. drops={"default:steelblock 4"},
  176. }, S("Passenger sleeping Wagon"), "advtrains_sleep_inv.png")