init.lua 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. local mod_name = "classic_coaches_nationality_livery_pack"
  2. local S = minetest.get_translator(mod_name)
  3. -- Get the translated livery template names from the classic_coaches_generic_livery_pack
  4. -- mod in order to insure they will match during look-up.
  5. local livery_template_generic_tricolor = minetest.translate("classic_coaches_generic_livery_pack", "Generic - Tricolor")
  6. local livery_template_generic_window_stripes = minetest.translate("classic_coaches_generic_livery_pack", "Generic - Window Stripes")
  7. local predefined_liveries = {
  8. {
  9. name = S("Nationality - Argentina"),
  10. notes = "",
  11. livery_design = {
  12. livery_template_name = livery_template_generic_tricolor,
  13. overlays = {
  14. [1] = {id = 1, color = "#75AADB"}, -- "Upper Side Walls",
  15. [2] = {id = 2, color = "#75AADB"}, -- "Lower Side Walls",
  16. [3] = {id = 3, color = "#FFFFFF"}, -- "Window Band",
  17. [4] = {id = 4, color = "#FCBF49"}, -- "Window Band Trim",
  18. [5] = {id = 5, color = "#843511"}, -- "Class Number",
  19. },
  20. },
  21. },
  22. {
  23. name = S("Nationality - Australia"),
  24. notes = "",
  25. livery_design = {
  26. livery_template_name = livery_template_generic_tricolor,
  27. overlays = {
  28. [1] = {id = 1, color = "#00008B"}, -- "Upper Side Walls",
  29. [2] = {id = 2, color = "#00008B"}, -- "Lower Side Walls",
  30. [3] = {id = 3, color = "#FF0000"}, -- "Window Band",
  31. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  32. [5] = {id = 5, color = "#00008B"}, -- "Class Number",
  33. },
  34. },
  35. },
  36. {
  37. name = S("Nationality - Brazil"),
  38. notes = "",
  39. livery_design = {
  40. livery_template_name = livery_template_generic_tricolor,
  41. overlays = {
  42. [1] = {id = 1, color = "#FFDF00"}, -- "Upper Side Walls",
  43. [2] = {id = 2, color = "#009C3B"}, -- "Lower Side Walls",
  44. [3] = {id = 3, color = "#002776"}, -- "Window Band",
  45. [4] = {id = 4, color = "#FFDF00"}, -- "Window Band Trim",
  46. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  47. },
  48. },
  49. },
  50. {
  51. name = S("Nationality - Canada"),
  52. notes = "",
  53. livery_design = {
  54. livery_template_name = livery_template_generic_tricolor,
  55. overlays = {
  56. [1] = {id = 1, color = "#FF0000"}, -- "Upper Side Walls",
  57. [2] = {id = 2, color = "#FF0000"}, -- "Lower Side Walls",
  58. [3] = {id = 3, color = "#FFFFFF"}, -- "Window Band",
  59. [4] = {id = 4, color = "#FF0000"}, -- "Window Band Trim",
  60. [5] = {id = 5, color = "#FF0000"}, -- "Class Number",
  61. },
  62. },
  63. },
  64. {
  65. name = S("Nationality - Czech Republic"),
  66. notes = "",
  67. livery_design = {
  68. livery_template_name = livery_template_generic_tricolor,
  69. overlays = {
  70. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  71. [2] = {id = 2, color = "#D7141A"}, -- "Lower Side Walls",
  72. [3] = {id = 3, color = "#11457E"}, -- "Window Band",
  73. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  74. [5] = {id = 5, color = "#D7141A"}, -- "Class Number",
  75. },
  76. },
  77. },
  78. {
  79. name = S("Nationality - China"),
  80. notes = "",
  81. livery_design = {
  82. livery_template_name = livery_template_generic_tricolor,
  83. overlays = {
  84. [1] = {id = 1, color = "#EE1C25"}, -- "Side Walls",
  85. [2] = {id = 2, color = "#EE1C25"}, -- "Seats",
  86. -- [3] = {id = 3, color = "#000000"}, -- "Service Stripe",
  87. [4] = {id = 4, color = "#EE1C25"}, -- "Logo",
  88. [5] = {id = 5, color = "#FFFF00"}, -- "Class Number",
  89. },
  90. },
  91. },
  92. {
  93. name = S("Nationality - France"),
  94. notes = "",
  95. livery_design = {
  96. livery_template_name = livery_template_generic_tricolor,
  97. overlays = {
  98. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  99. [2] = {id = 2, color = "#0055A4"}, -- "Lower Side Walls",
  100. [3] = {id = 3, color = "#EF4135"}, -- "Window Band",
  101. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  102. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  103. },
  104. },
  105. },
  106. {
  107. name = S("Nationality - Germany"),
  108. notes = "",
  109. livery_design = {
  110. livery_template_name = livery_template_generic_tricolor,
  111. overlays = {
  112. [1] = {id = 1, color = "#FFCC00"}, -- "Upper Side Walls",
  113. [2] = {id = 2, color = "#FF0000"}, -- "Lower Side Walls",
  114. [3] = {id = 3, color = "#000000"}, -- "Window Band",
  115. [4] = {id = 4, color = "#FFCC00"}, -- "Window Band Trim",
  116. [5] = {id = 5, color = "#FFCC00"}, -- "Class Number",
  117. },
  118. },
  119. },
  120. {
  121. name = S("Nationality - India"),
  122. notes = "",
  123. livery_design = {
  124. livery_template_name = livery_template_generic_tricolor,
  125. overlays = {
  126. [1] = {id = 1, color = "#FF671F"}, -- "Upper Side Walls",
  127. [2] = {id = 2, color = "#046A38"}, -- "Lower Side Walls",
  128. [3] = {id = 3, color = "#FFFFFF"}, -- "Window Band",
  129. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  130. [5] = {id = 5, color = "#06038D"}, -- "Class Number",
  131. },
  132. },
  133. },
  134. {
  135. name = S("Nationality - Iran"),
  136. notes = "",
  137. livery_design = {
  138. livery_template_name = livery_template_generic_tricolor,
  139. overlays = {
  140. [1] = {id = 1, color = "#239F40"}, -- "Upper Side Walls",
  141. [2] = {id = 2, color = "#DA0000"}, -- "Lower Side Walls",
  142. [3] = {id = 3, color = "#FFFFFF"}, -- "Window Band",
  143. [4] = {id = 4, color = "#239F40"}, -- "Window Band Trim",
  144. [5] = {id = 5, color = "#239F40"}, -- "Class Number",
  145. },
  146. },
  147. },
  148. {
  149. name = S("Nationality - Italy"),
  150. notes = "",
  151. livery_design = {
  152. livery_template_name = livery_template_generic_tricolor,
  153. overlays = {
  154. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  155. [2] = {id = 2, color = "#008C45"}, -- "Lower Side Walls",
  156. [3] = {id = 3, color = "#CD212A"}, -- "Window Band",
  157. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  158. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  159. },
  160. },
  161. },
  162. {
  163. name = S("Nationality - Japan"),
  164. notes = "",
  165. livery_design = {
  166. livery_template_name = livery_template_generic_tricolor,
  167. overlays = {
  168. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  169. [2] = {id = 2, color = "#FFFFFF"}, -- "Lower Side Walls",
  170. [3] = {id = 3, color = "#BC002D"}, -- "Window Band",
  171. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  172. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  173. },
  174. },
  175. },
  176. {
  177. name = S("Nationality - Kazakhstan"),
  178. notes = "",
  179. livery_design = {
  180. livery_template_name = livery_template_generic_tricolor,
  181. overlays = {
  182. [1] = {id = 1, color = "#00ABC2"}, -- "Upper Side Walls",
  183. [2] = {id = 2, color = "#00ABC2"}, -- "Lower Side Walls",
  184. [3] = {id = 3, color = "#00ABC2"}, -- "Window Band",
  185. [4] = {id = 4, color = "#FFEC2D"}, -- "Window Band Trim",
  186. [5] = {id = 5, color = "#FFEC2D"}, -- "Class Number",
  187. },
  188. },
  189. },
  190. {
  191. name = S("Nationality - Mexico"),
  192. notes = "",
  193. livery_design = {
  194. livery_template_name = livery_template_generic_tricolor,
  195. overlays = {
  196. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  197. [2] = {id = 2, color = "#CE1125"}, -- "Lower Side Walls",
  198. [3] = {id = 3, color = "#006847"}, -- "Window Band",
  199. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  200. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  201. },
  202. },
  203. },
  204. {
  205. name = S("Nationality - Myanmar"),
  206. notes = "",
  207. livery_design = {
  208. livery_template_name = livery_template_generic_tricolor,
  209. overlays = {
  210. [1] = {id = 1, color = "#FECB00"}, -- "Upper Side Walls",
  211. [2] = {id = 2, color = "#EA2839"}, -- "Lower Side Walls",
  212. [3] = {id = 3, color = "#34B233"}, -- "Window Band",
  213. [4] = {id = 4, color = "#FECB00"}, -- "Window Band Trim",
  214. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  215. },
  216. },
  217. },
  218. {
  219. name = S("Nationality - Poland"),
  220. notes = "",
  221. livery_design = {
  222. livery_template_name = livery_template_generic_tricolor,
  223. overlays = {
  224. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  225. [2] = {id = 2, color = "#DC143C"}, -- "Lower Side Walls",
  226. [3] = {id = 3, color = "#FFFFFF"}, -- "Window Band",
  227. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  228. [5] = {id = 5, color = "#DC143C"}, -- "Class Number",
  229. },
  230. },
  231. },
  232. {
  233. name = S("Nationality - Romania"),
  234. notes = "",
  235. livery_design = {
  236. livery_template_name = livery_template_generic_tricolor,
  237. overlays = {
  238. [1] = {id = 1, color = "#002B7F"}, -- "Upper Side Walls",
  239. [2] = {id = 2, color = "#CE1126"}, -- "Lower Side Walls",
  240. [3] = {id = 3, color = "#FCD116"}, -- "Window Band",
  241. [4] = {id = 4, color = "#002B7F"}, -- "Window Band Trim",
  242. [5] = {id = 5, color = "#002B7F"}, -- "Class Number",
  243. },
  244. },
  245. },
  246. {
  247. name = S("Nationality - Russia"),
  248. notes = "",
  249. livery_design = {
  250. livery_template_name = livery_template_generic_tricolor,
  251. overlays = {
  252. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  253. [2] = {id = 2, color = "#DA291C"}, -- "Lower Side Walls",
  254. [3] = {id = 3, color = "#0032A0"}, -- "Window Band",
  255. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  256. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  257. },
  258. },
  259. },
  260. {
  261. name = S("Nationality - South Africa"),
  262. notes = "",
  263. livery_design = {
  264. livery_template_name = livery_template_generic_window_stripes,
  265. overlays = {
  266. [1] = {id = 1, color = "#007A4D"}, -- "Side Walls",
  267. [2] = {id = 2, color = "#FFFFFF"}, -- "Upper Stripe",
  268. [3] = {id = 3, color = "#000000"}, -- "Window Band",
  269. [4] = {id = 4, color = "#DE3831"}, -- "Middle Stripe",
  270. [5] = {id = 5, color = "#002395"}, -- "Lower Stripe",
  271. [6] = {id = 6, color = "#FFB612"}, -- "Class Number",
  272. },
  273. },
  274. },
  275. {
  276. name = S("Nationality - Spain"),
  277. notes = "",
  278. livery_design = {
  279. livery_template_name = livery_template_generic_tricolor,
  280. overlays = {
  281. [1] = {id = 1, color = "#FABD00"}, -- "Upper Side Walls",
  282. [2] = {id = 2, color = "#AD1519"}, -- "Lower Side Walls",
  283. [3] = {id = 3, color = "#FABD00"}, -- "Window Band",
  284. [4] = {id = 4, color = "#FABD00"}, -- "Window Band Trim",
  285. [5] = {id = 5, color = "#AD1519"}, -- "Class Number",
  286. },
  287. },
  288. },
  289. {
  290. name = S("Nationality - Sweden"),
  291. notes = "",
  292. livery_design = {
  293. livery_template_name = livery_template_generic_tricolor,
  294. overlays = {
  295. [1] = {id = 1, color = "#006AA7"}, -- "Upper Side Walls",
  296. [2] = {id = 2, color = "#006AA7"}, -- "Lower Side Walls",
  297. [3] = {id = 3, color = "#FECC00"}, -- "Window Band",
  298. [4] = {id = 4, color = "#006AA7"}, -- "Window Band Trim",
  299. [5] = {id = 5, color = "#006AA7"}, -- "Class Number",
  300. },
  301. },
  302. },
  303. {
  304. name = S("Nationality - Türkiye"),
  305. notes = "",
  306. livery_design = {
  307. livery_template_name = livery_template_generic_tricolor,
  308. overlays = {
  309. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  310. [2] = {id = 2, color = "#E30A17"}, -- "Lower Side Walls",
  311. [3] = {id = 3, color = "#E30A17"}, -- "Window Band",
  312. [4] = {id = 4, color = "#E30A17"}, -- "Window Band Trim",
  313. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  314. },
  315. },
  316. },
  317. {
  318. name = S("Nationality - USA"),
  319. notes = "",
  320. livery_design = {
  321. livery_template_name = livery_template_generic_tricolor,
  322. overlays = {
  323. [1] = {id = 1, color = "#FFFFFF"}, -- "Upper Side Walls",
  324. [2] = {id = 2, color = "#B31942"}, -- "Lower Side Walls",
  325. [3] = {id = 3, color = "#0A3161"}, -- "Window Band",
  326. [4] = {id = 4, color = "#0A3161"}, -- "Window Band Trim",
  327. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  328. },
  329. },
  330. },
  331. {
  332. name = S("Nationality - Ukraine"),
  333. notes = "",
  334. livery_design = {
  335. livery_template_name = livery_template_generic_tricolor,
  336. overlays = {
  337. [1] = {id = 1, color = "#0057B7"}, -- "Upper Side Walls",
  338. [2] = {id = 2, color = "#FFD700"}, -- "Lower Side Walls",
  339. [3] = {id = 3, color = "#0057B7"}, -- "Window Band",
  340. [4] = {id = 4, color = "#0057B7"}, -- "Window Band Trim",
  341. [5] = {id = 5, color = "#FFD700"}, -- "Class Number",
  342. },
  343. },
  344. },
  345. {
  346. name = S("Nationality - United Kingdom"),
  347. notes = "",
  348. livery_design = {
  349. livery_template_name = livery_template_generic_tricolor,
  350. overlays = {
  351. [1] = {id = 1, color = "#012169"}, -- "Upper Side Walls",
  352. [2] = {id = 2, color = "#012169"}, -- "Lower Side Walls",
  353. [3] = {id = 3, color = "#C8102E"}, -- "Window Band",
  354. [4] = {id = 4, color = "#FFFFFF"}, -- "Window Band Trim",
  355. [5] = {id = 5, color = "#FFFFFF"}, -- "Class Number",
  356. },
  357. },
  358. },
  359. }
  360. -- Specify the wagon_types to which the predefined liveries will apply.
  361. local wagon_types = {
  362. "classic_coaches:corridor_coach_class1",
  363. "classic_coaches:corridor_coach_class2",
  364. "classic_coaches:open_coach_class1",
  365. "classic_coaches:open_coach_class2",
  366. }
  367. -- This mod needs to register itself with the livery database in order to be
  368. -- allowed to add predefined liveries. It does not need to register itself with
  369. -- the livery designer tool, however, since it is will not be registering any
  370. -- wagons.
  371. advtrains_livery_database.register_mod(mod_name)
  372. -- Register this mod's predefined wagon liveries with the advtrains_livery_database.
  373. for _, predefined_livery in pairs(predefined_liveries) do
  374. for _, wagon_type in pairs(wagon_types) do
  375. if wagon_type then
  376. local livery_design = predefined_livery.livery_design
  377. livery_design.wagon_type = wagon_type
  378. advtrains_livery_database.add_predefined_livery(predefined_livery.name, livery_design, mod_name, predefined_livery.notes)
  379. end
  380. end
  381. end