init.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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("NY_lokomotive", {
  8. mesh="advtrains_engine_ny.b3d",
  9. textures = {"advtrains_engine_ny.png"},
  10. is_locomotive=true,
  11. drives_on={default=true},
  12. max_speed=10,
  13. seats = {
  14. {
  15. name=S("Driver Stand (left)"),
  16. attach_offset={x=-1, y=5, z=2},
  17. view_offset={x=0, y=-4, z=2},
  18. driving_ctrl_access=true,
  19. group = "dstand",
  20. },
  21. {
  22. name="1",
  23. attach_offset={x=-4, y=8, z=0},
  24. view_offset={x=0, y=-4, z=0},
  25. group="pass",
  26. },
  27. {
  28. name="2",
  29. attach_offset={x=4, y=8, z=0},
  30. view_offset={x=0, y=-4, z=0},
  31. group="pass",
  32. },
  33. {
  34. name="3",
  35. attach_offset={x=-4, y=8, z=-8},
  36. view_offset={x=0, y=-4, z=0},
  37. group="pass",
  38. },
  39. {
  40. name="4",
  41. attach_offset={x=4, y=8, z=-8},
  42. view_offset={x=0, y=-4, z=0},
  43. group="pass",
  44. },
  45. },
  46. seat_groups = {
  47. dstand={
  48. name = "Driver Stand",
  49. access_to = {"pass"},
  50. require_doors_open=true,
  51. },
  52. pass={
  53. name = "Passenger area",
  54. access_to = {"dstand"},
  55. require_doors_open=true,
  56. },
  57. },
  58. assign_to_seat_group = {"dstand", "pass"},
  59. doors={
  60. open={
  61. [-1]={frames={x=0, y=20}, time=1},
  62. [1]={frames={x=40, y=60}, time=1}
  63. },
  64. close={
  65. [-1]={frames={x=20, y=40}, time=1},
  66. [1]={frames={x=60, y=80}, time=1}
  67. }
  68. },
  69. visual_size = {x=1, y=1},
  70. wagon_span=4,
  71. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  72. update_animation=function(self, velocity)
  73. if self.old_anim_velocity~=advtrains.abs_ceil(velocity) then
  74. self.object:set_animation({x=1,y=80}, advtrains.abs_ceil(velocity)*15, 0, true)
  75. self.old_anim_velocity=advtrains.abs_ceil(velocity)
  76. end
  77. end,
  78. drops={"advtrains:engine_ny"},
  79. }, S("NY subway Engine"), "advtrains_engine_ny_inv.png")
  80. advtrains.register_wagon("ny_wagon", {
  81. mesh="advtrains_wagon_ny.b3d",
  82. textures = {"advtrains_engine_ny.png"},
  83. drives_on={default=true},
  84. max_speed=20,
  85. seats = {
  86. {
  87. name="1",
  88. attach_offset={x=-4, y=8, z=8},
  89. view_offset={x=0, y=-4, z=0},
  90. group="pass",
  91. },
  92. {
  93. name="2",
  94. attach_offset={x=4, y=8, z=8},
  95. view_offset={x=0, y=-4, z=0},
  96. group="pass",
  97. },
  98. {
  99. name="1a",
  100. attach_offset={x=-4, y=8, z=0},
  101. view_offset={x=0, y=-4, z=0},
  102. group="pass",
  103. },
  104. {
  105. name="2a",
  106. attach_offset={x=4, y=8, z=0},
  107. view_offset={x=0, y=-4, z=0},
  108. group="pass",
  109. },
  110. {
  111. name="3",
  112. attach_offset={x=-4, y=8, z=-8},
  113. view_offset={x=0, y=-4, z=0},
  114. group="pass",
  115. },
  116. {
  117. name="4",
  118. attach_offset={x=4, y=8, z=-8},
  119. view_offset={x=0, y=-4, z=0},
  120. group="pass",
  121. },
  122. },
  123. seat_groups = {
  124. pass={
  125. name = "Passenger area",
  126. access_to = {},
  127. require_doors_open=true,
  128. },
  129. },
  130. assign_to_seat_group = {"pass"},
  131. doors={
  132. open={
  133. [-1]={frames={x=0, y=20}, time=1},
  134. [1]={frames={x=40, y=60}, time=1}
  135. },
  136. close={
  137. [-1]={frames={x=20, y=40}, time=1},
  138. [1]={frames={x=60, y=80}, time=1}
  139. }
  140. },
  141. door_entry={-1, 1},
  142. visual_size = {x=1, y=1},
  143. wagon_span=2.3,
  144. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  145. drops={"advtrains_wagon_ny"},
  146. }, S("NY subway wagon"), "advtrains_wagon_ny_inv.png")