init.lua 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. --[[
  2. Trainblocks
  3. ===========
  4. This mod adds signs for the advanced trains mod by orwell and it is bachwards-compatible to the advtrains_subwayblocks mod
  5. version 0.3 by maxx and gpcf
  6. Copyright (C) 2018 maxx and gpcf
  7. Copyright (C) 2020, 2021 Montandalar/Blockhead
  8. See LICENSE.txt for more information
  9. ]]--
  10. local crafting_disabled = minetest.settings:get_bool('trainblocks_disable_recipes')
  11. if not trainblocks_disable_recipes then
  12. dofile(minetest.get_modpath("trainblocks") .. "/craft.lua")
  13. end
  14. dofile(minetest.get_modpath("trainblocks") .. "/alias.lua")
  15. minetest.register_node("trainblocks:subwayblock", {
  16. description = "Subwayblock",
  17. light_source = 8,
  18. tiles = {
  19. "down_subwayblock.png",
  20. "down_subwayblock.png",
  21. "front_subwayblock.png",
  22. "front_subwayblock.png",
  23. "front_subwayblock.png",
  24. "front_subwayblock.png"
  25. },
  26. is_ground_content = true,
  27. groups = {cracky = 3},
  28. drop = "trainblocks:subwayblock"
  29. })
  30. --sbahn block
  31. local sbahncolorize = ""
  32. if minetest.settings:get_bool("trainblocks_legacy_sbahnblock", false) then
  33. sbahncolorize = "^[colorize:#00DF11FF"
  34. end --00E876FF
  35. minetest.register_node("trainblocks:sbahnblock", {
  36. description = "Sbahnblock",
  37. light_source = 8,
  38. tiles = {
  39. "down_sbahnblock.png"..sbahncolorize,
  40. "down_sbahnblock.png",
  41. "front_sbahnblock.png",
  42. "front_sbahnblock.png",
  43. "front_sbahnblock.png",
  44. "front_sbahnblock.png"
  45. },
  46. is_ground_content = true,
  47. groups = {cracky = 3},
  48. drop = "trainblocks:sbahnblock"
  49. })
  50. -- Subway signs Line 1 to 10
  51. for count = 1, 10 do
  52. minetest.register_node("trainblocks:line" .. count, {
  53. description = "Line " .. count,
  54. drawtype = "nodebox",
  55. tiles = {"front_line" .. count .. ".png"},
  56. inventory_image = "inventory_line" .. count .. ".png",
  57. light_source = 12,
  58. sunlight_propagates = true,
  59. groups = {
  60. choppy = 2,
  61. attached_node = 1,
  62. oddly_breakable_by_hand = 3,
  63. not_blocking_trains = 1,
  64. },
  65. legacy_wallmounted = true,
  66. is_ground_content = false,
  67. paramtype2 = "wallmounted",
  68. paramtype = 'light',
  69. -- This node box def has to remain to preserve old worlds properly,
  70. -- annoying as it is to be different from the platform signs.
  71. node_box = {
  72. type = "wallmounted",
  73. wall_top ={-0.5, -0.25, -0.25, -0.4375, 0.25, 0.25},
  74. wall_bottom = {-0.5, -0.25, -0.25, -0.4375, 0.25, 0.25},
  75. wall_side = {-0.5, -0.25, -0.25, -0.4375, 0.25, 0.25},
  76. },
  77. })
  78. end
  79. -- Platform signs from 1 to 10
  80. for count = 0, 10, 1 do
  81. minetest.register_node("trainblocks:platformsign" .. count, {
  82. description = "Platform Sign " .. count,
  83. drawtype = "nodebox",
  84. tiles = {"front_platform" .. count .. ".png"},
  85. inventory_image = "inventory_platform" .. count .. ".png",
  86. light_source = 5,
  87. groups = {cracky = 3, not_blocking_trains = 1},
  88. paramtype2 = "facedir",
  89. paramtype = 'light',
  90. node_box = {
  91. type = "fixed",
  92. fixed = {
  93. { -4/16, -4/16, 6/16, 4/16, 4/16, 8/16},
  94. },
  95. },
  96. })
  97. end
  98. --subway signs R and L
  99. minetest.register_node("trainblocks:subwaysignL", {
  100. description = "Subway Sign Left",
  101. tiles = {
  102. "subway_sign3.png",
  103. "subway_sign3.png",
  104. "subway_sign3.png",
  105. "subway_sign3.png",
  106. "subway_sign2.png",
  107. "subway_sign2.png^[transformFX",
  108. },
  109. drawtype = "nodebox",
  110. node_box = {
  111. type = "fixed",
  112. fixed = {
  113. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  114. },
  115. },
  116. paramtype2 = "facedir",
  117. paramtype = 'light',
  118. light_source = 6,
  119. is_ground_content = false,
  120. groups = {cracky = 3},
  121. })
  122. minetest.register_node("trainblocks:subwaysignR", {
  123. description = "Subway Sign Right",
  124. tiles = {
  125. "subway_sign3.png",
  126. "subway_sign3.png",
  127. "subway_sign3.png",
  128. "subway_sign3.png",
  129. "subway_sign2.png",
  130. "subway_sign2.png",
  131. },
  132. drawtype = "nodebox",
  133. node_box = {
  134. type = "fixed",
  135. fixed = {
  136. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  137. },
  138. },
  139. paramtype2 = "facedir",
  140. paramtype = 'light',
  141. light_source = 6,
  142. is_ground_content = false,
  143. groups = {cracky = 3},
  144. })
  145. -- S-bahn signs R and L
  146. minetest.register_node("trainblocks:sbahnsignL", {
  147. description = "SBahn Sign Left",
  148. tiles = {
  149. "sbahn_sign3.png",
  150. "sbahn_sign3.png",
  151. "sbahn_sign3.png",
  152. "sbahn_sign3.png",
  153. "sbahn_sign2l.png",
  154. "sbahn_sign2l.png^[transformFX",
  155. },
  156. drawtype = "nodebox",
  157. node_box = {
  158. type = "fixed",
  159. fixed = {
  160. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  161. },
  162. },
  163. paramtype2 = "facedir",
  164. paramtype = 'light',
  165. light_source = 6,
  166. is_ground_content = false,
  167. groups = {cracky = 3},
  168. })
  169. minetest.register_node("trainblocks:sbahnsignR", {
  170. description = "SBahn Sign Right",
  171. tiles = {
  172. "sbahn_sign3.png",
  173. "sbahn_sign3.png",
  174. "sbahn_sign3.png",
  175. "sbahn_sign3.png",
  176. "sbahn_sign2.png",
  177. "sbahn_sign2.png",
  178. },
  179. drawtype = "nodebox",
  180. node_box = {
  181. type = "fixed",
  182. fixed = {
  183. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  184. },
  185. },
  186. paramtype2 = "facedir",
  187. paramtype = 'light',
  188. light_source = 6,
  189. is_ground_content = false,
  190. groups = {cracky = 3},
  191. })
  192. -- Station signs
  193. minetest.register_node("trainblocks:stationsignR", {
  194. description = "Station Sign Right",
  195. tiles = {
  196. "station_sign3.png",
  197. "station_sign3.png",
  198. "station_sign3.png",
  199. "station_sign3.png",
  200. "station_sign2.png",
  201. "station_sign2.png",
  202. },
  203. drawtype = "nodebox",
  204. node_box = {
  205. type = "fixed",
  206. fixed = {
  207. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  208. },
  209. },
  210. paramtype2 = "facedir",
  211. paramtype = 'light',
  212. light_source = 6,
  213. is_ground_content = false,
  214. groups = {cracky = 3},
  215. })
  216. minetest.register_node("trainblocks:stationsignR_modern", {
  217. description = "Station Sign Right (modern)",
  218. tiles = {
  219. "station_sign3.png",
  220. "station_sign3.png",
  221. "station_sign3.png",
  222. "station_sign3.png",
  223. "station_sign2_modern.png",
  224. "station_sign2_modern.png",
  225. },
  226. drawtype = "nodebox",
  227. node_box = {
  228. type = "fixed",
  229. fixed = {
  230. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  231. },
  232. },
  233. paramtype2 = "facedir",
  234. paramtype = 'light',
  235. light_source = 6,
  236. is_ground_content = false,
  237. groups = {cracky = 3},
  238. drop = "trainblocks:station_block_modern",
  239. })
  240. minetest.register_node("trainblocks:stationsignL", {
  241. description = "Station Sign Left",
  242. tiles = {
  243. "station_sign3.png",
  244. "station_sign3.png",
  245. "station_sign3.png",
  246. "station_sign3.png",
  247. "station_sign2.png",
  248. "station_sign2.png^[transformFX",
  249. },
  250. drawtype = "nodebox",
  251. node_box = {
  252. type = "fixed",
  253. fixed = {
  254. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  255. },
  256. },
  257. paramtype2 = "facedir",
  258. paramtype = 'light',
  259. light_source = 6,
  260. is_ground_content = false,
  261. groups = {cracky = 3},
  262. })
  263. minetest.register_node("trainblocks:stationsignL_modern", {
  264. description = "Station Sign Left (modern)",
  265. tiles = {
  266. "station_sign3.png",
  267. "station_sign3.png",
  268. "station_sign3.png",
  269. "station_sign3.png",
  270. "station_sign2_modern.png",
  271. "station_sign2_modern.png^[transformFX",
  272. },
  273. drawtype = "nodebox",
  274. node_box = {
  275. type = "fixed",
  276. fixed = {
  277. { -8/16, -5/16, 6/16, 8/16, 5/16, 8/16},
  278. },
  279. },
  280. paramtype2 = "facedir",
  281. paramtype = 'light',
  282. light_source = 6,
  283. is_ground_content = false,
  284. groups = {cracky = 3},
  285. })
  286. minetest.register_node("trainblocks:station_block", {
  287. description = "Station Block",
  288. light_source = 8,
  289. tiles = {
  290. "down_station_sign.png",
  291. "down_station_sign.png",
  292. "front_station_sign.png",
  293. "front_station_sign.png",
  294. "front_station_sign.png",
  295. "front_station_sign.png"
  296. },
  297. is_ground_content = true,
  298. groups = {cracky = 3},
  299. drop = "trainblocks:station_block"
  300. })
  301. minetest.register_node("trainblocks:station_block_modern", {
  302. description = "Station Block (modern)",
  303. light_source = 8,
  304. tiles = {
  305. "down_station_sign.png",
  306. "down_station_sign.png",
  307. "front_station_sign_modern.png",
  308. "front_station_sign_modern.png",
  309. "front_station_sign_modern.png",
  310. "front_station_sign_modern.png",
  311. },
  312. is_ground_content = true,
  313. groups = {cracky = 3},
  314. drop = "trainblocks:station_block"
  315. })
  316. -- gabriel's mountain railway block
  317. minetest.register_node("trainblocks:mr", {
  318. description = "Mountain Railway Block",
  319. light_source = 8,
  320. tiles = {
  321. "down_mr.png",
  322. "down_mr.png",
  323. "front_mr.png",
  324. "front_mr.png",
  325. "front_mr.png",
  326. "front_mr.png"
  327. },
  328. is_ground_content = true,
  329. groups = {cracky = 3},
  330. drop = "trainblocks:sbahnblock"
  331. })
  332. local box_flat = {
  333. type = "fixed",
  334. --fixed = {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5},
  335. fixed = {-0.5000, -0.4375, -0.5000, 0.5000, -0.4375, 0.5000}
  336. }
  337. local pedsigns = {
  338. {name = "no_pedestrians", desc = "No Pedestrians Sign"},
  339. {name = "durchgang_verboten", desc = "No Pedestrians Sign (German)"}
  340. }
  341. for _,v in pairs(pedsigns) do
  342. minetest.register_node("trainblocks:"..v.name, {
  343. description = v.desc,
  344. light_source = 2,
  345. drawtype = "signlike",
  346. paramtype = "light",
  347. paramtype2 = "wallmounted",
  348. tiles = {v.name..".png"},
  349. inventory_image = v.name..".png",
  350. wield_image = v.name..".png",
  351. groups = {
  352. cracky = 3,
  353. not_blocking_trains = 1
  354. },
  355. drop = "trainblocks:"..v.name,
  356. is_ground_content = true,
  357. node_box = box_flat,
  358. selection_box = box_flat,
  359. })
  360. end