init.lua 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  1. local mod_name = "classic_coaches"
  2. local S = minetest.get_translator(mod_name)
  3. local use_advtrains_livery_designer = minetest.get_modpath( "advtrains_livery_designer" ) and advtrains_livery_designer
  4. ----------------------------------------------------------------------------------------
  5. local function get_materials_minetest_game()
  6. return {
  7. base_game = "Minetest Game",
  8. door_steel = minetest.get_modpath("doors") and "doors:trapdoor_steel" or "default:steel_ingot",
  9. dye_grey = "dye:grey",
  10. glass = "default:glass",
  11. goldblock = "default:goldblock",
  12. steel_ingot = "default:steel_ingot",
  13. steelblock = "default:steelblock",
  14. wheel = "advtrains:wheel",
  15. wool_blue = minetest.get_modpath("wool") and "wool:blue" or "dye:blue",
  16. wool_cyan = minetest.get_modpath("wool") and "wool:cyan" or "dye:cyan",
  17. }
  18. end
  19. local function get_materials_mineclonia()
  20. return {
  21. base_game = "Mineclonia",
  22. door_steel = minetest.get_modpath("mcl_doors") and "mcl_doors:iron_door" or "mcl_core:iron_ingot",
  23. dye_grey = "mcl_dyes:grey",
  24. glass = "mcl_core:glass",
  25. goldblock = "mcl_core:goldblock",
  26. steel_ingot = "mcl_core:iron_ingot",
  27. steelblock = "mcl_core:ironblock",
  28. wheel = "advtrains:wheel",
  29. wool_blue = minetest.get_modpath("mcl_wool") and "mcl_wool:blue" or "mcl_dyes:blue",
  30. wool_cyan = minetest.get_modpath("mcl_wool") and "mcl_wool:cyan" or "mcl_dyes:cyan",
  31. }
  32. end
  33. local function get_materials_voxelibre()
  34. return {
  35. base_game = "VoxeLibre/MineClone2",
  36. door_steel = minetest.get_modpath("mcl_doors") and "mcl_doors:iron_door" or "mcl_core:iron_ingot",
  37. dye_grey = "mcl_dye:grey",
  38. glass = "mcl_core:glass",
  39. goldblock = "mcl_core:goldblock",
  40. steel_ingot = "mcl_core:iron_ingot",
  41. steelblock = "mcl_core:ironblock",
  42. wheel = "advtrains:wheel",
  43. wool_blue = minetest.get_modpath("mcl_wool") and "mcl_wool:blue" or "mcl_dye:blue",
  44. wool_cyan = minetest.get_modpath("mcl_wool") and "mcl_wool:cyan" or "mcl_dye:cyan",
  45. }
  46. end
  47. local function get_materials_farlands_reloaded()
  48. return {
  49. base_game = "Farlands Reloaded",
  50. door_steel = minetest.get_modpath("fl_doors") and "fl_doors:steel_door_a" or "fl_ores:iron_ingot",
  51. dye_grey = "fl_dyes:grey_dye",
  52. glass = "fl_glass:framed_glass",
  53. goldblock = "fl_ores:gold_block",
  54. steel_ingot = "fl_ores:iron_ingot",
  55. steelblock = "fl_ores:iron_block",
  56. wheel = "advtrains:wheel",
  57. wool_blue = "fl_dyes:blue_dye", -- farlands handles wool color via param 2 so use dye instead.
  58. wool_cyan = "fl_dyes:cyan_dye", -- farlands handles wool color via param 2 so use dye instead.
  59. }
  60. end
  61. local function get_materials_hades_revisited()
  62. return {
  63. base_game = "Hades Revisited",
  64. door_steel = minetest.get_modpath("hades_doors") and "hades_doors:door_steel_a" or "hades_core:steel_ingot",
  65. dye_grey = "hades_dye:grey",
  66. glass = "hades_core:glass",
  67. goldblock = "hades_core:goldblock",
  68. steel_ingot = "hades_core:steel_ingot",
  69. steelblock = "hades_core:steelblock",
  70. wheel = "advtrains:wheel",
  71. wool_blue = minetest.get_modpath("hades_cloth") and "hades_cloth:blue" or "hades_dye:blue",
  72. wool_cyan = minetest.get_modpath("hades_cloth") and "hades_cloth:cyan" or "hades_dye:cyan",
  73. }
  74. end
  75. local function get_materials()
  76. if minetest.get_modpath("default") and minetest.get_modpath("dye") then
  77. return get_materials_minetest_game()
  78. end
  79. if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_dyes") then
  80. return get_materials_mineclonia()
  81. end
  82. if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_dye") then
  83. return get_materials_voxelibre()
  84. end
  85. if minetest.get_modpath("fl_dyes") and minetest.get_modpath("fl_glass") and minetest.get_modpath("fl_ores") then
  86. return get_materials_farlands_reloaded()
  87. end
  88. if minetest.get_modpath("hades_core") and minetest.get_modpath("hades_dye") then
  89. return get_materials_hades_revisited()
  90. end
  91. local unknown_material = "classic_coaches:unknown_material"
  92. return {
  93. door_steel = unknown_material,
  94. dye_grey = unknown_material,
  95. glass = unknown_material,
  96. goldblock = unknown_material,
  97. steel_ingot = unknown_material,
  98. steelblock = unknown_material,
  99. wheel = unknown_material,
  100. wool_blue = unknown_material,
  101. wool_cyan = unknown_material,
  102. }
  103. end
  104. local materials = get_materials()
  105. ----------------------------------------------------------------------------------------
  106. local default_roof_alpha = 230
  107. local default_seat_alpha = 245
  108. local default_wall_alpha = 253
  109. local wagons = {
  110. {
  111. wagon_type = "classic_coaches:corridor_coach_class1",
  112. mesh = "classic_coaches_corridor_coach_class1.b3d",
  113. textures = {"classic_coaches_corridor_coach_class1_001.png"},
  114. name = S("Intercity Corridor Coach Class 1"),
  115. inventory_image = "classic_coaches_corridor_coach_class1_inv.png",
  116. recipe = {
  117. {materials.goldblock},
  118. {'classic_coaches:corridor_coach_class2'},
  119. },
  120. },
  121. {
  122. wagon_type = "classic_coaches:corridor_coach_class2",
  123. mesh = "classic_coaches_corridor_coach_class2.b3d",
  124. textures = {"classic_coaches_corridor_coach_class2_001.png"},
  125. name = S("Intercity Corridor Coach Class 2"),
  126. inventory_image = "classic_coaches_corridor_coach_class2_inv.png",
  127. recipe = {
  128. {materials.steelblock, materials.dye_grey, materials.steelblock},
  129. {materials.glass, materials.wool_blue, materials.door_steel},
  130. {materials.wheel, materials.steelblock, materials.wheel},
  131. },
  132. },
  133. {
  134. wagon_type = "classic_coaches:open_coach_class1",
  135. mesh = "classic_coaches_open_coach_class1.b3d",
  136. textures = {"classic_coaches_open_coach_class1_001.png"},
  137. name = S("Intercity Open Coach Class 1"),
  138. inventory_image = "classic_coaches_open_coach_class1_inv.png",
  139. recipe = {
  140. {materials.goldblock},
  141. {'classic_coaches:open_coach_class2'},
  142. },
  143. },
  144. {
  145. wagon_type = "classic_coaches:open_coach_class2",
  146. mesh = "classic_coaches_open_coach_class2.b3d",
  147. textures = {"classic_coaches_open_coach_class2_001.png"},
  148. name = S("Intercity Open Coach Class 2"),
  149. inventory_image = "classic_coaches_open_coach_class2_inv.png",
  150. recipe = {
  151. {materials.steelblock, materials.dye_grey, materials.steelblock},
  152. {materials.glass, materials.wool_cyan, materials.door_steel},
  153. {materials.wheel, materials.steelblock, materials.wheel},
  154. },
  155. },
  156. }
  157. local livery_template_names = {
  158. [1] = {name = S("CC Stripe"), notes = "The livery features a medium width stripe with embedded logo. A narrow divider stripe can be added."},
  159. [2] = {name = S("CC Intercity Stripe"), notes = "The livery features a medium width stripe with embedded logo and the word, 'intercity'. The side doors are colored differently by default."},
  160. [3] = {name = S("CC Edged Stripe"), notes = "The livery features a medium width stripe with embedded logo. The stripe's edges are colored differently by default."},
  161. [4] = {name = S("CC Window Band"), notes = "A wide band of color spans the widow area for the length of the wagon."},
  162. [5] = {name = S("CC Solid Color"), notes = "The wagon sides are a solid color without stripes or other decoration."},
  163. [6] = {name = S("CC Colored Roof"), notes = "The roof and the lower edge of the wagon sides are colored. A wide light grey band spans the widow area for the length of the wagon."},
  164. [7] = {name = S("CC Express"), notes = "Thin stripes and the word, 'Express' are shown on both sides of the wagon."},
  165. }
  166. local livery_templates = {
  167. ["classic_coaches:corridor_coach_class1"] = {
  168. [1] = {
  169. base_texture = "classic_coaches_corridor_coach_class1_001.png",
  170. overlays = {
  171. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class1_side_walls.png", alpha = default_wall_alpha},
  172. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  173. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  174. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  175. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  176. },
  177. },
  178. [2] = {
  179. base_texture = "classic_coaches_corridor_coach_class1_002.png",
  180. overlays = {
  181. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class1_exterior_walls.png", alpha = default_wall_alpha},
  182. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  183. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  184. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  185. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  186. },
  187. },
  188. [3] = {
  189. base_texture = "classic_coaches_corridor_coach_class1_003.png",
  190. overlays = {
  191. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  192. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  193. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  194. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  195. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  196. },
  197. },
  198. [4] = {
  199. base_texture = "classic_coaches_corridor_coach_class1_004.png",
  200. overlays = {
  201. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  202. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class1_window_band.png", alpha = default_wall_alpha},
  203. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  204. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  205. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  206. },
  207. },
  208. [5] = {
  209. base_texture = "classic_coaches_corridor_coach_class1_005.png",
  210. overlays = {
  211. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class1_side_walls.png", alpha = default_wall_alpha},
  212. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  213. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  214. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  215. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  216. },
  217. },
  218. [6] = {
  219. base_texture = "classic_coaches_corridor_coach_class1_006.png",
  220. overlays = {
  221. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  222. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  223. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  224. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  225. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  226. },
  227. },
  228. [7] = {
  229. base_texture = "classic_coaches_corridor_coach_class1_007.png",
  230. overlays = {
  231. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class1_exterior_walls.png", alpha = default_wall_alpha},
  232. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  233. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  234. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  235. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  236. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  237. },
  238. },
  239. },
  240. ["classic_coaches:corridor_coach_class2"] = {
  241. [1] = {
  242. base_texture = "classic_coaches_corridor_coach_class2_001.png",
  243. overlays = {
  244. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class2_side_walls.png", alpha = default_wall_alpha},
  245. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  246. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  247. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  248. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  249. },
  250. },
  251. [2] = {
  252. base_texture = "classic_coaches_corridor_coach_class2_002.png",
  253. overlays = {
  254. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class2_exterior_walls.png", alpha = default_wall_alpha},
  255. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  256. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  257. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  258. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  259. },
  260. },
  261. [3] = {
  262. base_texture = "classic_coaches_corridor_coach_class2_003.png",
  263. overlays = {
  264. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  265. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  266. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  267. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  268. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  269. },
  270. },
  271. [4] = {
  272. base_texture = "classic_coaches_corridor_coach_class2_004.png",
  273. overlays = {
  274. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  275. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class2_window_band.png", alpha = default_wall_alpha},
  276. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  277. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  278. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  279. },
  280. },
  281. [5] = {
  282. base_texture = "classic_coaches_corridor_coach_class2_005.png",
  283. overlays = {
  284. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class2_side_walls.png", alpha = default_wall_alpha},
  285. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  286. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  287. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  288. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  289. },
  290. },
  291. [6] = {
  292. base_texture = "classic_coaches_corridor_coach_class2_006.png",
  293. overlays = {
  294. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  295. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  296. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  297. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  298. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  299. },
  300. },
  301. [7] = {
  302. base_texture = "classic_coaches_corridor_coach_class2_007.png",
  303. overlays = {
  304. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class2_exterior_walls.png", alpha = default_wall_alpha},
  305. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  306. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  307. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  308. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  309. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  310. },
  311. },
  312. },
  313. ["classic_coaches:open_coach_class1"] = {
  314. [1] = {
  315. base_texture = "classic_coaches_open_coach_class1_001.png",
  316. overlays = {
  317. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class1_side_walls.png", alpha = default_wall_alpha},
  318. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  319. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  320. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  321. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  322. },
  323. },
  324. [2] = {
  325. base_texture = "classic_coaches_open_coach_class1_002.png",
  326. overlays = {
  327. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class1_exterior_walls.png", alpha = default_wall_alpha},
  328. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  329. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  330. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  331. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  332. },
  333. },
  334. [3] = {
  335. base_texture = "classic_coaches_open_coach_class1_003.png",
  336. overlays = {
  337. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  338. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  339. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  340. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  341. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  342. },
  343. },
  344. [4] = {
  345. base_texture = "classic_coaches_open_coach_class1_004.png",
  346. overlays = {
  347. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  348. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class1_window_band.png", alpha = default_wall_alpha},
  349. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  350. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  351. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  352. },
  353. },
  354. [5] = {
  355. base_texture = "classic_coaches_open_coach_class1_005.png",
  356. overlays = {
  357. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class1_side_walls.png", alpha = default_wall_alpha},
  358. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  359. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  360. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  361. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  362. },
  363. },
  364. [6] = {
  365. base_texture = "classic_coaches_open_coach_class1_006.png",
  366. overlays = {
  367. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  368. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  369. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  370. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  371. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  372. },
  373. },
  374. [7] = {
  375. base_texture = "classic_coaches_open_coach_class1_007.png",
  376. overlays = {
  377. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class1_exterior_walls.png", alpha = default_wall_alpha},
  378. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  379. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  380. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  381. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  382. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  383. },
  384. },
  385. },
  386. ["classic_coaches:open_coach_class2"] = {
  387. [1] = {
  388. base_texture = "classic_coaches_open_coach_class2_001.png",
  389. overlays = {
  390. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class2_side_walls.png", alpha = default_wall_alpha},
  391. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  392. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  393. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  394. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  395. },
  396. },
  397. [2] = {
  398. base_texture = "classic_coaches_open_coach_class2_002.png",
  399. overlays = {
  400. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class2_exterior_walls.png", alpha = default_wall_alpha},
  401. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  402. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  403. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  404. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  405. },
  406. },
  407. [3] = {
  408. base_texture = "classic_coaches_open_coach_class2_003.png",
  409. overlays = {
  410. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  411. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  412. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  413. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  414. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  415. },
  416. },
  417. [4] = {
  418. base_texture = "classic_coaches_open_coach_class2_004.png",
  419. overlays = {
  420. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  421. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class2_window_band.png", alpha = default_wall_alpha},
  422. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  423. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  424. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  425. },
  426. },
  427. [5] = {
  428. base_texture = "classic_coaches_open_coach_class2_005.png",
  429. overlays = {
  430. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class2_side_walls.png", alpha = default_wall_alpha},
  431. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  432. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  433. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  434. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  435. },
  436. },
  437. [6] = {
  438. base_texture = "classic_coaches_open_coach_class2_006.png",
  439. overlays = {
  440. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  441. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  442. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  443. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  444. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  445. },
  446. },
  447. [7] = {
  448. base_texture = "classic_coaches_open_coach_class2_007.png",
  449. overlays = {
  450. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class2_exterior_walls.png", alpha = default_wall_alpha},
  451. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  452. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  453. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  454. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  455. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  456. },
  457. },
  458. },
  459. }
  460. -- Note: While all of the following predefined liveries will be registered
  461. -- for all of the wagon types defined in this mod, it is not required and
  462. -- might not be true if new wagons are added in the future.
  463. local predefined_liveries = {
  464. {
  465. name = S("CC Classic"),
  466. notes = "",
  467. livery_design = {
  468. livery_template_name = S("CC Window Band"),
  469. overlays = {
  470. [1] = {id = 1, color = "#FAF0E6"}, -- "Side Walls",
  471. [2] = {id = 2, color = "#202020"}, -- "Window Band",
  472. [3] = {id = 3, color = "#800000"}, -- "Decoration",
  473. -- [4] = {id = 4, color = "#000000"}, -- "Logo",
  474. [5] = {id = 5, color = "#FAF0E6"}, -- "Class Number",
  475. },
  476. },
  477. },
  478. {
  479. name = S("CC Classic Double Stripe"),
  480. notes = "",
  481. livery_design = {
  482. livery_template_name = S("CC Edged Stripe"),
  483. overlays = {
  484. [1] = {id = 1, color = "#FAF0E6"}, -- "Side Walls",
  485. [2] = {id = 2, color = "#FAF0E6"}, -- "Stripe",
  486. [3] = {id = 3, color = "#800000"}, -- "Stripe Edges",
  487. -- [4] = {id = 4, color = "#000000"}, -- "Logo",
  488. -- [5] = {id = 5, color = "#000000"}, -- "End Doors",
  489. },
  490. },
  491. },
  492. {
  493. name = S("CC Intercity Urban"),
  494. notes = "",
  495. livery_design = {
  496. livery_template_name = S("CC Intercity Stripe"),
  497. overlays = {
  498. [1] = {id = 1, color = "#808080"}, -- "Exterior Walls",
  499. [2] = {id = 2, color = "#006400"}, -- "Stripe",
  500. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  501. [4] = {id = 4, color = "#808080"}, -- "Side Doors",
  502. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  503. },
  504. },
  505. },
  506. {
  507. name = S("CC Intercity Dark Olive"),
  508. notes = "",
  509. livery_design = {
  510. livery_template_name = S("CC Intercity Stripe"),
  511. overlays = {
  512. [1] = {id = 1, color = "#516200"}, -- "Exterior Walls",
  513. -- [2] = {id = 2, color = "#000000"}, -- "Stripe",
  514. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  515. -- [4] = {id = 4, color = "#000000"}, -- "Side Doors",
  516. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  517. },
  518. },
  519. },
  520. {
  521. name = S("CC Legacy Solid Red"),
  522. notes = "",
  523. livery_design = {
  524. livery_template_name = S("CC Solid Color"),
  525. overlays = {
  526. [1] = {id = 1, color = "#800000"}, -- "Side Walls",
  527. [2] = {id = 2, color = "#2E8B57"}, -- "Seats",
  528. [3] = {id = 3, color = "#DAA520"}, -- "Service Stripe",
  529. [4] = {id = 4, color = "#FAF0E6"}, -- "Logo",
  530. -- [5] = {id = 5, color = "#FAF0E6"}, -- "Class Number",
  531. },
  532. },
  533. },
  534. {
  535. name = S("CC Modern Brown Stripe"),
  536. notes = "",
  537. livery_design = {
  538. livery_template_name = S("CC Stripe"),
  539. overlays = {
  540. -- [1] = {id = 1, color = "#000000"}, -- "Side Walls",
  541. [2] = {id = 2, color = "#8B4513"}, -- "Stripe",
  542. [3] = {id = 3, color = "#DAA520"}, -- "Stripe Divider",
  543. -- [4] = {id = 4, color = "#000000"}, -- "Side Doors",
  544. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  545. },
  546. },
  547. },
  548. {
  549. name = S("CC Slate Roof"),
  550. notes = "",
  551. livery_design = {
  552. livery_template_name = S("CC Colored Roof"),
  553. overlays = {
  554. [1] = {id = 1, color = "#708090"}, -- "Side Walls",
  555. [2] = {id = 2, color = "#2F4F4F"}, -- "Roof",
  556. [3] = {id = 3, color = "#2F4F4F"}, -- "Trim",
  557. [4] = {id = 4, color = "#2F4F4F"}, -- "Logo",
  558. [5] = {id = 5, color = "#708090"}, -- "End Doors",
  559. },
  560. },
  561. },
  562. {
  563. name = S("CC Legacy Express"),
  564. notes = "",
  565. livery_design = {
  566. livery_template_name = S("CC Express"),
  567. overlays = {
  568. [1] = {id = 1, color = "#400000"}, -- "Exterior Walls",
  569. [2] = {id = 2, color = "#000030"}, -- "Seats",
  570. -- [3] = {id = 3, color = "#000000"}, -- "Decoration",
  571. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  572. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  573. -- [6] = {id = 6, color = "#000000"}, -- "Logo",
  574. },
  575. },
  576. },
  577. {
  578. name = S("No Logo Solid Green"),
  579. notes = "",
  580. livery_design = {
  581. livery_template_name = S("CC Solid Color"),
  582. overlays = {
  583. [1] = {id = 1, color = "#004000"}, -- "Side Walls",
  584. -- [2] = {id = 2, color = "#000000"}, -- "Seats",
  585. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  586. [4] = {id = 4, color = "#004000"}, -- "Logo",
  587. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  588. },
  589. },
  590. },
  591. {
  592. name = S("No Logo Retro Mojo"),
  593. notes = "",
  594. livery_design = {
  595. livery_template_name = S("CC Window Band"),
  596. overlays = {
  597. [1] = {id = 1, color = "#008080"}, -- "Side Walls",
  598. [2] = {id = 2, color = "#FAF0E6"}, -- "Window Band",
  599. [3] = {id = 3, color = "#FAF0E6"}, -- "Decoration",
  600. [4] = {id = 4, color = "#008080"}, -- "Logo",
  601. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  602. },
  603. },
  604. },
  605. {
  606. name = S("No Logo Classic Express"),
  607. notes = "",
  608. livery_design = {
  609. livery_template_name = S("CC Express"),
  610. overlays = {
  611. -- [1] = {id = 1, color = "#000000"}, -- "Exterior Walls",
  612. -- [2] = {id = 2, color = "#000000"}, -- "Seats",
  613. -- [3] = {id = 3, color = "#000000"}, -- "Decoration",
  614. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  615. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  616. [6] = {id = 6, color = "#000030"}, -- "Logo",
  617. },
  618. },
  619. },
  620. {
  621. name = S("No Logo Evergreen Express"),
  622. notes = "",
  623. livery_design = {
  624. livery_template_name = S("CC Express"),
  625. overlays = {
  626. [1] = {id = 1, color = "#003B00"}, -- "Exterior Walls",
  627. [2] = {id = 2, color = "#2E8B57"}, -- "Seats",
  628. [3] = {id = 3, color = "#008000"}, -- "Decoration",
  629. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  630. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  631. [6] = {id = 6, color = "#003B00"}, -- "Logo",
  632. },
  633. },
  634. },
  635. {
  636. name = S("No Logo Expresso Express"),
  637. notes = "",
  638. livery_design = {
  639. livery_template_name = S("CC Express"),
  640. overlays = {
  641. [1] = {id = 1, color = "#703000"}, -- "Exterior Walls",
  642. [2] = {id = 2, color = "#D2B48C"}, -- "Seats",
  643. [3] = {id = 3, color = "#FFA500"}, -- "Decoration",
  644. [4] = {id = 4, color = "#FF8C00"}, -- "Label",
  645. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  646. [6] = {id = 6, color = "#703000"}, -- "Logo",
  647. },
  648. },
  649. },
  650. }
  651. -- ===============================================================================================================================================
  652. if use_advtrains_livery_designer then
  653. -- Notify player if a newer version of AdvTrains Livery Tools is available or needed.
  654. if not advtrains_livery_designer.is_compatible_mod_version or
  655. not advtrains_livery_designer.is_compatible_mod_version({major = 0, minor = 8, patch = 4}) then
  656. minetest.log("info", "["..mod_name.."] An old version of AdvTrains Livery Tools was detected. Consider updating to the latest version.")
  657. -- Version 0.8.4 is not currently required so just log an informational message.
  658. end
  659. -- This function is called by the advtrains_livery_designer tool whenever the player
  660. -- activates the "Apply" button. The texture and/or the mesh could optionally be
  661. -- modified here, if needed.
  662. local function apply_wagon_livery_textures(player, wagon, textures)
  663. if wagon and textures and textures[1] then
  664. local data = advtrains.wagons[wagon.id]
  665. data.livery = textures[1]
  666. wagon:set_textures(data)
  667. end
  668. end
  669. -- Register this mod and its livery functions with the advtrains_livery_designer tool.
  670. advtrains_livery_designer.register_mod(mod_name, apply_wagon_livery_textures)
  671. -- Register this mod's wagons.
  672. for _, wagon in ipairs(wagons) do
  673. advtrains_livery_database.register_wagon(wagon.wagon_type)
  674. end
  675. -- Register this mod's livery templates with the advtrains_livery_designer tool.
  676. for wagon_type, wagon_livery_templates in pairs(livery_templates) do
  677. for livery_template_id, livery_template in pairs(wagon_livery_templates) do
  678. local livery_template_name = livery_template_names[livery_template_id].name
  679. if livery_template_name then
  680. advtrains_livery_database.add_livery_template(
  681. wagon_type,
  682. livery_template_name,
  683. {livery_template.base_texture},
  684. mod_name,
  685. (livery_template.overlays and #livery_template.overlays) or 0,
  686. "Marnack", -- Template designer
  687. "CC-BY-SA-3.0", -- Texture license
  688. "Marnack", -- Texture creator(s)
  689. livery_template_names[livery_template_id].notes
  690. )
  691. if livery_template.overlays then
  692. for overlay_id, overlay in ipairs(livery_template.overlays) do
  693. advtrains_livery_database.add_livery_template_overlay(
  694. wagon_type,
  695. livery_template_name,
  696. overlay_id,
  697. overlay.name,
  698. 1,
  699. overlay.texture,
  700. overlay.alpha
  701. )
  702. end
  703. end
  704. end
  705. end
  706. end
  707. -- Register this mod's predefined wagon liveries with the advtrains_livery_designer tool.
  708. for _, predefined_livery in pairs(predefined_liveries) do
  709. -- Each predefined livery will be defined for each wagon type. This may not be true in the future.
  710. for _, wagon in pairs(wagons) do
  711. local livery_design = predefined_livery.livery_design
  712. livery_design.wagon_type = wagon.wagon_type
  713. advtrains_livery_database.add_predefined_livery(predefined_livery.name, livery_design, mod_name, predefined_livery.notes)
  714. end
  715. end
  716. end
  717. -- ===============================================================================================================================================
  718. -- This function is used when updating the wagon's livery with the bike painter tool.
  719. -- Although the bike painter can currently only paint the first overlay, this implementation
  720. -- will handle multiple overlays if that restriction changes.
  721. local function get_wagon_texture(wagon_type, livery_template_id, overlays)
  722. -- Get and then verify that the base texture is valid
  723. local wagon_texture = livery_templates[wagon_type][livery_template_id].base_texture
  724. if not wagon_texture then
  725. return nil
  726. end
  727. -- Append overlay clause(s) to the wagon texture based on the given overlays.
  728. -- Note that any of the given overlays that are not valid for the specified
  729. -- wagon type will be ignored.
  730. if overlays and livery_templates[wagon_type][livery_template_id].overlays then
  731. for _, overlay in ipairs(overlays) do
  732. if overlay.id and overlay.color and
  733. livery_templates[wagon_type][livery_template_id].overlays[overlay.id] and
  734. livery_templates[wagon_type][livery_template_id].overlays[overlay.id].texture then
  735. local alpha = livery_templates[wagon_type][livery_template_id].overlays[overlay.id].alpha or 255
  736. if alpha < 0 then alpha = 0 end
  737. if alpha > 255 then alpha = 255 end
  738. local overlay_texture = "^("..
  739. livery_templates[wagon_type][livery_template_id].overlays[overlay.id].texture..
  740. "^[colorize:"..overlay.color..":"..alpha..
  741. ")"
  742. wagon_texture = wagon_texture..overlay_texture
  743. end
  744. end
  745. end
  746. return wagon_texture
  747. end
  748. -- The following enables the bike painter to colorize the first overlay.
  749. local function set_livery(wagon, puncher, itemstack, data)
  750. local meta = itemstack:get_meta()
  751. local color = meta:get_string("paint_color")
  752. if not color or not color:find("^#%x%x%x%x%x%x$") then
  753. return
  754. end
  755. local alpha = tonumber(meta:get_string("alpha"))
  756. if not alpha then
  757. return
  758. end
  759. -- The alpha value is used to select the livery template. Note that the alpha
  760. -- values can range from 0 to 255. Livery template ids start with 1. Livery
  761. -- template ids greater than the number of defined livery tempaltes will cause
  762. -- the painter to have no effect.
  763. local livery_template_id = alpha + 1
  764. if not livery_template_names[livery_template_id] then
  765. return
  766. end
  767. -- It is possible that a given livery template may not be defined for all
  768. -- wagon types.
  769. local wagon_type = data.type
  770. if not livery_templates[wagon_type] or
  771. not livery_templates[wagon_type][livery_template_id] or
  772. not livery_templates[wagon_type][livery_template_id].base_texture then
  773. return
  774. end
  775. -- Using the bike painter only allows for the first overlay to be
  776. -- colorized. Also, the color "#000000" is reserved and used to
  777. -- force the livery tempalte to be displayed without any color overrides.
  778. -- This is only true when using the painter.
  779. local overlays = {}
  780. if color ~= "#000000" and livery_templates[wagon_type][livery_template_id].overlays then
  781. overlays = {[1] = {id = 1, color = color}}
  782. end
  783. local wagon_texture = get_wagon_texture(wagon_type, livery_template_id, overlays)
  784. if not wagon_texture then
  785. return
  786. end
  787. data.livery = wagon_texture
  788. wagon:set_textures(data)
  789. end
  790. local function set_textures(wagon, data)
  791. if data.livery then
  792. wagon.object:set_properties({textures={data.livery}})
  793. end
  794. end
  795. local function update_livery(wagon, puncher)
  796. local itemstack = puncher:get_wielded_item()
  797. local item_name = itemstack:get_name()
  798. if use_advtrains_livery_designer and item_name == advtrains_livery_designer.tool_name then
  799. advtrains_livery_designer.activate_tool(puncher, wagon, mod_name)
  800. return true
  801. end
  802. return false
  803. end
  804. ----------------------------------------------------------------------------------------
  805. for _, wagon in pairs(wagons) do
  806. advtrains.register_wagon(wagon.wagon_type, {
  807. mesh = wagon.mesh,
  808. textures = wagon.textures,
  809. set_textures = set_textures,
  810. set_livery = set_livery,
  811. custom_may_destroy = function(wgn, puncher, time_from_last_punch, tool_capabilities, direction)
  812. return not update_livery(wgn, puncher)
  813. end,
  814. drives_on={default=true},
  815. max_speed=20,
  816. seats = {
  817. {
  818. name="1",
  819. attach_offset={x=0, y=-2, z=17},
  820. view_offset={x=0, y=-1.7, z=0},
  821. group="pass",
  822. },
  823. {
  824. name="2",
  825. attach_offset={x=0, y=-2, z=6},
  826. view_offset={x=0, y=-1.7, z=0},
  827. group="pass",
  828. },
  829. {
  830. name="3",
  831. attach_offset={x=0, y=-2, z=-6},
  832. view_offset={x=0, y=-1.7, z=0},
  833. group="pass",
  834. },
  835. {
  836. name="4",
  837. attach_offset={x=0, y=-2, z=-17},
  838. view_offset={x=0, y=-1.7, z=0},
  839. group="pass",
  840. },
  841. },
  842. seat_groups = {
  843. pass={
  844. name = "Passenger area",
  845. access_to = {},
  846. require_doors_open=true,
  847. },
  848. },
  849. doors={
  850. open={
  851. [-1]={frames={x=21, y=30}, time=1},
  852. [1]={frames={x=1, y=10}, time=1}
  853. },
  854. close={
  855. [-1]={frames={x=30, y=41}, time=1},
  856. [1]={frames={x=10, y=20}, time=1}
  857. }
  858. },
  859. door_entry={-2, 2},
  860. assign_to_seat_group = {"pass"},
  861. visual_size = {x=1, y=1},
  862. wagon_span=3,
  863. wheel_positions = {1.9, -1.9},
  864. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  865. coupler_types_front = {chain=true},
  866. coupler_types_back = {chain=true},
  867. drops={materials.steelblock},
  868. }, wagon.name, wagon.inventory_image)
  869. -- Only register crafting recipes for the wagon if the needed mods are available.
  870. if materials.base_game then
  871. minetest.register_craft({
  872. output = wagon.wagon_type,
  873. recipe = wagon.recipe,
  874. })
  875. end
  876. end