init.lua 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  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. local use_attachment_patch = advtrains_attachment_offset_patch and advtrains_attachment_offset_patch.setup_advtrains_wagon
  5. ----------------------------------------------------------------------------------------
  6. local function get_materials_minetest_game()
  7. return {
  8. base_game = "Minetest Game",
  9. bottle = minetest.get_modpath("vessels") and "vessels:glass_bottle" or "default:glass",
  10. door_steel = minetest.get_modpath("doors") and "doors:trapdoor_steel" or "default:steel_ingot",
  11. dye_grey = "dye:grey",
  12. glass = "default:glass",
  13. goldblock = "default:goldblock",
  14. steel_ingot = "default:steel_ingot",
  15. steelblock = "default:steelblock",
  16. wheel = "advtrains:wheel",
  17. wool_blue = minetest.get_modpath("wool") and "wool:blue" or "dye:blue",
  18. wool_cyan = minetest.get_modpath("wool") and "wool:cyan" or "dye:cyan",
  19. }
  20. end
  21. local function get_materials_mineclonia()
  22. return {
  23. base_game = "Mineclonia",
  24. bottle = minetest.get_modpath("mcl_potions") and "mcl_potions:glass_bottle" or "mcl_core:glass",
  25. door_steel = minetest.get_modpath("mcl_doors") and "mcl_doors:iron_door" or "mcl_core:iron_ingot",
  26. dye_grey = "mcl_dyes:grey",
  27. glass = "mcl_core:glass",
  28. goldblock = "mcl_core:goldblock",
  29. steel_ingot = "mcl_core:iron_ingot",
  30. steelblock = "mcl_core:ironblock",
  31. wheel = "advtrains:wheel",
  32. wool_blue = minetest.get_modpath("mcl_wool") and "mcl_wool:blue" or "mcl_dyes:blue",
  33. wool_cyan = minetest.get_modpath("mcl_wool") and "mcl_wool:cyan" or "mcl_dyes:cyan",
  34. }
  35. end
  36. local function get_materials_voxelibre()
  37. return {
  38. base_game = "VoxeLibre/MineClone2",
  39. bottle = minetest.get_modpath("mcl_potions") and "mcl_potions:glass_bottle" or "mcl_core:glass",
  40. door_steel = minetest.get_modpath("mcl_doors") and "mcl_doors:iron_door" or "mcl_core:iron_ingot",
  41. dye_grey = "mcl_dye:grey",
  42. glass = "mcl_core:glass",
  43. goldblock = "mcl_core:goldblock",
  44. steel_ingot = "mcl_core:iron_ingot",
  45. steelblock = "mcl_core:ironblock",
  46. wheel = "advtrains:wheel",
  47. wool_blue = minetest.get_modpath("mcl_wool") and "mcl_wool:blue" or "mcl_dye:blue",
  48. wool_cyan = minetest.get_modpath("mcl_wool") and "mcl_wool:cyan" or "mcl_dye:cyan",
  49. }
  50. end
  51. local function get_materials_farlands_reloaded()
  52. return {
  53. base_game = "Farlands Reloaded",
  54. bottle = minetest.get_modpath("fl_bottles") and "fl_bottles:bottle" or "fl_glass:framed_glass",
  55. door_steel = minetest.get_modpath("fl_doors") and "fl_doors:steel_door_a" or "fl_ores:iron_ingot",
  56. dye_grey = "fl_dyes:grey_dye",
  57. glass = "fl_glass:framed_glass",
  58. goldblock = "fl_ores:gold_block",
  59. steel_ingot = "fl_ores:iron_ingot",
  60. steelblock = "fl_ores:iron_block",
  61. wheel = "advtrains:wheel",
  62. wool_blue = "fl_dyes:blue_dye", -- farlands handles wool color via param 2 so use dye instead.
  63. wool_cyan = "fl_dyes:cyan_dye", -- farlands handles wool color via param 2 so use dye instead.
  64. }
  65. end
  66. local function get_materials_hades_revisited()
  67. return {
  68. base_game = "Hades Revisited",
  69. bottle = minetest.get_modpath("hades_vessels") and "hades_vessels:glass_bottle" or "hades_core:glass",
  70. door_steel = minetest.get_modpath("hades_doors") and "hades_doors:door_steel_a" or "hades_core:steel_ingot",
  71. dye_grey = "hades_dye:grey",
  72. glass = "hades_core:glass",
  73. goldblock = "hades_core:goldblock",
  74. steel_ingot = "hades_core:steel_ingot",
  75. steelblock = "hades_core:steelblock",
  76. wheel = "advtrains:wheel",
  77. wool_blue = minetest.get_modpath("hades_cloth") and "hades_cloth:blue" or "hades_dye:blue",
  78. wool_cyan = minetest.get_modpath("hades_cloth") and "hades_cloth:cyan" or "hades_dye:cyan",
  79. }
  80. end
  81. local function get_materials()
  82. if minetest.get_modpath("default") and minetest.get_modpath("dye") then
  83. return get_materials_minetest_game()
  84. end
  85. if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_dyes") then
  86. return get_materials_mineclonia()
  87. end
  88. if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_dye") then
  89. return get_materials_voxelibre()
  90. end
  91. if minetest.get_modpath("fl_dyes") and minetest.get_modpath("fl_glass") and minetest.get_modpath("fl_ores") then
  92. return get_materials_farlands_reloaded()
  93. end
  94. if minetest.get_modpath("hades_core") and minetest.get_modpath("hades_dye") then
  95. return get_materials_hades_revisited()
  96. end
  97. local unknown_material = "classic_coaches:unknown_material"
  98. return {
  99. bottle = unknown_material,
  100. door_steel = unknown_material,
  101. dye_grey = unknown_material,
  102. glass = unknown_material,
  103. goldblock = unknown_material,
  104. steel_ingot = unknown_material,
  105. steelblock = unknown_material,
  106. wheel = unknown_material,
  107. wool_blue = unknown_material,
  108. wool_cyan = unknown_material,
  109. }
  110. end
  111. local materials = get_materials()
  112. ----------------------------------------------------------------------------------------
  113. local default_roof_alpha = 230
  114. local default_seat_alpha = 245
  115. local default_wall_alpha = 253
  116. local wagons = {
  117. {
  118. wagon_type = "classic_coaches:corridor_coach_class1",
  119. mesh = "classic_coaches_corridor_coach_class1.b3d",
  120. textures = {"classic_coaches_corridor_coach_class1_001.png"},
  121. name = S("Intercity Corridor Coach Class 1"),
  122. inventory_image = "classic_coaches_corridor_coach_class1_inv.png",
  123. recipe = {
  124. {materials.goldblock},
  125. {'classic_coaches:corridor_coach_class2'},
  126. },
  127. },
  128. {
  129. wagon_type = "classic_coaches:corridor_coach_class2",
  130. mesh = "classic_coaches_corridor_coach_class2.b3d",
  131. textures = {"classic_coaches_corridor_coach_class2_001.png"},
  132. name = S("Intercity Corridor Coach Class 2"),
  133. inventory_image = "classic_coaches_corridor_coach_class2_inv.png",
  134. recipe = {
  135. {materials.steelblock, materials.dye_grey, materials.steelblock},
  136. {materials.glass, materials.wool_blue, materials.door_steel},
  137. {materials.wheel, materials.steelblock, materials.wheel},
  138. },
  139. },
  140. {
  141. wagon_type = "classic_coaches:open_coach_class1",
  142. mesh = "classic_coaches_open_coach_class1.b3d",
  143. textures = {"classic_coaches_open_coach_class1_001.png"},
  144. name = S("Intercity Open Coach Class 1"),
  145. inventory_image = "classic_coaches_open_coach_class1_inv.png",
  146. recipe = {
  147. {materials.goldblock},
  148. {'classic_coaches:open_coach_class2'},
  149. },
  150. },
  151. {
  152. wagon_type = "classic_coaches:open_coach_class2",
  153. mesh = "classic_coaches_open_coach_class2.b3d",
  154. textures = {"classic_coaches_open_coach_class2_001.png"},
  155. name = S("Intercity Open Coach Class 2"),
  156. inventory_image = "classic_coaches_open_coach_class2_inv.png",
  157. recipe = {
  158. {materials.steelblock, materials.dye_grey, materials.steelblock},
  159. {materials.glass, materials.wool_cyan, materials.door_steel},
  160. {materials.wheel, materials.steelblock, materials.wheel},
  161. },
  162. },
  163. {
  164. wagon_type = "classic_coaches:bistro_coach",
  165. mesh = "classic_coaches_bistro_coach.b3d",
  166. textures = {"classic_coaches_bistro_coach_001.png"},
  167. name = S("Intercity Bistro Coach"),
  168. inventory_image = "classic_coaches_bistro_coach_inv.png",
  169. recipe = {
  170. {materials.steelblock, materials.bottle, materials.steelblock},
  171. {materials.glass, materials.wool_cyan, materials.door_steel},
  172. {materials.wheel, materials.steelblock, materials.wheel},
  173. },
  174. },
  175. }
  176. local livery_template_names = {
  177. [1] = {name = S("CC Stripe"), notes = "The livery features a medium width stripe with embedded logo. A narrow divider stripe can be added."},
  178. [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."},
  179. [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."},
  180. [4] = {name = S("CC Window Band"), notes = "A wide band of color spans the widow area for the length of the wagon."},
  181. [5] = {name = S("CC Solid Color"), notes = "The wagon sides are a solid color without stripes or other decoration."},
  182. [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."},
  183. [7] = {name = S("CC Express"), notes = "Thin stripes and the word, 'Express' are shown on both sides of the wagon."},
  184. }
  185. local livery_templates = {
  186. ["classic_coaches:corridor_coach_class1"] = {
  187. [1] = {
  188. base_texture = "classic_coaches_corridor_coach_class1_001.png",
  189. overlays = {
  190. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class1_side_walls.png", alpha = default_wall_alpha},
  191. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  192. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  193. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  194. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  195. },
  196. },
  197. [2] = {
  198. base_texture = "classic_coaches_corridor_coach_class1_002.png",
  199. overlays = {
  200. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class1_exterior_walls.png", alpha = default_wall_alpha},
  201. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  202. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  203. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  204. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  205. },
  206. },
  207. [3] = {
  208. base_texture = "classic_coaches_corridor_coach_class1_003.png",
  209. overlays = {
  210. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  211. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  212. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  213. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  214. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  215. },
  216. },
  217. [4] = {
  218. base_texture = "classic_coaches_corridor_coach_class1_004.png",
  219. overlays = {
  220. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  221. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class1_window_band.png", alpha = default_wall_alpha},
  222. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  223. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  224. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  225. },
  226. },
  227. [5] = {
  228. base_texture = "classic_coaches_corridor_coach_class1_005.png",
  229. overlays = {
  230. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class1_side_walls.png", alpha = default_wall_alpha},
  231. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  232. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  233. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  234. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  235. },
  236. },
  237. [6] = {
  238. base_texture = "classic_coaches_corridor_coach_class1_006.png",
  239. overlays = {
  240. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  241. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  242. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  243. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  244. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  245. },
  246. },
  247. [7] = {
  248. base_texture = "classic_coaches_corridor_coach_class1_007.png",
  249. overlays = {
  250. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class1_exterior_walls.png", alpha = default_wall_alpha},
  251. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  252. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  253. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  254. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  255. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  256. },
  257. },
  258. },
  259. ["classic_coaches:corridor_coach_class2"] = {
  260. [1] = {
  261. base_texture = "classic_coaches_corridor_coach_class2_001.png",
  262. overlays = {
  263. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class2_side_walls.png", alpha = default_wall_alpha},
  264. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  265. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  266. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  267. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  268. },
  269. },
  270. [2] = {
  271. base_texture = "classic_coaches_corridor_coach_class2_002.png",
  272. overlays = {
  273. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class2_exterior_walls.png", alpha = default_wall_alpha},
  274. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  275. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  276. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  277. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  278. },
  279. },
  280. [3] = {
  281. base_texture = "classic_coaches_corridor_coach_class2_003.png",
  282. overlays = {
  283. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  284. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  285. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  286. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  287. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  288. },
  289. },
  290. [4] = {
  291. base_texture = "classic_coaches_corridor_coach_class2_004.png",
  292. overlays = {
  293. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  294. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class2_window_band.png", alpha = default_wall_alpha},
  295. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  296. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  297. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  298. },
  299. },
  300. [5] = {
  301. base_texture = "classic_coaches_corridor_coach_class2_005.png",
  302. overlays = {
  303. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class2_side_walls.png", alpha = default_wall_alpha},
  304. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  305. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  306. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  307. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  308. },
  309. },
  310. [6] = {
  311. base_texture = "classic_coaches_corridor_coach_class2_006.png",
  312. overlays = {
  313. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  314. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  315. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  316. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  317. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  318. },
  319. },
  320. [7] = {
  321. base_texture = "classic_coaches_corridor_coach_class2_007.png",
  322. overlays = {
  323. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class2_exterior_walls.png", alpha = default_wall_alpha},
  324. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  325. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  326. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  327. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  328. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  329. },
  330. },
  331. },
  332. ["classic_coaches:open_coach_class1"] = {
  333. [1] = {
  334. base_texture = "classic_coaches_open_coach_class1_001.png",
  335. overlays = {
  336. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class1_side_walls.png", alpha = default_wall_alpha},
  337. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  338. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  339. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  340. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  341. },
  342. },
  343. [2] = {
  344. base_texture = "classic_coaches_open_coach_class1_002.png",
  345. overlays = {
  346. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class1_exterior_walls.png", alpha = default_wall_alpha},
  347. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  348. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  349. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  350. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  351. },
  352. },
  353. [3] = {
  354. base_texture = "classic_coaches_open_coach_class1_003.png",
  355. overlays = {
  356. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  357. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  358. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  359. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  360. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  361. },
  362. },
  363. [4] = {
  364. base_texture = "classic_coaches_open_coach_class1_004.png",
  365. overlays = {
  366. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  367. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class1_window_band.png", alpha = default_wall_alpha},
  368. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  369. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  370. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  371. },
  372. },
  373. [5] = {
  374. base_texture = "classic_coaches_open_coach_class1_005.png",
  375. overlays = {
  376. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class1_side_walls.png", alpha = default_wall_alpha},
  377. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  378. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  379. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  380. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  381. },
  382. },
  383. [6] = {
  384. base_texture = "classic_coaches_open_coach_class1_006.png",
  385. overlays = {
  386. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  387. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  388. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  389. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  390. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  391. },
  392. },
  393. [7] = {
  394. base_texture = "classic_coaches_open_coach_class1_007.png",
  395. overlays = {
  396. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class1_exterior_walls.png", alpha = default_wall_alpha},
  397. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  398. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  399. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  400. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class1_class_number.png"},
  401. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  402. },
  403. },
  404. },
  405. ["classic_coaches:open_coach_class2"] = {
  406. [1] = {
  407. base_texture = "classic_coaches_open_coach_class2_001.png",
  408. overlays = {
  409. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_class2_side_walls.png", alpha = default_wall_alpha},
  410. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_stripe.png", alpha = default_wall_alpha},
  411. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_stripe_divider.png"},
  412. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  413. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  414. },
  415. },
  416. [2] = {
  417. base_texture = "classic_coaches_open_coach_class2_002.png",
  418. overlays = {
  419. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_class2_exterior_walls.png", alpha = default_wall_alpha},
  420. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  421. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  422. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  423. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  424. },
  425. },
  426. [3] = {
  427. base_texture = "classic_coaches_open_coach_class2_003.png",
  428. overlays = {
  429. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_side_walls.png", alpha = default_wall_alpha},
  430. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  431. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  432. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  433. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  434. },
  435. },
  436. [4] = {
  437. base_texture = "classic_coaches_open_coach_class2_004.png",
  438. overlays = {
  439. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_side_walls.png", alpha = default_wall_alpha},
  440. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_class2_window_band.png", alpha = default_wall_alpha},
  441. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  442. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  443. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  444. },
  445. },
  446. [5] = {
  447. base_texture = "classic_coaches_open_coach_class2_005.png",
  448. overlays = {
  449. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_class2_side_walls.png", alpha = default_wall_alpha},
  450. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  451. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  452. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  453. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  454. },
  455. },
  456. [6] = {
  457. base_texture = "classic_coaches_open_coach_class2_006.png",
  458. overlays = {
  459. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_side_walls.png", alpha = default_wall_alpha},
  460. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  461. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  462. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  463. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  464. },
  465. },
  466. [7] = {
  467. base_texture = "classic_coaches_open_coach_class2_007.png",
  468. overlays = {
  469. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_class2_exterior_walls.png", alpha = default_wall_alpha},
  470. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_seats.png", alpha = default_seat_alpha},
  471. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  472. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  473. [5] = {name = S("Class Number"), texture = "classic_coaches_overlay_class2_class_number.png"},
  474. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  475. },
  476. },
  477. },
  478. ["classic_coaches:bistro_coach"] = {
  479. [1] = {
  480. base_texture = "classic_coaches_bistro_coach_001.png",
  481. overlays = {
  482. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_001_bistro_side_walls.png", alpha = default_wall_alpha},
  483. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_001_bistro_stripe.png", alpha = default_wall_alpha},
  484. [3] = {name = S("Stripe Divider"), texture = "classic_coaches_overlay_001_bistro_stripe_divider.png"},
  485. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  486. [5] = {name = S("Galley"), texture = "classic_coaches_overlay_bistro_galley.png", alpha = default_wall_alpha},
  487. },
  488. },
  489. [2] = {
  490. base_texture = "classic_coaches_bistro_coach_002.png",
  491. overlays = {
  492. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_002_bistro_exterior_walls.png", alpha = default_wall_alpha},
  493. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_002_stripe.png", alpha = default_wall_alpha},
  494. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  495. [4] = {name = S("Side Doors"), texture = "classic_coaches_overlay_side_doors.png", alpha = default_wall_alpha},
  496. [5] = {name = S("Bistro Label"), texture = "classic_coaches_overlay_bistro_label_5.png", alpha = default_wall_alpha},
  497. },
  498. },
  499. [3] = {
  500. base_texture = "classic_coaches_bistro_coach_003.png",
  501. overlays = {
  502. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_003_bistro_side_walls.png", alpha = default_wall_alpha},
  503. [2] = {name = S("Stripe"), texture = "classic_coaches_overlay_003_stripe.png", alpha = default_wall_alpha},
  504. [3] = {name = S("Stripe Edges"), texture = "classic_coaches_overlay_003_stripe_edges.png"},
  505. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_1.png"},
  506. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  507. [6] = {name = S("Bistro Label"), texture = "classic_coaches_overlay_bistro_label_1.png", alpha = default_wall_alpha},
  508. },
  509. },
  510. [4] = {
  511. base_texture = "classic_coaches_bistro_coach_004.png",
  512. overlays = {
  513. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_004_bistro_side_walls.png", alpha = default_wall_alpha},
  514. [2] = {name = S("Window Band"), texture = "classic_coaches_overlay_004_bistro_window_band.png", alpha = default_wall_alpha},
  515. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_004_decoration.png"},
  516. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  517. [5] = {name = S("Bistro Label"), texture = "classic_coaches_overlay_bistro_label_4.png"},
  518. },
  519. },
  520. [5] = {
  521. base_texture = "classic_coaches_bistro_coach_005.png",
  522. overlays = {
  523. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_005_bistro_side_walls.png", alpha = default_wall_alpha},
  524. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_bistro_seats.png", alpha = default_seat_alpha},
  525. [3] = {name = S("Service Stripe"), texture = "classic_coaches_overlay_service_stripe.png"},
  526. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  527. [5] = {name = S("Bistro Label"), texture = "classic_coaches_overlay_bistro_label_2.png"},
  528. [6] = {name = S("Galley"), texture = "classic_coaches_overlay_bistro_galley.png", alpha = default_wall_alpha},
  529. },
  530. },
  531. [6] = {
  532. base_texture = "classic_coaches_bistro_coach_006.png",
  533. overlays = {
  534. [1] = {name = S("Side Walls"), texture = "classic_coaches_overlay_006_bistro_side_walls.png", alpha = default_wall_alpha},
  535. [2] = {name = S("Roof"), texture = "classic_coaches_overlay_006_roof.png", alpha = default_roof_alpha},
  536. [3] = {name = S("Trim"), texture = "classic_coaches_overlay_006_trim.png"},
  537. [4] = {name = S("Logo"), texture = "classic_coaches_overlay_cc_logo_2.png"},
  538. [5] = {name = S("End Doors"), texture = "classic_coaches_overlay_end_doors.png", alpha = default_wall_alpha},
  539. [6] = {name = S("Bistro Label"), texture = "classic_coaches_overlay_bistro_label_2.png"},
  540. },
  541. },
  542. [7] = {
  543. base_texture = "classic_coaches_bistro_coach_007.png",
  544. overlays = {
  545. [1] = {name = S("Exterior Walls"), texture = "classic_coaches_overlay_007_bistro_exterior_walls.png", alpha = default_wall_alpha},
  546. [2] = {name = S("Seats"), texture = "classic_coaches_overlay_bistro_seats.png", alpha = default_seat_alpha},
  547. [3] = {name = S("Decoration"), texture = "classic_coaches_overlay_007_decoration.png"},
  548. [4] = {name = S("Label"), texture = "classic_coaches_overlay_007_label.png"},
  549. [5] = {name = S("Bistro Label"), texture = "classic_coaches_overlay_bistro_label_3.png"},
  550. [6] = {name = S("Logo and Text"), texture = "classic_coaches_overlay_007_logo_text.png"},
  551. },
  552. },
  553. },
  554. }
  555. -- Define groups of wagon types that will share predefined liveries.
  556. local wagon_types = {
  557. common_coaches = {
  558. "classic_coaches:corridor_coach_class1",
  559. "classic_coaches:corridor_coach_class2",
  560. "classic_coaches:open_coach_class1",
  561. "classic_coaches:open_coach_class2",
  562. },
  563. bistro_coaches = {
  564. "classic_coaches:bistro_coach",
  565. },
  566. }
  567. local predefined_liveries = {
  568. {
  569. name = S("CC Classic"),
  570. wagon_types = wagon_types.common_coaches,
  571. notes = "",
  572. livery_design = {
  573. livery_template_name = S("CC Window Band"),
  574. overlays = {
  575. [1] = {id = 1, color = "#FAF0E6"}, -- "Side Walls",
  576. [2] = {id = 2, color = "#202020"}, -- "Window Band",
  577. [3] = {id = 3, color = "#800000"}, -- "Decoration",
  578. -- [4] = {id = 4, color = "#000000"}, -- "Logo",
  579. [5] = {id = 5, color = "#FAF0E6"}, -- "Class Number",
  580. },
  581. },
  582. },
  583. {
  584. name = S("CC Classic"),
  585. wagon_types = wagon_types.bistro_coaches,
  586. notes = "",
  587. livery_design = {
  588. livery_template_name = S("CC Window Band"),
  589. overlays = {
  590. [1] = {id = 1, color = "#FAF0E6"}, -- "Side Walls",
  591. [2] = {id = 2, color = "#202020"}, -- "Window Band",
  592. [3] = {id = 3, color = "#800000"}, -- "Decoration",
  593. -- [4] = {id = 4, color = "#000000"}, -- "Logo",
  594. [5] = {id = 5, color = "#C0C0C0"}, -- "Bistro Label",
  595. },
  596. },
  597. },
  598. {
  599. name = S("CC Classic Double Stripe"),
  600. wagon_types = wagon_types.common_coaches,
  601. notes = "",
  602. livery_design = {
  603. livery_template_name = S("CC Edged Stripe"),
  604. overlays = {
  605. [1] = {id = 1, color = "#FAF0E6"}, -- "Side Walls",
  606. [2] = {id = 2, color = "#FAF0E6"}, -- "Stripe",
  607. [3] = {id = 3, color = "#800000"}, -- "Stripe Edges",
  608. -- [4] = {id = 4, color = "#000000"}, -- "Logo",
  609. -- [5] = {id = 5, color = "#000000"}, -- "End Doors",
  610. },
  611. },
  612. },
  613. {
  614. name = S("CC Classic Double Stripe"),
  615. wagon_types = wagon_types.bistro_coaches,
  616. notes = "",
  617. livery_design = {
  618. livery_template_name = S("CC Edged Stripe"),
  619. overlays = {
  620. [1] = {id = 1, color = "#FAF0E6"}, -- "Side Walls",
  621. [2] = {id = 2, color = "#FAF0E6"}, -- "Stripe",
  622. [3] = {id = 3, color = "#800000"}, -- "Stripe Edges",
  623. -- [4] = {id = 4, color = "#000000"}, -- "Logo",
  624. -- [5] = {id = 5, color = "#000000"}, -- "End Doors",
  625. [6] = {id = 6, color = "#969696"}, -- "Bistro Label",
  626. },
  627. },
  628. },
  629. {
  630. name = S("CC Intercity Urban"),
  631. wagon_types = wagon_types.common_coaches,
  632. notes = "",
  633. livery_design = {
  634. livery_template_name = S("CC Intercity Stripe"),
  635. overlays = {
  636. [1] = {id = 1, color = "#808080"}, -- "Exterior Walls",
  637. [2] = {id = 2, color = "#006400"}, -- "Stripe",
  638. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  639. [4] = {id = 4, color = "#808080"}, -- "Side Doors",
  640. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  641. },
  642. },
  643. },
  644. {
  645. name = S("CC Intercity Urban"),
  646. wagon_types = wagon_types.bistro_coaches,
  647. notes = "",
  648. livery_design = {
  649. livery_template_name = S("CC Intercity Stripe"),
  650. overlays = {
  651. [1] = {id = 1, color = "#808080"}, -- "Exterior Walls",
  652. [2] = {id = 2, color = "#006400"}, -- "Stripe",
  653. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  654. [4] = {id = 4, color = "#808080"}, -- "Side Doors",
  655. [5] = {id = 5, color = "#B0B0B0"}, -- "Bistro Label",
  656. },
  657. },
  658. },
  659. {
  660. name = S("CC Intercity Dark Olive"),
  661. wagon_types = wagon_types.common_coaches,
  662. notes = "",
  663. livery_design = {
  664. livery_template_name = S("CC Intercity Stripe"),
  665. overlays = {
  666. [1] = {id = 1, color = "#516200"}, -- "Exterior Walls",
  667. -- [2] = {id = 2, color = "#000000"}, -- "Stripe",
  668. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  669. -- [4] = {id = 4, color = "#000000"}, -- "Side Doors",
  670. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  671. },
  672. },
  673. },
  674. {
  675. name = S("CC Intercity Dark Olive"),
  676. wagon_types = wagon_types.bistro_coaches,
  677. notes = "",
  678. livery_design = {
  679. livery_template_name = S("CC Intercity Stripe"),
  680. overlays = {
  681. [1] = {id = 1, color = "#516200"}, -- "Exterior Walls",
  682. -- [2] = {id = 2, color = "#000000"}, -- "Stripe",
  683. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  684. -- [4] = {id = 4, color = "#000000"}, -- "Side Doors",
  685. [5] = {id = 5, color = "#7C8B00"}, -- "Bistro Label",
  686. },
  687. },
  688. },
  689. {
  690. name = S("CC Legacy Solid Red"),
  691. wagon_types = wagon_types.common_coaches,
  692. notes = "",
  693. livery_design = {
  694. livery_template_name = S("CC Solid Color"),
  695. overlays = {
  696. [1] = {id = 1, color = "#800000"}, -- "Side Walls",
  697. [2] = {id = 2, color = "#2E8B57"}, -- "Seats",
  698. [3] = {id = 3, color = "#DAA520"}, -- "Service Stripe",
  699. [4] = {id = 4, color = "#FAF0E6"}, -- "Logo",
  700. -- [5] = {id = 5, color = "#FAF0E6"}, -- "Class Number",
  701. },
  702. },
  703. },
  704. {
  705. name = S("CC Legacy Solid Red"),
  706. wagon_types = wagon_types.bistro_coaches,
  707. notes = "",
  708. livery_design = {
  709. livery_template_name = S("CC Solid Color"),
  710. overlays = {
  711. [1] = {id = 1, color = "#800000"}, -- "Side Walls",
  712. [2] = {id = 2, color = "#2E8B57"}, -- "Seats",
  713. [3] = {id = 3, color = "#DAA520"}, -- "Service Stripe",
  714. [4] = {id = 4, color = "#FAF0E6"}, -- "Logo",
  715. [5] = {id = 5, color = "#C60000"}, -- "Bistro Label",
  716. [6] = {id = 6, color = "#2E8B57"}, -- "Galley",
  717. },
  718. },
  719. },
  720. {
  721. name = S("CC Modern Brown Stripe"),
  722. wagon_types = wagon_types.common_coaches,
  723. notes = "",
  724. livery_design = {
  725. livery_template_name = S("CC Stripe"),
  726. overlays = {
  727. -- [1] = {id = 1, color = "#000000"}, -- "Side Walls",
  728. [2] = {id = 2, color = "#8B4513"}, -- "Stripe",
  729. [3] = {id = 3, color = "#DAA520"}, -- "Stripe Divider",
  730. -- [4] = {id = 4, color = "#000000"}, -- "Side Doors",
  731. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  732. },
  733. },
  734. },
  735. {
  736. name = S("CC Modern Brown Stripe"),
  737. wagon_types = wagon_types.bistro_coaches,
  738. notes = "",
  739. livery_design = {
  740. livery_template_name = S("CC Stripe"),
  741. overlays = {
  742. -- [1] = {id = 1, color = "#000000"}, -- "Side Walls",
  743. [2] = {id = 2, color = "#8B4513"}, -- "Stripe",
  744. [3] = {id = 3, color = "#DAA520"}, -- "Stripe Divider",
  745. -- [4] = {id = 4, color = "#000000"}, -- "Side Doors",
  746. [5] = {id = 5, color = "#DAA520"}, -- "Galley",
  747. },
  748. },
  749. },
  750. {
  751. name = S("CC Slate Roof"),
  752. wagon_types = wagon_types.common_coaches,
  753. notes = "",
  754. livery_design = {
  755. livery_template_name = S("CC Colored Roof"),
  756. overlays = {
  757. [1] = {id = 1, color = "#708090"}, -- "Side Walls",
  758. [2] = {id = 2, color = "#2F4F4F"}, -- "Roof",
  759. [3] = {id = 3, color = "#2F4F4F"}, -- "Trim",
  760. [4] = {id = 4, color = "#2F4F4F"}, -- "Logo",
  761. [5] = {id = 5, color = "#708090"}, -- "End Doors",
  762. },
  763. },
  764. },
  765. {
  766. name = S("CC Slate Roof"),
  767. wagon_types = wagon_types.bistro_coaches,
  768. notes = "",
  769. livery_design = {
  770. livery_template_name = S("CC Colored Roof"),
  771. overlays = {
  772. [1] = {id = 1, color = "#708090"}, -- "Side Walls",
  773. [2] = {id = 2, color = "#2F4F4F"}, -- "Roof",
  774. [3] = {id = 3, color = "#2F4F4F"}, -- "Trim",
  775. [4] = {id = 4, color = "#2F4F4F"}, -- "Logo",
  776. [5] = {id = 5, color = "#708090"}, -- "End Doors",
  777. -- [6] = {id = 6, color = "#000000"}, -- "Bistro Label",
  778. },
  779. },
  780. },
  781. {
  782. name = S("CC Legacy Express"),
  783. wagon_types = wagon_types.common_coaches,
  784. notes = "",
  785. livery_design = {
  786. livery_template_name = S("CC Express"),
  787. overlays = {
  788. [1] = {id = 1, color = "#400000"}, -- "Exterior Walls",
  789. [2] = {id = 2, color = "#000030"}, -- "Seats",
  790. -- [3] = {id = 3, color = "#000000"}, -- "Decoration",
  791. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  792. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  793. -- [6] = {id = 6, color = "#000000"}, -- "Logo and Text",
  794. },
  795. },
  796. },
  797. {
  798. name = S("CC Legacy Express"),
  799. wagon_types = wagon_types.bistro_coaches,
  800. notes = "",
  801. livery_design = {
  802. livery_template_name = S("CC Express"),
  803. overlays = {
  804. [1] = {id = 1, color = "#400000"}, -- "Exterior Walls",
  805. [2] = {id = 2, color = "#000030"}, -- "Seats",
  806. -- [3] = {id = 3, color = "#000000"}, -- "Decoration",
  807. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  808. -- [5] = {id = 5, color = "#000000"}, -- "Bistro Label",
  809. -- [6] = {id = 6, color = "#000000"}, -- "Logo and Text",
  810. },
  811. },
  812. },
  813. {
  814. name = S("No Logo Solid Green"),
  815. wagon_types = wagon_types.common_coaches,
  816. notes = "",
  817. livery_design = {
  818. livery_template_name = S("CC Solid Color"),
  819. overlays = {
  820. [1] = {id = 1, color = "#004000"}, -- "Side Walls",
  821. -- [2] = {id = 2, color = "#000000"}, -- "Seats",
  822. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  823. [4] = {id = 4, color = "#004000"}, -- "Logo",
  824. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  825. },
  826. },
  827. },
  828. {
  829. name = S("No Logo Solid Green"),
  830. wagon_types = wagon_types.bistro_coaches,
  831. notes = "",
  832. livery_design = {
  833. livery_template_name = S("CC Solid Color"),
  834. overlays = {
  835. [1] = {id = 1, color = "#004000"}, -- "Side Walls",
  836. -- [2] = {id = 2, color = "#000000"}, -- "Seats",
  837. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  838. [4] = {id = 4, color = "#004000"}, -- "Logo",
  839. -- [5] = {id = 5, color = "#000000"}, -- "Bistro Label",
  840. -- [6] = {id = 6, color = "#000000"}, -- "Galley",
  841. },
  842. },
  843. },
  844. {
  845. name = S("No Logo Retro Mojo"),
  846. wagon_types = wagon_types.common_coaches,
  847. notes = "",
  848. livery_design = {
  849. livery_template_name = S("CC Window Band"),
  850. overlays = {
  851. [1] = {id = 1, color = "#008080"}, -- "Side Walls",
  852. [2] = {id = 2, color = "#FAF0E6"}, -- "Window Band",
  853. [3] = {id = 3, color = "#FAF0E6"}, -- "Decoration",
  854. [4] = {id = 4, color = "#008080"}, -- "Logo",
  855. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  856. },
  857. },
  858. },
  859. {
  860. name = S("No Logo Retro Mojo"),
  861. wagon_types = wagon_types.bistro_coaches,
  862. notes = "",
  863. livery_design = {
  864. livery_template_name = S("CC Window Band"),
  865. overlays = {
  866. [1] = {id = 1, color = "#008080"}, -- "Side Walls",
  867. [2] = {id = 2, color = "#FAF0E6"}, -- "Window Band",
  868. [3] = {id = 3, color = "#FAF0E6"}, -- "Decoration",
  869. [4] = {id = 4, color = "#008080"}, -- "Logo",
  870. [5] = {id = 5, color = "#009C9C"}, -- "Bistro Label",
  871. },
  872. },
  873. },
  874. {
  875. name = S("No Logo Classic Express"),
  876. wagon_types = wagon_types.common_coaches,
  877. notes = "",
  878. livery_design = {
  879. livery_template_name = S("CC Express"),
  880. overlays = {
  881. -- [1] = {id = 1, color = "#000000"}, -- "Exterior Walls",
  882. -- [2] = {id = 2, color = "#000000"}, -- "Seats",
  883. -- [3] = {id = 3, color = "#000000"}, -- "Decoration",
  884. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  885. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  886. [6] = {id = 6, color = "#000030"}, -- "Logo",
  887. },
  888. },
  889. },
  890. {
  891. name = S("No Logo Classic Express"),
  892. wagon_types = wagon_types.bistro_coaches,
  893. notes = "",
  894. livery_design = {
  895. livery_template_name = S("CC Express"),
  896. overlays = {
  897. -- [1] = {id = 1, color = "#000000"}, -- "Exterior Walls",
  898. -- [2] = {id = 2, color = "#000000"}, -- "Seats",
  899. -- [3] = {id = 3, color = "#000000"}, -- "Decoration",
  900. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  901. -- [5] = {id = 5, color = "#000000"}, -- "Bistro Label",
  902. [6] = {id = 6, color = "#000030"}, -- "Logo",
  903. },
  904. },
  905. },
  906. {
  907. name = S("No Logo Evergreen Express"),
  908. wagon_types = wagon_types.common_coaches,
  909. notes = "",
  910. livery_design = {
  911. livery_template_name = S("CC Express"),
  912. overlays = {
  913. [1] = {id = 1, color = "#003B00"}, -- "Exterior Walls",
  914. [2] = {id = 2, color = "#2E8B57"}, -- "Seats",
  915. [3] = {id = 3, color = "#008000"}, -- "Decoration",
  916. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  917. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  918. [6] = {id = 6, color = "#003B00"}, -- "Logo",
  919. },
  920. },
  921. },
  922. {
  923. name = S("No Logo Evergreen Express"),
  924. wagon_types = wagon_types.bistro_coaches,
  925. notes = "",
  926. livery_design = {
  927. livery_template_name = S("CC Express"),
  928. overlays = {
  929. [1] = {id = 1, color = "#003B00"}, -- "Exterior Walls",
  930. [2] = {id = 2, color = "#2E8B57"}, -- "Seats",
  931. [3] = {id = 3, color = "#008000"}, -- "Decoration",
  932. -- [4] = {id = 4, color = "#000000"}, -- "Label",
  933. -- [5] = {id = 5, color = "#000000"}, -- "Bistro Label",
  934. [6] = {id = 6, color = "#003B00"}, -- "Logo",
  935. },
  936. },
  937. },
  938. {
  939. name = S("No Logo Expresso Express"),
  940. wagon_types = wagon_types.common_coaches,
  941. notes = "",
  942. livery_design = {
  943. livery_template_name = S("CC Express"),
  944. overlays = {
  945. [1] = {id = 1, color = "#703000"}, -- "Exterior Walls",
  946. [2] = {id = 2, color = "#D2B48C"}, -- "Seats",
  947. [3] = {id = 3, color = "#FFA500"}, -- "Decoration",
  948. [4] = {id = 4, color = "#FF8C00"}, -- "Label",
  949. -- [5] = {id = 5, color = "#000000"}, -- "Class Number",
  950. [6] = {id = 6, color = "#703000"}, -- "Logo",
  951. },
  952. },
  953. },
  954. {
  955. name = S("No Logo Expresso Express"),
  956. wagon_types = wagon_types.bistro_coaches,
  957. notes = "",
  958. livery_design = {
  959. livery_template_name = S("CC Express"),
  960. overlays = {
  961. [1] = {id = 1, color = "#703000"}, -- "Exterior Walls",
  962. [2] = {id = 2, color = "#D2B48C"}, -- "Seats",
  963. [3] = {id = 3, color = "#FFA500"}, -- "Decoration",
  964. [4] = {id = 4, color = "#FF8C00"}, -- "Label",
  965. -- [5] = {id = 5, color = "#000000"}, -- "Bistro Label",
  966. [6] = {id = 6, color = "#703000"}, -- "Logo",
  967. },
  968. },
  969. },
  970. }
  971. -- ===============================================================================================================================================
  972. if use_advtrains_livery_designer then
  973. -- Notify player if a newer version of AdvTrains Livery Tools is available or needed.
  974. if not advtrains_livery_designer.is_compatible_mod_version or
  975. not advtrains_livery_designer.is_compatible_mod_version({major = 0, minor = 9, patch = 0}) then
  976. minetest.log("info", "["..mod_name.."] An old version of AdvTrains Livery Tools was detected. Consider updating to the latest version.")
  977. -- Version 0.9.0 is not currently required so just log an informational message.
  978. end
  979. -- This function is called by the advtrains_livery_designer tool whenever the player
  980. -- activates the "Apply" button. The texture and/or the mesh could optionally be
  981. -- modified here, if needed.
  982. local function apply_wagon_livery_textures(player, wagon, textures)
  983. if wagon and textures and textures[1] then
  984. local data = advtrains.wagons[wagon.id]
  985. data.livery = textures[1]
  986. wagon:set_textures(data)
  987. end
  988. end
  989. -- Register this mod and its livery functions with the advtrains_livery_designer tool.
  990. advtrains_livery_designer.register_mod(mod_name, apply_wagon_livery_textures)
  991. -- Register this mod's wagons.
  992. for _, wagon in ipairs(wagons) do
  993. advtrains_livery_database.register_wagon(wagon.wagon_type)
  994. end
  995. -- Register this mod's livery templates with the advtrains_livery_designer tool.
  996. for wagon_type, wagon_livery_templates in pairs(livery_templates) do
  997. for livery_template_id, livery_template in pairs(wagon_livery_templates) do
  998. local livery_template_name = livery_template_names[livery_template_id].name
  999. if livery_template_name then
  1000. advtrains_livery_database.add_livery_template(
  1001. wagon_type,
  1002. livery_template_name,
  1003. {livery_template.base_texture},
  1004. mod_name,
  1005. (livery_template.overlays and #livery_template.overlays) or 0,
  1006. "Marnack", -- Template designer
  1007. "CC-BY-SA-3.0", -- Texture license
  1008. "Marnack", -- Texture creator(s)
  1009. livery_template_names[livery_template_id].notes
  1010. )
  1011. if livery_template.overlays then
  1012. for overlay_id, overlay in ipairs(livery_template.overlays) do
  1013. advtrains_livery_database.add_livery_template_overlay(
  1014. wagon_type,
  1015. livery_template_name,
  1016. overlay_id,
  1017. overlay.name,
  1018. 1,
  1019. overlay.texture,
  1020. overlay.alpha
  1021. )
  1022. end
  1023. end
  1024. end
  1025. end
  1026. end
  1027. -- Register this mod's predefined wagon liveries with the advtrains_livery_designer tool.
  1028. for _, predefined_livery in pairs(predefined_liveries) do
  1029. -- Each predefined livery will specify the wagon types to which it applies.
  1030. for _, wagon_type in pairs(predefined_livery.wagon_types) do
  1031. local livery_design = predefined_livery.livery_design
  1032. livery_design.wagon_type = wagon_type
  1033. advtrains_livery_database.add_predefined_livery(predefined_livery.name, livery_design, mod_name, predefined_livery.notes)
  1034. end
  1035. end
  1036. end
  1037. -- ===============================================================================================================================================
  1038. -- This function is used when updating the wagon's livery with the bike painter tool.
  1039. -- Although the bike painter can currently only paint the first overlay, this implementation
  1040. -- will handle multiple overlays if that restriction changes.
  1041. local function get_wagon_texture(wagon_type, livery_template_id, overlays)
  1042. -- Get and then verify that the base texture is valid
  1043. local wagon_texture = livery_templates[wagon_type][livery_template_id].base_texture
  1044. if not wagon_texture then
  1045. return nil
  1046. end
  1047. -- Append overlay clause(s) to the wagon texture based on the given overlays.
  1048. -- Note that any of the given overlays that are not valid for the specified
  1049. -- wagon type will be ignored.
  1050. if overlays and livery_templates[wagon_type][livery_template_id].overlays then
  1051. for _, overlay in ipairs(overlays) do
  1052. if overlay.id and overlay.color and
  1053. livery_templates[wagon_type][livery_template_id].overlays[overlay.id] and
  1054. livery_templates[wagon_type][livery_template_id].overlays[overlay.id].texture then
  1055. local alpha = livery_templates[wagon_type][livery_template_id].overlays[overlay.id].alpha or 255
  1056. if alpha < 0 then alpha = 0 end
  1057. if alpha > 255 then alpha = 255 end
  1058. local overlay_texture = "^("..
  1059. livery_templates[wagon_type][livery_template_id].overlays[overlay.id].texture..
  1060. "^[colorize:"..overlay.color..":"..alpha..
  1061. ")"
  1062. wagon_texture = wagon_texture..overlay_texture
  1063. end
  1064. end
  1065. end
  1066. return wagon_texture
  1067. end
  1068. -- The following enables the bike painter to colorize the first overlay.
  1069. local function set_livery(wagon, puncher, itemstack, data)
  1070. local meta = itemstack:get_meta()
  1071. local color = meta:get_string("paint_color")
  1072. if not color or not color:find("^#%x%x%x%x%x%x$") then
  1073. return
  1074. end
  1075. local alpha = tonumber(meta:get_string("alpha"))
  1076. if not alpha then
  1077. return
  1078. end
  1079. -- The alpha value is used to select the livery template. Note that the alpha
  1080. -- values can range from 0 to 255. Livery template ids start with 1. Livery
  1081. -- template ids greater than the number of defined livery tempaltes will cause
  1082. -- the painter to have no effect.
  1083. local livery_template_id = alpha + 1
  1084. if not livery_template_names[livery_template_id] then
  1085. return
  1086. end
  1087. -- It is possible that a given livery template may not be defined for all
  1088. -- wagon types.
  1089. local wagon_type = data.type
  1090. if not livery_templates[wagon_type] or
  1091. not livery_templates[wagon_type][livery_template_id] or
  1092. not livery_templates[wagon_type][livery_template_id].base_texture then
  1093. return
  1094. end
  1095. -- Using the bike painter only allows for the first overlay to be
  1096. -- colorized. Also, the color "#000000" is reserved and used to
  1097. -- force the livery tempalte to be displayed without any color overrides.
  1098. -- This is only true when using the painter.
  1099. local overlays = {}
  1100. if color ~= "#000000" and livery_templates[wagon_type][livery_template_id].overlays then
  1101. overlays = {[1] = {id = 1, color = color}}
  1102. end
  1103. local wagon_texture = get_wagon_texture(wagon_type, livery_template_id, overlays)
  1104. if not wagon_texture then
  1105. return
  1106. end
  1107. data.livery = wagon_texture
  1108. wagon:set_textures(data)
  1109. end
  1110. local function set_textures(wagon, data)
  1111. if data.livery then
  1112. wagon.object:set_properties({textures={data.livery}})
  1113. end
  1114. end
  1115. local function update_livery(wagon, puncher)
  1116. local itemstack = puncher:get_wielded_item()
  1117. local item_name = itemstack:get_name()
  1118. if use_advtrains_livery_designer and item_name == advtrains_livery_designer.tool_name then
  1119. advtrains_livery_designer.activate_tool(puncher, wagon, mod_name)
  1120. return true
  1121. end
  1122. return false
  1123. end
  1124. ----------------------------------------------------------------------------------------
  1125. local common_seats = {
  1126. {
  1127. name="1",
  1128. attach_offset={x=0, y=-2, z=17},
  1129. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1130. advtrains_attachment_offset_patch_attach_rotation = use_attachment_patch and {x=0, y=180, z=0} or nil,
  1131. group="pass",
  1132. },
  1133. {
  1134. name="2",
  1135. attach_offset={x=0, y=-2, z=6},
  1136. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1137. advtrains_attachment_offset_patch_attach_rotation = use_attachment_patch and {x=0, y=180, z=0} or nil,
  1138. group="pass",
  1139. },
  1140. {
  1141. name="3",
  1142. attach_offset={x=0, y=-2, z=-6},
  1143. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1144. group="pass",
  1145. },
  1146. {
  1147. name="4",
  1148. attach_offset={x=0, y=-2, z=-17},
  1149. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1150. group="pass",
  1151. },
  1152. }
  1153. local bistro_seats = {
  1154. {
  1155. name="1",
  1156. attach_offset={x=0, y=-2, z=6},
  1157. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1158. group="pass",
  1159. },
  1160. {
  1161. name="2",
  1162. attach_offset={x=0, y=-2, z=-6},
  1163. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1164. group="pass",
  1165. },
  1166. {
  1167. name="3",
  1168. attach_offset={x=0, y=-2, z=-17},
  1169. view_offset = use_attachment_patch and {x=0, y=0, z=0} or {x=0, y=-1.7, z=0},
  1170. group="pass",
  1171. },
  1172. }
  1173. for _, wagon in pairs(wagons) do
  1174. local wagon_def = {
  1175. mesh = wagon.mesh,
  1176. textures = wagon.textures,
  1177. set_textures = set_textures,
  1178. set_livery = set_livery,
  1179. custom_may_destroy = function(wgn, puncher, time_from_last_punch, tool_capabilities, direction)
  1180. return not update_livery(wgn, puncher)
  1181. end,
  1182. drives_on={default=true},
  1183. max_speed=20,
  1184. seats = wagon.wagon_type == "classic_coaches:bistro_coach" and bistro_seats or common_seats,
  1185. seat_groups = {
  1186. pass={
  1187. name = "Passenger area",
  1188. access_to = {},
  1189. require_doors_open=true,
  1190. },
  1191. },
  1192. doors={
  1193. open={
  1194. [-1]={frames={x=21, y=30}, time=1},
  1195. [1]={frames={x=1, y=10}, time=1}
  1196. },
  1197. close={
  1198. [-1]={frames={x=30, y=41}, time=1},
  1199. [1]={frames={x=10, y=20}, time=1}
  1200. }
  1201. },
  1202. door_entry={-2, 2},
  1203. assign_to_seat_group = {"pass"},
  1204. visual_size = {x=1, y=1},
  1205. wagon_span=3,
  1206. wheel_positions = {1.9, -1.9},
  1207. collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
  1208. coupler_types_front = {chain=true},
  1209. coupler_types_back = {chain=true},
  1210. drops={materials.steelblock},
  1211. }
  1212. if use_attachment_patch then
  1213. advtrains_attachment_offset_patch.setup_advtrains_wagon(wagon_def);
  1214. end
  1215. advtrains.register_wagon(wagon.wagon_type, wagon_def, wagon.name, wagon.inventory_image)
  1216. -- Only register crafting recipes for the wagon if the needed mods are available.
  1217. if materials.base_game then
  1218. minetest.register_craft({
  1219. output = wagon.wagon_type,
  1220. recipe = wagon.recipe,
  1221. })
  1222. end
  1223. end